egguy / grott-home-assistant-add-on

Grott Home Assistant add-on - Native MQTT plugin
33 stars 11 forks source link

incorrect unit of measurement on working_time #10

Closed Maes152 closed 1 year ago

Maes152 commented 1 year ago

The following code needs to be changed in the below file old: "totworktime": { "name": "Working time", "device_class": "duration", "unit_of_measurement": "hours", "value_template": "{{ value_json.totworktime| float / 7200 | round(2) }}",

new: "totworktime": { "name": "Working time", "device_class": "duration", "unit_of_measurement": "h", "value_template": "{{ value_json.totworktime| float / 7200 | round(2) }}",

file: https://raw.githubusercontent.com/egguy/grott/feature/ha-extension/examples/Home%20Assistent/grott_ha.py

Logger: homeassistant.components.sensor Source: components/sensor/init.py:677 Integration: Sensor (documentation, issues) First occurred: 12:07:42 (1 occurrences) Last logged: 12:07:42

Entity sensor.xxxx_working_time (<class 'homeassistant.components.mqtt.sensor.MqttSensor'>) is using native unit of measurement 'hours' which is not a valid unit for the device class ('duration') it is using; expected one of ['s', 'd', 'h', 'min']; 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

egguy commented 1 year ago

Thx for the report. A new version of the add-on has been released.

I should find a way to make it appear as a new release in HA add-ons.

egguy commented 1 year ago

Forgot to report, but the new version is published. Does it appear like a new container is available?

egguy commented 1 year ago

Ok did a deep dive in HA code, you need to have a constantly updated config.json version key to allow it to be detected. Will try to see how I could implement this.