@@ -384,35 +384,39 @@ void CrowAlarmPanel::loop() {
384384 ESP_LOGW (TAG , " [%-*s] Armed state too short, discarding" , this ->keypad_label_width_ , CONTROLLER_LABEL );
385385 break ;
386386 }
387- if (armed_state_ != nullptr ) {
388- if (data[ 0 ] == 0x00 && data[ 1 ] == 0x01 ) {
387+ if (data[ 0 ] == 0x00 && data[ 1 ] == 0x01 ) {
388+ if (this -> armed_state_ != nullptr ) {
389389 this ->armed_state_ ->publish_state (" arming" );
390- ESP_LOGD (TAG , " [%-*s] Arming [%02x.%s]" , this ->keypad_label_width_ , CONTROLLER_LABEL , type,
391- format_hex_pretty (data).c_str ());
392- this ->last_confirmed_acp_state_ = alarm_control_panel::ACP_STATE_ARMING ;
393- if (this ->alarm_control_panel_ != nullptr ) {
394- this ->alarm_control_panel_ ->publish_state (alarm_control_panel::ACP_STATE_ARMING );
395- }
396- } else if (data[0 ] == 0x01 && data[1 ] == 0x00 ) {
390+ }
391+ ESP_LOGD (TAG , " [%-*s] Arming [%02x.%s]" , this ->keypad_label_width_ , CONTROLLER_LABEL , type,
392+ format_hex_pretty (data).c_str ());
393+ this ->last_confirmed_acp_state_ = alarm_control_panel::ACP_STATE_ARMING ;
394+ if (this ->alarm_control_panel_ != nullptr ) {
395+ this ->alarm_control_panel_ ->publish_state (alarm_control_panel::ACP_STATE_ARMING );
396+ }
397+ } else if (data[0 ] == 0x01 && data[1 ] == 0x00 ) {
398+ if (this ->armed_state_ != nullptr ) {
397399 this ->armed_state_ ->publish_state (" armed_away" );
398- ESP_LOGD (TAG , " [%-*s] Armed Away [%02x.%s]" , this ->keypad_label_width_ , CONTROLLER_LABEL , type,
399- format_hex_pretty (data).c_str ());
400- this ->last_confirmed_acp_state_ = alarm_control_panel::ACP_STATE_ARMED_AWAY ;
401- if (this ->alarm_control_panel_ != nullptr ) {
402- this ->alarm_control_panel_ ->publish_state (alarm_control_panel::ACP_STATE_ARMED_AWAY );
403- }
404- } else if (data[0 ] == 0x00 && data[1 ] == 0x00 ) {
400+ }
401+ ESP_LOGD (TAG , " [%-*s] Armed Away [%02x.%s]" , this ->keypad_label_width_ , CONTROLLER_LABEL , type,
402+ format_hex_pretty (data).c_str ());
403+ this ->last_confirmed_acp_state_ = alarm_control_panel::ACP_STATE_ARMED_AWAY ;
404+ if (this ->alarm_control_panel_ != nullptr ) {
405+ this ->alarm_control_panel_ ->publish_state (alarm_control_panel::ACP_STATE_ARMED_AWAY );
406+ }
407+ } else if (data[0 ] == 0x00 && data[1 ] == 0x00 ) {
408+ if (this ->armed_state_ != nullptr ) {
405409 this ->armed_state_ ->publish_state (" disarmed" );
406- ESP_LOGD (TAG , " [%-*s] Disarmed [%02x.%s]" , this ->keypad_label_width_ , CONTROLLER_LABEL , type,
407- format_hex_pretty (data).c_str ());
408- this ->last_confirmed_acp_state_ = alarm_control_panel::ACP_STATE_DISARMED ;
409- if (this ->alarm_control_panel_ != nullptr ) {
410- this ->alarm_control_panel_ ->publish_state (alarm_control_panel::ACP_STATE_DISARMED );
411- }
412- } else {
413- ESP_LOGD (TAG , " [%-*s] Armed state unknown [%02x.%s]" , this ->keypad_label_width_ , CONTROLLER_LABEL , type,
414- format_hex_pretty (data).c_str ());
415410 }
411+ ESP_LOGD (TAG , " [%-*s] Disarmed [%02x.%s]" , this ->keypad_label_width_ , CONTROLLER_LABEL , type,
412+ format_hex_pretty (data).c_str ());
413+ this ->last_confirmed_acp_state_ = alarm_control_panel::ACP_STATE_DISARMED ;
414+ if (this ->alarm_control_panel_ != nullptr ) {
415+ this ->alarm_control_panel_ ->publish_state (alarm_control_panel::ACP_STATE_DISARMED );
416+ }
417+ } else {
418+ ESP_LOGD (TAG , " [%-*s] Armed state unknown [%02x.%s]" , this ->keypad_label_width_ , CONTROLLER_LABEL , type,
419+ format_hex_pretty (data).c_str ());
416420 }
417421 // ARMED_STATE is the controller's own authoritative state broadcast, independent of the
418422 // arm/disarm state machine below — this is the only signal CODE_ENTER_PENDING treats as
0 commit comments