Skip to content

Commit

Permalink
Merge pull request #15 from sup3rm3ga/app-lockup-fixes
Browse files Browse the repository at this point in the history
Fixed __repr__ functions to return strings.  Thanks @sup3rm3ga !
  • Loading branch information
roopesh authored Jun 7, 2021
2 parents e5023eb + ff64c7e commit 6e4eb8a
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 23 deletions.
26 changes: 13 additions & 13 deletions apps/ad-qolsys/door_window.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,17 +86,17 @@ def __str__(self):
return me

def __repr__(self):
me = {
"zoneid": self.zoneid,
"entity_id": self.entity_id,
"friendly_name": self.friendly_name,
"state": self.state,
"partition_id": self.partition_id,
"device_class": self.device_class,
"payload_on": self.payload_on,
"payload_off": self.payload_off,
"config_topic": self.config_topic,
"state_topic": self.state_topic,
"availability": self.availability_list
}
me = f'{{' \
f'"zoneid": self.zoneid,' \
f'"entity_id": self.entity_id,' \
f'"friendly_name": self.friendly_name,' \
f'"state": self.state,' \
f'"partition_id": self.partition_id,' \
f'"device_class": self.device_class,' \
f'"payload_on": self.payload_on,' \
f'"payload_off": self.payload_off,' \
f'"config_topic": self.config_topic,' \
f'"state_topic": self.state_topic,' \
f'"availability": self.availability_list' \
f'}}'
return me
20 changes: 10 additions & 10 deletions apps/ad-qolsys/partition.py
Original file line number Diff line number Diff line change
Expand Up @@ -143,14 +143,14 @@ def __str__(self):
return me

def __repr__(self):
me = {
"id": self.p_id,
"name": self.name,
"status": self.status,
"entity_id": self.entity_id,
"alarm_panel_config_topic": self.alarm_panel_config_topic,
"alarm_panel_state_topic": self.alarm_panel_state_topic,
"code": self.code,
"zones": self.zones
}
me = f'{{' \
f'"id": self.p_id,' \
f'"name": self.name,' \
f'"status": self.status,' \
f'"entity_id": self.entity_id,' \
f'"alarm_panel_config_topic": self.alarm_panel_config_topic,' \
f'"alarm_panel_state_topic": self.alarm_panel_state_topic,' \
f'"code": self.code,' \
f'"zones": self.zones' \
f'}}'
return me

0 comments on commit 6e4eb8a

Please sign in to comment.