Connect alarmsystem to gpio as sensor

Hi,
I have a home alarmsystem that i want to connect to my raspberry pi and home assistant to see if its armed or not and to get at notification if somthing trips the alarm.

The alarm have 3 I/O ports that goes from open to cloesed when the alarm get armed, disarmed, or goes off.

I/0 1: Com
I/O 2: Connects to com when armed
I/O 3: Connects to com when disarmed
I/O 4: Connects to com when alarm goes off

But the problem i have is that the alarm system only gives the Connection for about 5 secounds. so the “sensor” in home assistant shows armed for 5 seconds and then turns back to unarmed.

can i solve this with som code or hardware?

You could use an input_boolean in an automation that gets set/reset whenever the I/O pin/s change.

Any tips how to do that?

See here for info about RPI I/O

and

here for input_boolean

So I would create three input_booleans…

input_boolean:
  - alarm_armed:
      name: Alarm Armed
      initial: off
  - alarm_disarmed:
      name: Alarm Disarmed
      initial: off
  - alarm_sounding:
      name: Alarm Sounding
      initial: off
binary_sensor:
  - platform: rpi_gpio
    ports:
      11: alarmarmed
      12: alarmdisarmed
      13: alarmsounding

automation:
  alias: Alarm is arming
  trigger:
    platform: state
    entity_id: binary_sensor.alarmarmed
    to: 'on'
  action:
    - service: input_boolean.turn_on
      data:
        entity_id: input_boolean.alarm_armed
    - service: input_boolean.turn_off
      data:
        entity_id: input_boolean.alarm_disarmed
        entity_id: input_boolean.alarm_sounding

… and repeat the automation for the other two states remembering to turn off the ones that are not needed depending on the state. Something like that anyway :slight_smile: Obviously you will need to choose the correct i/o pins :stuck_out_tongue: