hostcc / hass-gs-alarm

Custom Home Assistant integration for G90 security systems
MIT License
1 stars 1 forks source link

[Feature request] Push notifications on alarm triggered #44

Open VictorGarciaKaikkonen opened 3 days ago

VictorGarciaKaikkonen commented 3 days ago

I've been using the plug-in and it works perfectly fine, but I wish there was an option for an Android device to receive notifications when the alarm is triggered. I don't think there's one, unless I've missed it.

Would this be something you would consider?

Kind regards

hostcc commented 3 days ago

Thanks for the idea, @VictorGarciaKaikkonen! Using HomeAssistant an an abstraction one could have such notifications w/o changing the integration - adding device-specific notifications there would be a notable overhead.

Due to other reasons I'm using HASS with HTML web frontend instead of native mobile application, where I have the HASS automation below. Basically it reacts on state change of the alarm panel, and issues both HTML5 and persistent HASS notifications (the former will pop up in the browser if allowed in settings, the latter - will be visible in HASS UI, notifications section).

Please feel free to adjust for your needs - for example, state trigger supports additional filtering so you could notify on specific states (e.g. panel triggered alarm, but not been disarmed). Or you might want to use a different notifications method from the list.

alias: Notify on state change
description: ""
triggers:
  - entity_id:
      - alarm_control_panel.ga<...>
    trigger: state
conditions: []
actions:
  - data:
      title: "{{ trigger.from_state.name }}"
      message: >-
        {{ state_translated(trigger.to_state.entity_id)|capitalize }} {%- set
        changed_by = trigger.to_state.attributes.get('changed_by') -%} {%- if
        changed_by %}
         ({{ state_attr(changed_by, 'friendly_name') }}) {%- endif -%}
    action: notify.notify
  - data:
      title: "{{ trigger.from_state.name }}"
      message: >-
        {{ state_translated(trigger.to_state.entity_id)|capitalize }} {%- set
        changed_by = trigger.to_state.attributes.get('changed_by') -%} {%- if
        changed_by %}
         ({{ state_attr(changed_by, 'friendly_name') }}) {%- endif -%}
    action: persistent_notification.create
mode: parallel
max: 10
VictorGarciaKaikkonen commented 2 days ago

@hostcc Thank you very much for your guidance! I will take a look at it