For some context, I am trying to turn my old mechanical thermostat into a smart thermostat using two SwitchBots. (I cannot replace the thermostat due to it being an apartment). The SwitchBots work great and my idea is to use one to pull up on the lever to turn on the thermostat and use the other SwitchBot to pull down on the level to turn it off. Essentially these two switches would act as one virtual switch.
I found the Generic Thermostat integration and noticed it requires a switch, so I have been looking into how to make this virtual switch work. The answer seems to be to use a Template Switch, but it is unclear to me how to set up the value_template part of it. Ideally the switch would just remember if it was last turned off or on and return that as the switch value. How should I go about setting up this yaml?
Here is what I have so far:
switch:
- platform: template
switches:
thermostat:
value_template: <<<what to put here?>>>>
turn_on:
- service: switch.turn_on
target:
entity_id: switch.switch.thermostat_top
- delay:
seconds: 3
- service: switch.turn_off
target:
entity_id: switch.switch.thermostat_top
turn_off:
- service: switch.turn_on
target:
entity_id: switch.switch.thermostat_bottom
- delay:
seconds: 3
- service: switch.turn_off
target:
entity_id: switch.switch.thermostat_bottom