I am building an esp32 connected to my GE Concord alarm system to control it. I need some help making a gpio switch with a condition that if switch via gpio it only sets the switch status, but if I press the switch button in home assistant it performs an action. I’m surprised I can’t find much information on this.
Google ai says to do something like this, but it’s not working. Any suggestions?
- id: armstatus
name: Arm Status
pin:
inverted: true
number: $armstatus
mode:
input: true
pullup: true
platform: gpio
icon: mdi:bullhorn
on_turn_on:
then:
if:
condition:
lambda: if: self.previous_state == 'off'
then:
logger.log: "Switch turned on via physical button!"
# Perform specific actions when turned on by GPIO
else:
logger.log: "Switch turned on via Home Assistant!"
# Perform different actions when turned on through interface
I’m not sure that setup will work for me. There must be a way to do it all in one switch.
Maybe more details will help.
I have a GE Concord alarm panel in my house I’m trying to integrate. The panel can output system status (armed/disarmed). I want a switch in home assistant to synchronize with the status, but also be able to enable/disable the system. This requires a keyswitch input which I have setup as a momentary relay on another gpio. My problem is if I have home assistant enable the alarm via my arm/disarm HA switch it’ll arm/disarm the alarm system as desired, but if I arm it from the alarm control panel, it’ll set the arm/disarm switch and disarm itself via the relay. Sorry kind of confusing.
Here is my setup. I would like the keyswitch to be toggled when I switch Alarm Status(ESP32) from HA. I would like Alarm Status(ESP32) to sync with GE Concord Alarm Status. But when synching Alarm Status(ESP32) to Away(on) it will activate the keyswitch, I need it to toggle keyswitch only when alarm status(ESP32) is toggled from HA.
That’s what I had, but I would like to have one switch that can sync with the alarm status and activate. That solution would require I check the binary sensor for status, then activate via switch.
Maybe this will help. I’m struggling to describe this.
“Alarm Mode” syncs with GE Concord Alarm Status. This works via GPIO.
“Keyswitch” will Disable(Off)/Enable(Away) the alarm via momentary gpio switch.
My goal is the ability to turn on “alarm mode” from Home Assistant, it’ll turn on “keyswitch” and enable the alarm. My problem is if I turn on the alarm from the GE Concord, it’ll turn on “Alarm Mode” which in turn will turn on “Keyswitch”, turning the alarm off.
I need a way to only turn on “Keyswitch” if “Alarm Mode” is set from Home Assistant(Web). But if “Alarm Mode” Is set from GPIO, then do nothing but change the status of “Alarm Mode”