[alarm_control_panel] Allow sensor to trigger when alarm disarmed (#7746)

This commit is contained in:
nworbneb 2025-05-01 03:27:14 +01:00 committed by GitHub
parent 807925fd38
commit 4ec8414050
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 24 additions and 18 deletions

View File

@ -51,6 +51,7 @@ ALARM_SENSOR_TYPES = {
"DELAYED": AlarmSensorType.ALARM_SENSOR_TYPE_DELAYED, "DELAYED": AlarmSensorType.ALARM_SENSOR_TYPE_DELAYED,
"INSTANT": AlarmSensorType.ALARM_SENSOR_TYPE_INSTANT, "INSTANT": AlarmSensorType.ALARM_SENSOR_TYPE_INSTANT,
"DELAYED_FOLLOWER": AlarmSensorType.ALARM_SENSOR_TYPE_DELAYED_FOLLOWER, "DELAYED_FOLLOWER": AlarmSensorType.ALARM_SENSOR_TYPE_DELAYED_FOLLOWER,
"INSTANT_ALWAYS": AlarmSensorType.ALARM_SENSOR_TYPE_INSTANT_ALWAYS,
} }

View File

@ -58,6 +58,9 @@ void TemplateAlarmControlPanel::dump_config() {
case ALARM_SENSOR_TYPE_DELAYED_FOLLOWER: case ALARM_SENSOR_TYPE_DELAYED_FOLLOWER:
sensor_type = "delayed_follower"; sensor_type = "delayed_follower";
break; break;
case ALARM_SENSOR_TYPE_INSTANT_ALWAYS:
sensor_type = "instant_always";
break;
case ALARM_SENSOR_TYPE_DELAYED: case ALARM_SENSOR_TYPE_DELAYED:
default: default:
sensor_type = "delayed"; sensor_type = "delayed";
@ -145,24 +148,25 @@ void TemplateAlarmControlPanel::loop() {
continue; continue;
} }
// If sensor type is of type instant switch (sensor_info.second.type) {
if (sensor_info.second.type == ALARM_SENSOR_TYPE_INSTANT) { case ALARM_SENSOR_TYPE_INSTANT:
instant_sensor_not_ready = true;
break;
}
// If sensor type is of type interior follower
if (sensor_info.second.type == ALARM_SENSOR_TYPE_DELAYED_FOLLOWER) {
// Look to see if we are in the pending state
if (this->current_state_ == ACP_STATE_PENDING) {
delayed_sensor_not_ready = true;
} else {
instant_sensor_not_ready = true; instant_sensor_not_ready = true;
} break;
} case ALARM_SENSOR_TYPE_INSTANT_ALWAYS:
// If sensor type is of type delayed instant_sensor_not_ready = true;
if (sensor_info.second.type == ALARM_SENSOR_TYPE_DELAYED) { future_state = ACP_STATE_TRIGGERED;
delayed_sensor_not_ready = true; break;
break; case ALARM_SENSOR_TYPE_DELAYED_FOLLOWER:
// Look to see if we are in the pending state
if (this->current_state_ == ACP_STATE_PENDING) {
delayed_sensor_not_ready = true;
} else {
instant_sensor_not_ready = true;
}
break;
case ALARM_SENSOR_TYPE_DELAYED:
default:
delayed_sensor_not_ready = true;
} }
} }
} }

View File

@ -27,7 +27,8 @@ enum BinarySensorFlags : uint16_t {
enum AlarmSensorType : uint16_t { enum AlarmSensorType : uint16_t {
ALARM_SENSOR_TYPE_DELAYED = 0, ALARM_SENSOR_TYPE_DELAYED = 0,
ALARM_SENSOR_TYPE_INSTANT, ALARM_SENSOR_TYPE_INSTANT,
ALARM_SENSOR_TYPE_DELAYED_FOLLOWER ALARM_SENSOR_TYPE_DELAYED_FOLLOWER,
ALARM_SENSOR_TYPE_INSTANT_ALWAYS,
}; };
#endif #endif