UtilitechAS / amsreader-firmware

ESP8266 and ESP32 compatible firmware to read, interpret and publish data to MQTT from smart electrical meters, both DLMS and DSMR is supported
Other
390 stars 73 forks source link

Correction to Homeassistant MQTT Discovery for Temp unit #841

Open michaelsidenius opened 2 months ago

michaelsidenius commented 2 months ago

Describe the bug Homeassistant is giving a warning:

WARNING (MainThread) [homeassistant.components.sensor] Entity sensor.ams_d015_temp (<class 'homeassistant.components.mqtt.sensor.MqttSensor'>) is using native unit of measurement 'C' which is not a valid unit for the device class ('temperature') it is using; expected one of ['°C', '°F', 'K']; Please update your configuration if your entity is manually configured, otherwise create a bug report at https://github.com/home-assistant/core/issues?q=is%3Aopen+is%3Aissue+label%3A%22integration%3A+mqtt%22

To Reproduce Setup AMS reader to use a MQTT server with Homeassistant payload

Expected behavior No Homeassistant warnings

Screenshots

Hardware information:

Relevant firmware information:

Additional context

ArnieO commented 2 months ago

Thank you for notifying us on that warning. So HA wants the °-sign in addition to C. OK - we'll put it on the list for a future update.

gskjold commented 3 weeks ago

Unable to reproduce, no warning here. Also, the sensor config sent to HA contains the degree symbol:

{"name":"Temperature sensor ","stat_t":"amstest/state","uniq_id":"SmartMeter_AMS_temp","obj_id":"SmartMeter_AMS_temp","unit_of_meas":"°C","val_tpl":"{{ value_json.temp | is_defined }}","expire_after":900,"dev":{"ids":["SmartMeter_AMS"],"name":"AMS reader","mdl":"S2 mini","sw":"af6ecc5","mf":"Wemos","cu":"http://SmartMeter_AMS.local/"},"dev_cla":"temperature","stat_cla":"measurement"}

It is a long time ago since we fixed this (https://github.com/UtilitechAS/amsreader-firmware/releases/tag/v2.2.11), could it be that you have been using amsreader since before this version?