Skip to content

Commit

Permalink
Correct MQTT for binary functions
Browse files Browse the repository at this point in the history
  • Loading branch information
dianlight committed Jan 10, 2024
1 parent dd29661 commit d1d793a
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion sambanas/rootfs/usr/local/bin/mqtt_daemon.py
Original file line number Diff line number Diff line change
Expand Up @@ -376,7 +376,10 @@ async def publish_device_states():
if isinstance(sensor[1],ConfigEntityFromDevice):
logging.info("Updating Device sensor %s",sensor[0])
sensor[1].device.update()
sensor[1].sensor.set_state(sensor[1].state_function(sensor[1]))
if isinstance(sensor[1].sensor,BinarySensor):
sensor[1].sensor._update_state(sensor[1].state_function(sensor[1]))
elif isinstance(sensor[1].sensor,Sensor):
sensor[1].sensor.set_state(sensor[1].state_function(sensor[1]))
if sensor[1].attributes_function != None: sensor[1].sensor.set_attributes(sensor[1].attributes_function(sensor[1]))
await asyncio.sleep(5)

Expand Down

0 comments on commit d1d793a

Please sign in to comment.