Core: Prometheus generates "could not convert" error messages for lights

Created on 23 Dec 2019  路  10Comments  路  Source: home-assistant/core

Home Assistant release with the issue:
0.103.4

Last working Home Assistant release (if known):
none

Operating environment (Hass.io/Docker/Windows/etc.):
docker

Integration:
light / prometheus

Description of problem:
The prometheus export should just ignore this sensor or value. It could also just store the state as -1 or something...

Problem-relevant configuration.yaml entries and (fill out even if it seems unimportant):

prometheus:
  namespace: hass
hue:

Logs (if applicable):

Could not convert <state light.licht_badezimmer=unavailable; friendly_name=Licht Badezimmer, supported_features=0 @ 2019-12-23T21:00:45.793845+01:00> to float

Additional information:
This bug is similar https://github.com/home-assistant/home-assistant/issues/29015

prometheus

Most helpful comment

What is the reason that we are not returning null/nothing if a device is not available? Current behavior with logging an error message and returning 0 seems strange. How would I currently identify in Prometheus that a sensor is not available and trigger an alert afterwards?

All 10 comments

The prometheus export should just ignore this sensor

You could exclude this sensor by specifying it in your configuration. See here for more details.

The problem is that once a sensor is unavailable you get this message. In order to solve this I would have to exclude everything....

Okay I completely understand, I will look into it.

Maybe it make sense to use the up metric in order to show if a sensor is available or not...

What do you mean by _up metric_ exactly?

Furthermore, I am pretty sure this is intended behaviour since unavailable does not mean the same as on or off which are represented as 1 and 0 in prometheus. unavailable is a the correct status when HA cannot reach or connect to a particular device and therefore cannot access and convert its state correctly.

What is the reason that we are not returning null/nothing if a device is not available? Current behavior with logging an error message and returning 0 seems strange. How would I currently identify in Prometheus that a sensor is not available and trigger an alert afterwards?

I would like to ping this again.
This problem bothers me too. Every time a sensor becomes unavailable, prometheus logs a "0". That is not good behaviour and makes the stored values horrible to work with.

Note #32112 that is trying to improve the way unavailable entities are handled by the prometheus component.

I believe #37456 fixed this, and this issue can be resolved.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

MartinHjelmare picture MartinHjelmare  路  3Comments

moskovskiy82 picture moskovskiy82  路  3Comments

Elmardus picture Elmardus  路  3Comments

flsabourin picture flsabourin  路  3Comments

kirichkov picture kirichkov  路  3Comments