just add assumed_state: true to your switch in esphome and youâll have a state based switch. If the same signal is sent to âturn offâ then you need to duplicate the turn on action in the turn off action area.
- platform: template
name: "aqled_power"
id: aqled_power
assumed_state: true
turn_on_action:
- remote_transmitter.transmit_raw:
code: [ 8974, -4445, 587, -537, 589, -538, 644, -1584, 588, -538, 646, -459, 563, -560, 589, -536, 644, -463, 559, -1690, 644, -1584, 589, -537, 645, -1584, 588, -1643, 585, -1663, 645, -1584, 589, -1643, 585, -538, 588, -539, 562, -542, 560, -563,
589, -538, 644, -461, 560, -1690, 642, -463, 559, -1689, 644, -1585, 589, -1642, 586, -1664, 562, -1666, 589, -1642, 585, -538, 589, -1643, 585]
carrier_frequency: 38kHz
turn_off_action:
- remote_transmitter.transmit_raw:
code: [ 8974, -4445, 587, -537, 589, -538, 644, -1584, 588, -538, 646, -459, 563, -560, 589, -536, 644, -463, 559, -1690, 644, -1584, 589, -537, 645, -1584, 588, -1643, 585, -1663, 645, -1584, 589, -1643, 585, -538, 588, -539, 562, -542, 560, -563,
589, -538, 644, -461, 560, -1690, 642, -463, 559, -1689, 644, -1585, 589, -1642, 586, -1664, 562, -1666, 589, -1642, 585, -538, 589, -1643, 585]
carrier_frequency: 38kHz
Advanced configuration with shortened code...
- platform: template
name: "aqled_power"
id: aqled_power
assumed_state: true
turn_on_action: &my_action
- remote_transmitter.transmit_raw:
code: [ 8974, -4445, 587, -537, 589, -538, 644, -1584, 588, -538, 646, -459, 563, -560, 589, -536, 644, -463, 559, -1690, 644, -1584, 589, -537, 645, -1584, 588, -1643, 585, -1663, 645, -1584, 589, -1643, 585, -538, 588, -539, 562, -542, 560, -563,
589, -538, 644, -461, 560, -1690, 642, -463, 559, -1689, 644, -1585, 589, -1642, 586, -1664, 562, -1666, 589, -1642, 585, -538, 589, -1643, 585]
carrier_frequency: 38kHz
turn_off_action: *my_action
Then, do nothing in home assistant because you now have a switch that works properly. But if you REALLY want a light⌠configure a light via esphome or use the template switch in this post in conjunction with the esphome configuration above: