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

HomeAssistant states #19

Closed
jakezp opened this issue Nov 21, 2018 · 6 comments
Closed

HomeAssistant states #19

jakezp opened this issue Nov 21, 2018 · 6 comments
Labels
enhancement New feature or request testing required Should be fixed, needs validation

Comments

@jakezp
Copy link
Contributor

jakezp commented Nov 21, 2018

I've made a very quick edit to add HomeAssistant MQTT Alarm Control Panel compatible states - https://www.home-assistant.io/components/alarm_control_panel.mqtt/

I've tested it and it seems to be working for me, but you will possibly have a better way of doing it. Perhaps include a check to ensure MQTT_HOMEBRIDGE_ENABLE & MQTT_HOMEASSIST_ENABLE is not set to True simultaneously and ensure it doesn't break anything else?

If you want to include it?

I know you're invesitgating a plugin, but this works.

Attached - homeassistant-changes.txt

@jpbarraca jpbarraca added enhancement New feature or request testing required Should be fixed, needs validation labels Nov 30, 2018
@jakezp
Copy link
Contributor Author

jakezp commented Dec 2, 2018

This is awesome! Thanks! I've been playing around with it and updated the commands and states as below. Home assistant does not support 'sleep' at the moment, only 'arm' and 'stay'.

Would you mind updating as below?

diff --git a/paradox/interfaces/mqtt_interface.py b/paradox/interfaces/mqtt_interface.py
index 348874d..2526f63 100644
--- a/paradox/interfaces/mqtt_interface.py
+++ b/paradox/interfaces/mqtt_interface.py
@@ -15,12 +15,12 @@ logger = logging.getLogger('PAI').getChild(__name__)
 PARTITION_HOMEBRIDGE_COMMANDS = dict(
     STAY_ARM='arm_stay', AWAY_ARM='arm', NIGHT_ARM='arm_sleep', DISARM='disarm')
 PARTITION_HOMEASSISTANT_COMMANDS = dict(
-    ARM_AWAY='arm', NIGHT_ARM='arm_sleep', DISARM='disarm')
+  armed_home='arm_stay', armed_away='arm', armed_sleep='arm_sleep', disarmed='disarm')

 PARTITION_HOMEBRIDGE_STATES = dict(
     alarm='ALARM_TRIGGERED', stay_arm='STAY_ARM', arm='AWAY_ARM', sleep_arm='NIGHT_ARM', disarm='DISARMED')
 PARTITION_HOMEASSISTANT_STATES = dict(
-    alarm='triggered', stay_arm='armed_away', arm='armed_away', sleep_arm='armed_home', disarm='disarmed')
+    alarm='triggered', stay_arm='armed_home', arm='armed_away', sleep_arm='armed_sleep', disarm='disarmed')

 ELEMENT_TOPIC_MAP = dict(partition=cfg.MQTT_PARTITION_TOPIC, zone=cfg.MQTT_ZONE_TOPIC,
                          output=cfg.MQTT_OUTPUT_TOPIC, repeater=cfg.MQTT_REPEATER_TOPIC,

@jpbarraca
Copy link
Collaborator

Can you do a Pull Request? That way your contribution will be explicitly identified.

@cdk222
Copy link

cdk222 commented Feb 5, 2019

Hi Jakezp

Are you are to help with the Home assistant config you used to get this working (.yaml)? I had Tertiush working but cant seem to get this one going. thx

jpbarraca added a commit that referenced this issue Feb 5, 2019
@jpbarraca
Copy link
Collaborator

I added the patch suggested by @jakezp
The states will be present at paradox/states/partition/PARTITION_NAME/current_hass
You can control the partition using the standard path: paradox/control/partition/PARTITION_NAME

@yozik04
Copy link
Collaborator

yozik04 commented Feb 22, 2019

@jakezp Closing as two weeks has passed. Reopen if required.

@yozik04 yozik04 closed this as completed Feb 22, 2019
@jakezp
Copy link
Contributor Author

jakezp commented Feb 22, 2019

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request testing required Should be fixed, needs validation
Projects
None yet
Development

No branches or pull requests

4 participants