maragelis / ParadoxRs232toMqtt

esp8266, serial bus to mqtt for Paradox alarm systems
MIT License
80 stars 22 forks source link

Pending status on armed_away #85

Open bigjuanpa opened 4 years ago

bigjuanpa commented 4 years ago

Hi for some reason when I set the alarm to armed_away on HomeAssistant or on the alarm panel the status on home assistant change to pending and never change. Armed_home and disarm works fine.

Any suggestions?. Thanks.

massimaro commented 1 year ago

Hi! Better late than never! I came across this issue. I kinda patched it by using "Special arming" since it only happens with armed_away. I added event 30 and subevent 3 in updateArmStatus and added event 30 as conditional to send the message in processMessage. I would be down to do a pull request for this if needed. Hope it helps some late adopters :)

void updateArmStatus(byte event, byte sub_event){
  bool datachanged = false;
  if (event == 2)
  {
    switch (sub_event)
    {
      case 4:
        hassioStatus.stringArmStatus = "triggered";
        homekitStatus.stringArmStatus = "ALARM_TRIGGERED";
        homekitStatus.intArmStatus=4;
        datachanged=true;

      break;

      case 11:
        hassioStatus.stringArmStatus = "disarmed";
        homekitStatus.stringArmStatus = "DISARMED";
        homekitStatus.intArmStatus = 3;
        datachanged=true;

        break;

      case 12:
         hassioStatus.stringArmStatus = "armed_away";
         homekitStatus.stringArmStatus = "AWAY_ARM";
         homekitStatus.intArmStatus = 1;

         datachanged=true;
        break;

       case 14:
         hassioStatus.stringArmStatus = "pending";
         //homekitStatus.stringArmStatus = "PENDING";
         homekitStatus.intArmStatus = 1;

         datachanged=true;
        break;
      default : break;
    }
  }
  else if (event == 6)
  {
    if (sub_event == 3)
    {
      datachanged=true;
      hassioStatus.stringArmStatus = "armed_home";
      homekitStatus.stringArmStatus = "STAY_ARM";
      homekitStatus.intArmStatus = 0;

    }
    else if ( sub_event == 4)
    {
      datachanged=true;
      hassioStatus.stringArmStatus = "armed_home";
      homekitStatus.stringArmStatus = "NIGHT_ARM";
      homekitStatus.intArmStatus = 2; 
    }
  }
  else if (event == 30)
  {
    if(sub_event == 3)
    {
        datachanged=true;
        hassioStatus.stringArmStatus = "armed_away";
        homekitStatus.stringArmStatus = "AWAY_ARM";
        homekitStatus.intArmStatus = 1;        
    }
  }        
}
if ((Hassio || HomeKit) && (event == 29 || event == 30))
  {
      sendArmStatus();
      homekitStatus.sent = homekitStatus.intArmStatus;
  }