Skip to content

Commit

Permalink
Merge pull request #4 from roopesh/More-sensors
Browse files Browse the repository at this point in the history
zone type mapping
  • Loading branch information
roopesh authored Apr 8, 2021
2 parents dbbc3ea + 55a2f0c commit 16e26fb
Showing 1 changed file with 14 additions and 2 deletions.
16 changes: 14 additions & 2 deletions apps/ad-qolsys/qolsys_requests.py
Original file line number Diff line number Diff line change
Expand Up @@ -92,13 +92,13 @@ def mqtt_info_event_received(self, event_name, data, kwargs):
# Add this zone to this partition
this_partition.add_zone(zoneid)

if zone_type == "Door_Window":
if zone_type:
this_zone = door_window.door_window(
zoneid = zoneid,
name = friendly_name,
state = state,
partition_id = partition_id,
device_class = "door"
device_class = self.__device_class_mapping__(zone_type)
)
#self.app.zones[zoneid] = this_zone

Expand All @@ -114,6 +114,18 @@ def mqtt_info_event_received(self, event_name, data, kwargs):
# for zone in self.app.zones:
# self.app.log("zone: %s", zone, level="DEBUG")

def __device_class_mapping__(self, device_class):
mapping = {
"Door_Window": "door",
"SmokeDetector": "smoke",
"GlassBreak": "safety",
"Motion": "motion",
"Water":"moisture"
}
if device_class in mapping:
return mapping[device_class]
else:
return ""
def __get_mqtt_payload_json__(self, data):
self.app.log("data: %s", data, level="DEBUG")
payload_json = {}
Expand Down

0 comments on commit 16e26fb

Please sign in to comment.