I’m quite new to Home Assistant and ESPhome so apologize if something might be obvious to some of you
I’m working with a m5stack switch connected with a qmp6988 temperature sensor that’s being controller by a thermostat card on the dashboard, I’m trying to make it that the switch goes on when some conditions are met like : the thermostat is off and the temperature is below a certain range.
So far I’ve worked with lambda to get the thermostat state, but I’m not quite sure how to get the actual temperature value so that the logic would work.
I was thinking if @zinc does in fact want to turn it on if it is off and temp is below x then you could trigger a climate action to turn it on from a on_value_range on the temperature sensor (with a condition there to check it is off. But you may not even need that condition).
@Mahko_Mahko
I’ve tried to add the on_value_range in the sensor component, the switch does turn on and everything works, the issue is that on the thermostat card it show as idle, also by settings fixed values it create a situation when if the temperature is below the value I stated in the code, and I activate the heating mode on the card, the switch will turn off whenever the temperature reaches said cap.
To clarify my goal: I want to automate my thermostat so that whenever I leave my office (that imply I will set to idle the thermostat myself) it will have a constant temperature during the night.
@zoogara
On you last reply, by setting the on-off state you mean making the automation from the home assistant settings?
You should be able to use the built-in “away” preset to achieve what you want.
From what I can tell from your use case, you shouldn’t need to be doing any special code at all. Just configure a thermostat properly. Then it should all just work. Others have solved these problems and made it easy to set up.
I suggest you spend a bit more time getting familiar with the docs.