Skip to content

Commit

Permalink
Making always instant an option
Browse files Browse the repository at this point in the history
  • Loading branch information
roopesh committed Apr 18, 2021
1 parent 6e14d06 commit 3e006fe
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 0 deletions.
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ Arguments in apps.yaml:
# qolsys_disarm_code: (Required - if you want to disarm the alarm)
# qolsys_confirm_disarm_code: True/False (Optional) Require the code for disarming; defaults to False
# qolsys_confirm_arm_code: True/False (Optional) Require the code for arming; defaults to False
# qolsys_arm_away_always_instant: True/False (Optional) Set to true if all Arm Away commands should be instant; defaults to False
```

You’ll need you appdaemon's apps.yaml to include an app with this module and class:
Expand All @@ -46,6 +47,7 @@ qolsys_panel:
qolsys_disarm_code: 4567 # Optional - Required if you want to disarm the panel
qolsys_confirm_arm_code: False
qolsys_confirm_disarm_code: False
qolsys_arm_away_always_instant: False
```
As far MQTT is concerned, I had to figure out how to enable MQTT inside AppDaemon. In case you’re new to AppDaemon and have the same questions, I had to put this in my appdaemon.yaml:
Expand Down
2 changes: 2 additions & 0 deletions apps/ad-qolsys/qolsys_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ def initialize(self):
self.__c_qolsys_disarm_code__ = "qolsys_disarm_code"
self.__c_qolsys_confirm_disarm_code__ = "qolsys_confirm_disarm_code"
self.__c_qolsys_confirm_arm_code__ = "qolsys_confirm_arm_code"
self.__c_qolsys_arm_away_always_instant__ = "qolsys_arm_away_always_instant"

# populate some variables we'll need to use throughout our app
self.mqtt_namespace = self.args[self.__c_mqtt_namespace__] if self.__c_mqtt_namespace__ in self.args else ""
Expand All @@ -67,6 +68,7 @@ def initialize(self):
self.qolsys_disarm_code = self.args[self.__c_qolsys_disarm_code__] if self.__c_qolsys_disarm_code__ in self.args else 9999
self.qolsys_confirm_disarm_code = self.args[self.__c_qolsys_confirm_disarm_code__] if self.__c_qolsys_confirm_disarm_code__ in self.args else False
self.qolsys_confirm_arm_code = self.args[self.__c_qolsys_confirm_arm_code__] if self.__c_qolsys_confirm_arm_code__ in self.args else False
self.qolsys_arm_away_always_instant = self.args[self.__c_qolsys_arm_away_always_instant__] if self.__c_qolsys_arm_away_always_instant__ in self.args else False
self.mqtt_plugin_config = self.get_plugin_config(namespace=self.mqtt_namespace)

self.log("qolsys_host: %s, qolsys_port: %s, qolsys_token: %s, qolsys_timeout: %s, request_topic: %s", self.qolsys_host, self.qolsys_port, self.qolsys_token, self.qolsys_timeout, self.request_topic, level="DEBUG")
Expand Down
3 changes: 3 additions & 0 deletions apps/ad-qolsys/qolsys_requests.py
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,10 @@ def mqtt_request_received(self, event_name, data, kwargs):
usercode = payload_json["usercode"] if "usercode" in payload_json else None
partition_id = payload_json["partition_id"] if "partition_id" in payload_json else None
arm_type = payload_json["arm_type"] if "arm_type" in payload_json else None

instant = payload_json["instant"] if "instant" in payload_json else False
if self.app.qolsys_arm_away_always_instant: instant = True

self.app.log("event: %s, usercode: %s, partition_id: %s, arm_type: %s, instant: %s", event_type, usercode, partition_id, arm_type, instant, level="INFO")
if token == None:
#raise("Token required for anything you want to do")
Expand Down

0 comments on commit 3e006fe

Please sign in to comment.