Hello, I have a humidity meter: sensor.basement_storage_humidity
I also have a switch that turns the dehumidifier on: switch.dehumidifier_basement
The dehumidifier is slightly noisy so I only want it to run at night (23:00 to 07:00) and only if the humidity is high.
The problem with the script below is that it sometimes keeps running after 7am.
I would suggest ā06:59:59ā to cover the case that it tries to start up again in the last minute. This will leave almost no time for that to happen.
Did you check the trace file of my version of the automation when it failed to turn off the switch at 06:59:59? Perhaps all thatās needed is to change the time to be slightly earlier (06:59:55) to ensure it passes the Time Condition (time must be before 07:00:00`).
In your first post you asked if thereās an āelegant solutionā. Adding a second automation to do something that the first automation can do isnāt exactly the most elegant solution.
It allows you to set the desired humidity and it will automatically control the switch to maintain the value. You can set the desired value via the UI using the Humidifier card or via a service call.
The only thing your automation would need to do is enable it at 23:00 and disably it at 07:00. Between those hours, it will determine if it needs to turn on the switch or not.
In my opinion, thatās the optimal way to handle humidification or dehumidification. Let me know if you need help configuring it.
I wasnāt aware of that integration however I donāt see how to create it in HA (without doing direct coding which I have so far avoided).
Itās not anywhere under integrations, automations or helpers?