Skip to content

Commit

Permalink
Fix MQTT QoS flag, fix converting value warning for AC_flag
Browse files Browse the repository at this point in the history
  • Loading branch information
subs1stem committed Aug 14, 2024
1 parent fbeea45 commit c82843b
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion source/functions.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ def transform_item(item, key=''):
value = float(value) * 1000
return value
elif key == 'AC_flag':
return not value
return 0 if value == 1 else 1
elif key == 'Uptime':
return get_uptime(value)
return value
Expand Down
10 changes: 5 additions & 5 deletions source/mqtt_publisher.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,11 @@ def publish_control(
retain=True,
) -> None:
msgs = [
('{}/controls/{}'.format(self.root_topic, name), data, 1, retain),
('{}/controls/{}/meta/type'.format(self.root_topic, name), data_type, 1, retain),
('{}/controls/{}/meta/units'.format(self.root_topic, name), units, 1, retain),
('{}/controls/{}/meta/order'.format(self.root_topic, name), order, 1, retain),
('{}/controls/{}/meta/error'.format(self.root_topic, name), error, 1, retain),
('{}/controls/{}'.format(self.root_topic, name), data, 0, retain),
('{}/controls/{}/meta/type'.format(self.root_topic, name), data_type, 0, retain),
('{}/controls/{}/meta/units'.format(self.root_topic, name), units, 0, retain),
('{}/controls/{}/meta/order'.format(self.root_topic, name), order, 0, retain),
('{}/controls/{}/meta/error'.format(self.root_topic, name), error, 0, retain),
]
self.publish_multiple(msgs)

Expand Down

0 comments on commit c82843b

Please sign in to comment.