More fun in home automation: MQTT + Home Assistant

One of the things I was happy about when I switched to Kerberos.io was that it supported MQTT as a part of the motion detection setup.

Previously I had Home Assistant running every X seconds where X was just chosen at random more or less.

Now, I have Kerberos publishing to an MQTT topic, and then I have NodeRED in the middle for really no reason. It then logs it to debug if desired, and then forwards the message along to a totally different queue.

For fun I also added a manual injection step to trigger it.

I want NodeRED in the setup. I just don't have a good reason, hence the lame behavior at the moment.

But, the end result is, I have a sensor now, which when it receives a message it sets the state of a sensor to "Motion" and leaves it this way for 10s if not updated. I then added a condition to my processing logic to only fire up tensowflow if the sensor is set to "motion".

Not 100% ideal. But, better than where I was. Having the polling in there means that it keeps inspecting images as long as it keeps detecting motion. Which, in some ways is more important than the other thing I'd like, which is for it to process once it gets the signal that there is motion and then continue to do so every X seconds as long as there is motion.

I can probably do this simply by having 2 different automations though. One to process the initial trigger and another to process while active. It might trigger twice the load initially. Or I can have it process on the event and lower the reset threshold.

Either CPU usage has dropped dramatically. And I'm quite happy about that.

Comments

Popular Posts