Skip to content

Commit

Permalink
fix handling of sensor value.
Browse files Browse the repository at this point in the history
Value is not a boolean, and can also be zero, checking explicitly for
none is the correct way to do it.
  • Loading branch information
muniter authored and devbis committed Jul 28, 2021
1 parent cbe363d commit 0e539c4
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions lumimqtt/lumimqtt.py
Original file line number Diff line number Diff line change
Expand Up @@ -320,8 +320,9 @@ async def _periodic_publish(self, period=1):

await aio.sleep(period)

async def _publish_sensor(self, sensor: Sensor, value=False):
value = value or sensor.get_value()
async def _publish_sensor(self, sensor: Sensor, value=None):
if value is None:
value = sensor.get_value()
await self._client.publish(
aio_mqtt.PublishableMessage(
topic_name=self._get_topic(sensor.topic),
Expand Down

0 comments on commit 0e539c4

Please sign in to comment.