esphome / feature-requests

ESPHome Feature Request Tracker
https://esphome.io/
406 stars 26 forks source link

Alarm Control Panel: Complete On_... triggers #2294

Open LewisSpring opened 1 year ago

LewisSpring commented 1 year ago

Describe the problem you have/What new integration you would like Add armed_away, armed_home, disarmed, pending triggers. (any trigger that is missing for possible states)

Please describe your use case for this integration and alternatives you've tried:

This would allow users to turn on LEDS to indicate states, send HTTP requests per state, sound a buzzer to indicate progress of setting (ARMING --> ARM_*)

      then:
        - delay: 2s
        - if:
            condition:
              alarm_control_panel.is_armed: alarm_panel
            then: 
              - script.execute: set_beep # beep to indicate the alarm is set

Above example works fine, but a NOT version for detecting disarmed state does not.

Additional context

blackscreener commented 11 months ago
bool AlarmControlPanel::is_state_armed(AlarmControlPanelState state) {
   switch (state) {
     case ACP_STATE_ARMED_AWAY:
     case ACP_STATE_ARMED_HOME:
     case ACP_STATE_ARMED_NIGHT:
     case ACP_STATE_ARMED_VACATION:
     case ACP_STATE_ARMED_CUSTOM_BYPASS:
       return true;
     default:
       return false;
   }
 };

So it doesn't work for disarmed state. Something like that would indicate disarmed state:

bool AlarmControlPanel::is_state_disarmed(AlarmControlPanelState state) {
   if (state == ACP_STATE_DISARMED ) {
       return true;
    }
   else {
       return false;
   }
 };

But better way would be to read and compare all states of alarm in variable..

blackscreener commented 11 months ago

@grahambrown115