Copy

Home Control Assistant Newsletter for April 11 2021

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.
 
Plan A, B, C and D
I’ve been working with a user who is using some Hubitat sensors to determine if vents in an outdoor space should be open or closed based upon temperature and humidity. Not hard, right? It is if everything works. But then we started to consider all the possibilities of failure.

The first thing that could happen is, of course, that HCA terminates due to some program error. Yes, try as the developers might, that can happen. This is why it is always important that any mission critical application include some sort of non-automated backup. In this application that isn’t necessary but, for example, any smart thermostat should always be backed up by some sort of mechanical anti-freeze system.

The list of possible failures is long. The computer running HCA could fail. That one is hard to handle but the backup as described above would take over. Finally, we start to come to things we can handle within the system we build. Suppose that the temperature sensor that drives this system fails – maybe its battery ran out or it is just broken. Or the Hubitat interface could fail or lose its ability to send state change reports to the computer – this can happen if the IP address of the computer changes. Or the local LAN could fail and even though HCA, Hubitat, and sensor works, the data can’t get to HCA.

That’s why it is always necessary to have a plan B and plan C and as many plans as possible. Here is what we did.

First, as I said, we don’t need a non-automated backup in this case. Next, we decided to put in two sensors and the algorithm now looks at both sensors and sees if they both work, report reasonable data values, and both report the same temperature within some specified acceptable amount. One of the two sensors is the preferred one due to position, so that’s the one we use if available. But if data can’t be retrieved from that one, the algorithm uses the data from the other. If the system can’t read either sensor then it uses the weather data for the location to take a “guess” at conditions and controls the vents.

The algorithm we implemented also relies upon the sensors sending unsolicited state change reports to the Hubitat when conditions change and Hubitat sends these on to HCA. The HCA Hubitat package adds a tag on the sensor device with the date-time when the last report was received. The algorithm uses the data in the temperature and humidity tags but first checks if the data is too old. If it is, then instead of just using that data it performs a status poll on the sensor to get current data. That poll could fail so the other sensor’s data is used if available. If no sensors are available then weather data is used.

Of course, all these failure conditions, while “handled”, generate a message to the user so that the problem can be investigated and hopefully resolved.

This is what we built:

Plan A: Get the temperature of each sensor by reading the tags on the sensor devices. These come from the auto reports. Check that they are reasonably current and agree with each other.

Plan B: Actively poll the sensors if the auto reports are too old.

Plan C: Use a single sensor if one is unavailable.

Plan D: Use weather data if neither sensor is available.

The problem with any system is there is no way to handle all possible failures. But we can at least look for problems and report them. For example, making sure that any HTTP programmer element has timeout handling or data in an expected range is within that expected range. Our first pass at building this system didn’t have any of these checks, but over time each of these sort of problems occurred. Failure is always an option so a plan B, C, and D will always be needed. So build it in!
Backup!

When was the last time you made a backup of your HCA design? Not a month goes by without at least one tale of woe from a HCA user. Please use the "Design Backup Assistant" on the Tools ribbon category. The work you save will be your own.


 
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 © 2021 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