Hello, I’m having some trouble writing an ESPHome code for a greenhouse controller. Here’s the logic I’m trying to implement:
If the wind speed exceeds approximately 11 m/s, I want the system to close the greenhouse for 5 hours and ignore all other automations during that time.
If the temperature goes above 25°C, the greenhouse should open, and if it drops below 20°C, it should close.
Any guidance on how to implement this would be greatly appreciated!
The issue I’m facing is that sensor automations aren’t working with the wind sensor (platform: modbus_controller). Typically, I use a Script Component with an Interval Component to control the temperature, but I’m struggling to implement the logic for wind >11 for 5 hours. My current thought is to use a virtual switch that stays on for 5 hours, but I’m not sure how to program the virtual switch to remain on for that duration.
I meant to say that modbus doesn’t seem to have automations based on sensor value. It only has the following automations on_command_sent, on_online and on_offline.
IDK if this is would help but, this is how I make dynamic update intervals so that I can change the update interval from the HA UI instead of having to change code and then flash board each time.
Why would it? It’s a sensor and just like any of the hundreds of possible sensors you could use, they all use the same “Sensor Automations” and it even mentions that in the documentation.
The other Automation topics like Actions,Conditions, etc, those are all Esphome in general, they aren’t just for one thing or another thing, they work with all the things.
Your right, I wasn’t able to get it to work so I just assumed it was not possible. I think i was able to achieve my goal (code below), still have to test it. Thank you for your help.
I’ve noticed one issue: the on_value_range option only triggers when the value moves from outside the range to inside. This is problematic due to wind override. While I can work around it using script and interval components, I’m wondering if there’s an option to make on_value_range activate even when the value is within the range, as long as it satisfies the condition.