Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Home Assistant states (again)... #49

Closed
jakezp opened this issue Feb 22, 2019 · 16 comments
Closed

Home Assistant states (again)... #49

jakezp opened this issue Feb 22, 2019 · 16 comments
Labels
enhancement New feature or request homebridge homekit testing required Should be fixed, needs validation

Comments

@jakezp
Copy link
Contributor

jakezp commented Feb 22, 2019

Reference: HomeAssistant states #19 (#19)

I cannot seem to reopen #19 so creating a new issue with my update / suggestion / request.

Apologies for being inactive for so long. I've been busy renovating and things are a mess and most things are unplugged at the moment. I've connected everything again and updated home assistant and pai to see if all is working now.

Seems with the new HA lovelace interface, the alarm panel has states available to be used:
arm_home
arm_away
arm_night
arm_custom_bypass

In addition to this, there is still the option to use the previous way to configure the alarm.

I was wondering if it might not be worthwhile make the home assistant COMMANDS and STATES configurable in user.py? Then it can set to a default value in defaults.py, but configurable in user.py? This will allow future HA changes to be updated in the config file instead of requiring the code to be changed again.

@jakezp
Copy link
Contributor Author

jakezp commented Feb 27, 2019

Made some changes...
#51
#52

@jakezp
Copy link
Contributor Author

jakezp commented Feb 28, 2019

Will test home assistant changes later today and confirm.

@jakezp
Copy link
Contributor Author

jakezp commented Apr 7, 2019

I've been doing some testing and so far everything seems ok, apart from the incorrect armed state being reported in Home Assistant.

I have the following configured in pai.conf:

#57  MQTT Homeassistant
MQTT_HOMEASSISTANT_ENABLE = True

# Topic to use
# Defaults to paradox/states/partitions/PARTITION/current_hass
MQTT_HOMEASSISTANT_SUMMARY_TOPIC = 'current_hass'

# Homeassistant states map
# Key = Paradox State
# Value = State propagated to Homeassistant
MQTT_PARTITION_HOMEASSISTANT_STATES = dict(
                             alarm='triggered',
                             stay_arm='armed_home',
                             arm='armed_away',
                             sleep_arm='armed_night',
                             disarm='disarmed')
# Homeassistant control map
# Key = Command from Homeassistant
# Value = Command sent to Panel
MQTT_PARTITION_HOMEASSISTANT_COMMANDS = dict(
                                ARM_HOME='arm_stay',
                                ARM_AWAY='arm',
                                ARM_NIGHT='arm_sleep',
                                DISARM='disarm')

Using the default configuration in Home assistant:

# Alarm panel
alarm_control_panel:
  - platform: mqtt
    state_topic: "paradox/states/partitions/Area_1/current_hass"
    command_topic: "paradox/control/partitions/Area_1"
    name: "paradox"

But for some reason whenever I use arm_stay, the state is reported as armed_away. I've not been able to test arm and arm_sleep yet.

Checking the current_hass MQTT topic after arming arm_stay:

paradox/states/partitions/Area_1/current_hass = armed_away

Not sure if I'm missing something obvious, but I've double checked the HA configuration - https://www.home-assistant.io/components/manual_mqtt/ and I dont see much to be changed on this side.

Thanks,

J

@jakezp
Copy link
Contributor Author

jakezp commented Apr 7, 2019

Scanning through the open issues, seems I'm experiencing the same as in #61...

@jpbarraca
Copy link
Collaborator

Panels send multiple events for an arm state, and we try to guess the state. But as the order changes and events can be lost, the process can fail.

Can you present a log of the messages published to the mqtt broker when arming?

@jakezp
Copy link
Contributor Author

jakezp commented Apr 8, 2019

Sure, do you need a full debug log? How do I send it to you? Email?

I'll try find a gap today where nobody is at home, so I can cycle through all the states (arm_home, arm_away, arm_sleep) while logging.

@jpbarraca
Copy link
Collaborator

jpbarraca commented Apr 8, 2019

Email or gitter. Only the log of the mqtt messages.

UPDATE:
After some tests I noticed that the arm_stay property is changed after the arm property. If this is true, the state will be armed_away as the second property will be ignored. Can you check the sequence of events?

@jooka1978
Copy link

Hi,

Exactly the same issue here, is there a solution?
Thanks.
2019-05-24 00:26:14,725 - INFO - PAI.paradox.interfaces.mqtt_interface - message topic=paradox/control/partitions/Lakas, payload=ARM_HOME
2019-05-24 00:26:30,708 - WARNING - PAI.paradox.paradox - Missing property stay_arm in partition/Lakas

@jpbarraca
Copy link
Collaborator

You can ignore that warning. It is for developers only and has no impact on the system behavior.
We have to map the sequence of all changes related to the arm_* properties under arm, arm_stay, disarm, etc... Can you help?

@jooka1978
Copy link

Yes, of course, just tell me what to do. I am not a ninja so explain please :-)

@jpbarraca
Copy link
Collaborator

In your scenario, subscribe to all messages sent to the partitions (mosquitto_sub), and do all transitions (disarm->arm, arm->disarm, disarm->arm_away....).
Filter the log by only considering the arm_* variables.

Example:

mosquitto_sub -h localhost -t "paradox/states/partitions/#" -v > ha.log

switch modes, waiting some time between transitions (lets, say, 30s) and annotating the timestamps.
Include an alarm trigger event.

stop mosquitto_sub
cat ha.log | grep "arm" > ha-filtered.log

Send the resulting file.

@jooka1978
Copy link

ok, thanks, I will do it tonight

@jooka1978
Copy link

jooka1978 commented May 25, 2019 via email

@jooka1978
Copy link

ok, I have an update. So if I do the arm_home (stay) from the paradox it shows (armed_away) in HA. I can disarm it from HA.
If I do arm_home (stay) from HA it arms the paradox and show armed_home in HA. But I can not disarm anymore from HA. Actually it disarms the panel, but in HA it doesn't update the state to disarmed.
It freezes in "armed_home" state in HA forever. If I arm the paradox panel, it arms, but the HA doesn't get the state.
Only thing I can do at this stage to delete egy mqtt db file.

@jooka1978
Copy link

ok, update again.
I restarted everything: HA, PAI , Mosquitto (also deleted the db file). Since then in home assistent it never goes in "armed_home" state. If I arm from HA to "ARM_HOME" it arms the paradox to arm_stay, but in HA it goes to armed_away.

yozik04 added a commit that referenced this issue Jun 6, 2019
@yozik04
Copy link
Collaborator

yozik04 commented Jun 7, 2019

According to @jooka1978 this one is fixed in latest dev.

@yozik04 yozik04 closed this as completed Jun 7, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request homebridge homekit testing required Should be fixed, needs validation
Projects
None yet
Development

No branches or pull requests

4 participants