Hi everybody,
I’ve been trying to send some monitoring stats from a remote server using a scheduled python script that sends MQTT payloads to my HA installation.
It partially works, since I can’t get any attribute.
I’m sending this payload, (and I can also see it with a mqtt dump command): {"unit_of_measurement": "%", "value": 26.1}
You have the “value” attribute, so the concept works.
I guess you just cannot override the “unit_of_measurement” (and probably other “reserved” attributes) that way…
Mates you’re right!
I manually set unit_of_measurement in config and now this sensor is working as expected.
I’m reviving this script after about a year without using it and I’m sure it had been working, and now I now why.
I needed to dynamically change the unit_of_measurement for the free disk space sensor: it could have been TB or GB (or MB if I’ll be really in troubles…).
Now I’ve changed the df -h command with a df -BG to always get value in GB and statically set the attribute.
Probably because no other integration allowed for that kind of change so, in the interests of parity, it was eliminated from all MQTT platforms. However, that’s just my interpretation and the best reference would be the developer.