News for hackers. Stuff that matters.
Re:Making my dumb A/C smart with Elixir and Nerves by toast0 on Saturday May 25, 2024 @08:10PM (#40478805)
HomeAssistant seems nice enough, but everytime I sit down to try to bend it to my will I get real stuck.

I want to coordinate two thermostats that are on a zoned system, and I have a lot of things I want to do, but the first thing is I want to replace the automatic fan with something more specific, and I can't figure out how to get started:

If zone 1 is off (or fan) and zone 2 has had the fan run less than 30 minutes in the last 60, and less than 8 hours in the last 24, run the fan.

But I can't figure out how to write a homeassistant helper that gets recent runtime.

Eventually, I'll probably just write some Erlang to poll HomeAssistant (since HomeAssistant knows how to poll the thermostat with HomeKit, and HomeKit is otherwise inscrutable).

Re:Making my dumb A/C smart with Elixir and Nerves by metadat on Saturday May 25, 2024 @08:12PM (#40478812)
Node Red.

This will do it (though it'll require some learning and trial & error, like any worthwhile automation platform, be it HA, HomeSeer, etc).

https://nodered.org

https://community.home-assistant.io/t/home-assistant-communi...

Re:Making my dumb A/C smart with Elixir and Nerves by KennyBlanken on Saturday May 25, 2024 @08:55PM (#40478982)
I'm pretty sure home assistant has at least one way to find out how long it's been since there was a state change on something. In fact I know it does, because I have a toggleable control one of my outlets to limit its maximum on time.

This might get you started:

https://www.google.com/search?q=home+assistant+time+since+la...

Here's one example: https://community.home-assistant.io/t/show-time-since-last-s...

Here's another: https://community.home-assistant.io/t/get-difference-from-no...

Hope this helps!

Re:Making my dumb A/C smart with Elixir and Nerves by Nextgrid on Saturday May 25, 2024 @11:04PM (#40479506)
Don't rely on this for any kind of interlocking or complex logic. They will get into an inconsistent/broken state sooner or later.

I believe the "how long since a state change" only starts counting from the state change and within the same session. If the server restarts, the counter stops and will restart from scratch only from the next state change.

This means if an automation relies on such timers to reset itself back to its idle state, a server restart will forever leave it in that state.

Automations are nice for quick one-off actions but for anything that lasts more than a few seconds I'd suggest looking for alternatives. Something as complex as managing multiple devices with interdependent states is way too complex and is bound to go wrong even if you actually manage to express it in an automation (and don't give up because of the absolutely awful automation editor UI).

Home Assistant is great as a proxy/aggregator to connect many different devices/protocols and expose them under a single, consistent API, but it's terrible at logic. For any kind of complex task I'd suggest making a stand-alone app that interacts with the Home Assistant API to observe device states and control them.

Re:Making my dumb A/C smart with Elixir and Nerves by metadat on Sunday May 26, 2024 @12:46PM (#40483509)
If you also have the target device hooked up to a smart outlet, you can easily reset it to known state, even if the target is IR only.