Copy

Home Control Assistant Newsletter for November 29

Have you looked over the version 17 release notes? Lots of changes that you can incorporate into your designs right away. Easy upgrade.

Looking for answers to the most common questions about HCA? Check out our
Frequently Asked Questions page.
 
Icons that show “stuff”
I received an enhancement request a few weeks back: A user wanted to have the mobile apps show the sunrise and sunset time for their location. This is one of the “how do I show stuff” questions that come up. The answer is “you can do it yourself” and here is how.

The general idea is to create a program and have that program adjust its own icon to show the text you want. There are two ways to do that: by changing the icon label and/or by writing text over the icon, which is what in the HCA World we call “annotation”, is easy to do.

First create a program. Second add to that program a compute element that does the work of changing the label or annotation. I’ll cover that in a minute. Next create some mechanism to have the program be started on some event. It could be scheduled at 00:01 so it can show today’s sunrise or sunset time. Or it could be in response to some event like a reception, variable value change, or state change of some device.

For the more complex triggers, in HCA 17 during the first step of the wizard when you create a program it asks what is the purpose of the program. For other than general purpose programs it creates the “scaffolding” for the data supplied to the program. For example, a state change trigger starts a program and supplies the object whose state changed. Or a variable change trigger supplies the name of the variable.

 

For a program that will be started by a variable change, it creates a program that accepts parameters and also adds a program-note element to display what it received so you can easily test the program.

You do know about the Program-Note element and the program-note viewer? I hope so. Its been there for a while and was improved in V17.

Here is the Begin-Here element for a program created whose purpose is to respond to a variable change.

 

And the program note element:

 

The bottom line here is that with a variable change trigger – which you need to add to the program - when the program begins it has the name of the variable that changed. This way the program could have several triggers for different variables and then “know” which one it is working with.

Suppose you wanted to show the value of that variable as the icon label. Done in one Compute element:


 
_IconChangeEx is supplied with several items. First the name of the object whose icon is being changed. _ThisProgram() evaluates to the name of the running program and that is what we want since we are changing the program’s own icon. 

The next piece of data is a code that says what we want IconChangeEx to do. Code 1 is to change the icon, code 2 is to change the icon label, and code 4, which we will use in the next example, is to perform annotation.

For code 2 we want to get the value of the variable that changed state, and that is what we do with the VarValue function. 

Before and after  the variable changed value – in this case to a date/time:



 Suppose instead we want to put the Sunrise time on an icon. Here is the single Compute element needed:
 


OK, I admit it is a bit more complicated. I’ll go step-by-step.

First the icon of the program is changed to the Sunrise icon that is pre-installed in the 110x110 theme,

Next, the label is changed to say “Sunrise”.

Finally the sunrise time is found from the _Sunrise() function and formatted to only show the time. Because text gets centered when you do annotation, I needed to move it down a bit, and I did that by adding two “new line” characters to the start of the string to display lower in the icon. Here is what I see:
 

You can do a lot more with changing the label text or the annotation now that you know the tools to work with.
BTW, where did I get all the details of all these functions? Documentation is right in the user guide.


https://www.homecontrolassistant.com/download/Doc/13_Expressions.pdf

Please be safe, wear a mask, wash your hands. Science will save us.



 
User-to-User forum

An HCA User who wanted to set up a forum for user-to-user communication. I'm passing this on, but please know that this is not a HCA company project and I will not be spending much time there so I don't know how this will work out. Here is a link to what he set up.


https://www.reddit.com/r/HomeControlAssistant/

 
Want to take the next step in automation? Want to get started with Amazon Alexa and Google Assistant and control HCA by voice commands? Even if you are a long-time user of HCA, the Getting Started guides have all the info you need on client-server, mobile applications, DDNS, and voice assistants.

All of the
Getting Started Guides are available on the support website.
 
Copyright © 2020 Advanced Quonset Technology, Inc, All rights reserved.


Want to change how you receive these emails?
You can update your preferences or unsubscribe from this list.

Email Marketing Powered by Mailchimp