Hello!
I have an old home alarm that I partially integrated into Home Assistant. With the help of an ESP8266 as well as a relay and a remote control, I have now managed to control the alarm from the HA.
From the buttons of the remote control, I have soldered cables to the relay to be able to simulate button presses like a finger.
Now I have two buttons in the home assistant switch.arm_house and switch.disarm_house from ESPHome. Every time you press the button in HA, the relay is triggered and the status goes from on to off.
Now to the mint part, how do I get the on/off buttons to show permanent status? I want that when the button alarm on should show on all the time and then we press the next button off, the first should go to off again.
ESPHome Code
switch:
- platform: gpio
pin: 25
id: relay1
- platform: template
name: "Arm house"
icon: "mdi:shield-lock-outline"
turn_on_action:
- switch.turn_on: relay1
- delay: 0.5s
- switch.turn_off: relay1
- platform: gpio
pin: 26
id: relay2
- platform: template
name: "Disarm house"
icon: "mdi:shield-lock-open-outline"
turn_on_action:
- switch.turn_on: relay2
- delay: 0.5s
- switch.turn_off: relay2
Home Assistant fronted code
color: rgb(3, 169, 244)
color_type: card
entity: switch.arm_house
name: Armed
show_state: true
state:
- color: green
value: 'on'
tap_action:
action: toggle
data:
entity_id: switch.arm_house
type: custom:button-card
color: rgb(3, 169, 244)
color_type: card
entity: switch.disarm_house
icon: mdi:shield-home
name: Disarmed
show_state: true
state:
- color: red
value: 'off'
tap_action:
action: toggle
data:
entity_id: switch.disarm_house
type: custom:button-card
Thanks in advance
Patric