I’m still relatively new to Home Assistant and wanted to set up some logic for my humidifier controller. I had previously coded up a 8266 with all the Logic and had my Nest calls in there but now that everything has switched over to Google I was looking to switch things up and rely more on Home Assistant. I have my google integrations set up so I’m getting all the data I need and I’m using ESPHome to create the actual switch on the 8266 but I’m lost figuring out the best way to set up the logic. Ideally what’d I’d like to do is set a target and max humidity based on the outside temperature, then filter through my 3 thermostats and test 1) if they are set to heat or Heat/cool (if not I don’t want them included) 2) test if the current humidity is below the target or above the max - if any are < target and None > max then turn on the humidifier else turn off humidifier. The switch itself is hardwired to the heat wire on the furnace so it only runs if there’s actual heat being used.
I’m not sure how to best structure the automations vs scripts and where to house the different components of the logic. Thoughts/advice/obvious documentation i missed? Thanks in advance
Its really hard for me to help you here, as I find it difficult to understand what exactly you want. Maybe just try, to set up some automation and see how it goes. If you have trouble finding a starting point, I would suggest starting with some automation. Weather you need/want a script will become obvious throughout your journey.
From what you wrote, I have the impression you are best off splitting the whole thing into several automatons. It might be my personal preference, but I think smaller automations doing only one thing is way easier to manage then these big complex all in one automations.
The basic steps would be:
Get the outside temperature
if statement to set maxhumidity and minhumidity depending on outside temp
Then I’d need to check the humidity and status of all 3 thermostats
If any active thermostat is above maxhumidity then humidifier should be off
else if any active thermostat is below the minhumidity then humidifier should be off.
I played around with some of this yesterday and I have a little bit clearer picture how some of the pieces come together. My plan now is to have an automation that triggers if the humidity changes at all or if the status of any of the thermostats changes at all. Then i’d have a script that would set the max and min humidity targets, that would then pass those variables to another script that would check the humidity and status and turn on or off the humidifier.
Is a script preferable to a automation for parts of this or is it better to have multiple automations? What’s the rule of thumb for when to use script vs automation?
To connect max and min humidity to the outside temperature, you can create a template sensor one for max and one for min. You can then use these max and min sensors as conditions in your following automations.
Then you need two or maybe three automatons to control your humidifier. One automation to turn it on and one to turn it of. The trigger would be the measured humidity by your sensor, and the condition would be the value for the above created template sensor.