Just tried updating to 0.91.0, and now im seeing this in my logs:
2019-04-04 21:32:14 WARNING (SyncWorker_32) [homeassistant.components.prometheus] Could not convert <state sensor.ha_last_reboot=14 days, 02:05; friendly_name=HA Last Reboot @ 2019-04-04T21:32:14.041296-07:00> to float
head: cannot open '/home/homeassistant/.homeassistant/home-assistant.log' for reading: No such file or directory
2019-04-04 21:32:14 WARNING (SyncWorker_30) [homeassistant.components.prometheus] Could not convert <state sensor.ha_uptime=21:32; friendly_name=HA Uptime @ 2019-04-04T21:32:14.086864-07:00> to float
2019-04-04 21:32:20 ERROR (MainThread) [homeassistant.core] Error doing job: Task exception was never retrieved
This looks like a regression of https://github.com/home-assistant/home-assistant/issues/8659
running 0.91.0 in kubernetes. 0.90.1 did not have this issue,
This is probably going to be due to #22282 which was the fix I did for #8659... _sigh_
@tcastberg Mind chiming in on this?
It looks like it's behaving as expected. If this used to work it's a regression in _state_helper.state_as_number(state)_ or a change in sensor.ha_last_reboot.
I think this might be the error I'm seeing as well. I'm getting a flood of these pretty similar errors:
Could not convert <state sensor.energy_server_exporting=False; node_id=2, value_index=32, value_instance=1, value_id=72057594076496384, power_consumption=37.358, unit_of_measurement=, friendly_name=energy_server Exporting @ 2019-04-07T00:44:21.821844-04:00> to float
Could not convert <state sensor.flood_detector_kitchen_sink_battery=; friendly_name=Kitchen Sink Flood Detector, icon=mdi:battery, unit_of_measurement=% @ 2019-04-07T00:33:44.987962-04:00> to float
etc. etc.
Looks like _state_helper.state_as_number(state)_ could use some improvement.
Both errors shown by @raccettura are correct as neither state is castable to float.
I'm seeing the same also in 0.91.2
2019-04-10 12:02:51 WARNING (SyncWorker_18) [homeassistant.components.prometheus] Could not convert <state device_tracker.tile_<id>=Work; source_type=gps, latitude=12.3456, longitude=12.3456, gps_accuracy=0, altitude=120.72200775146484, connection_state=DISCONNECTED, is_dead=False, is_lost=False, ring_state=STOPPED, voip_state=OFFLINE, tile_identifier=<id>, tile_name=Truck Key, friendly_name=tile <id>, icon=mdi:key-variant @ 2019-04-10T11:04:23.355728-07:00> to float
Note I changed latitude and longitude to mask my device's actual location, and removed the tile identifier number.
I'm also getting a whole bunch of those errors, and it looks like they are somewhat logical.
BUT, here is my config (btw was not easy to guess, since official docs are broken/lying) :
prometheus:
namespace: hass
include:
entities:
- sensor.home_temperature
and i get errors for a lot of other entities ?
i guess they shouldn't even be casted, right ?
I do not get how the filtering is supposed to work, as i can't see any lines like those from the recorder component : https://github.com/home-assistant/home-assistant/blob/30d4a9f12c31924ab0995086b052ff7f19447a03/homeassistant/components/recorder/__init__.py#L150-L152
I'm also getting a whole bunch of those errors, and it looks like they are somewhat logical.
BUT, here is my config (btw was not easy to guess, since official docs are broken/lying) :
prometheus: namespace: hass include: entities: - sensor.home_temperatureand i get errors for a lot of other entities ?
i guess they shouldn't even be casted, right ?I do not get how the filtering is supposed to work, as i can't see any lines like those from the recorder component :
I've struggled with this as well the official docs could defiantly use some more examples around filters. I've tried excluding a few devices and it does not seem to work correctly. I'm not convinced the component actually pays any attention to filters. Although that's a different problem, and my need it's own issue to track.
You are right, if the filters doesn't work at all it should be a separate issue.
I've posted here in case the issue was more about the entities being casted even though they are filtered.
Since i've never saw the component working i'm not sure what was the issue between the two.
can someone confirm that filters are/were working ?
EDIT : i think i've found the way to fix the filter thing, it just seems to be completely missing. I'll do the PR as soon as i got some free time.
EDIT 2 : Finally got how filters are supposed to work (they actually are) and made a PR to fix docs 馃憤
https://github.com/home-assistant/home-assistant.io/pull/9226
Here you can see updated docs before it is actually merged :
https://deploy-preview-9226--home-assistant-docs.netlify.com/components/prometheus/
There hasn't been any activity on this issue recently. Due to the high number of incoming GitHub notifications, we have to clean some of the old issues, as many of them have already been resolved with the latest updates.
Please make sure to update to the latest Home Assistant version and check if that solves the issue. Let us know if that works for you by adding a comment 馃憤
This issue now has been marked as stale and will be closed if no further activity occurs. Thank you for your contributions.
I still see this issue on 0.96.2:
Log Details (WARNING)
Sat Jul 20 2019 15:16:06 GMT+0200 (CEST)
Could not convert <state sensor.fully_kiosk_rest=True; batteryLevel=100, kioskMode=True, screenBrightness=85, motionDetectorState=0, maintenanceMode=False, appFreeMemory=190622456, appUsedMemory=10704136, totalFreeMemory=606404608, totalUsedMemory=1353768960, hostname4=192.168.1.10, ip4=192.168.1.10, mac=2C:FD:AB:7E:33:C3, locationLatitude=51.0086667, locationLongitude=5.8370323, locationAltitude=0.0, startUrl=http://192.168.1.20:8123/lovelace/beneden, currentPage=http://192.168.1.20:8123/lovelace/beneden, friendly_name=Fully Kiosk Rest @ 2019-07-20T15:13:32.736526+02:00> to float
with the following filters:
prometheus:
include:
domains:
- sensor
- binary_sensor
- group
- device_tracker
- input_boolean
exclude:
entities:
- sensor.fully_kiosk_rest
- sensor.time
- sensor.face_match
- sensor.fibaro_dimmer_eetkamer_exporting
- sensor.low_battery
- sensor.snapshot_backup
- binary_sensor.snapshots_stale
- sensor.garage_status
- sensor.gang_status
- sensor.oprit_status
- sensor.eetkamer_status
- sensor.terras_status
- sensor.run_state
Got the warning messages supressed in 0.97.0 using the following config
prometheus:
namespace: hass
filter:
exclude_entities:
- sensor.cure_gft
- sensor.cure_papier
- sensor.cure_restafval
- sensor.cure_vandaag
- sensor.cure_morgen
I haven't managed to get this suppressed or working on 0.98.0b1. It appears to be failing on temperature sensors based upon the log lines:
Traceback (most recent call last):
File "/usr/local/lib/python3.7/concurrent/futures/thread.py", line 57, in run
result = self.fn(*self.args, **self.kwargs)
File "/usr/src/homeassistant/homeassistant/components/prometheus/__init__.py", line 146, in handle_event
getattr(self, handler)(state)
File "/usr/src/homeassistant/homeassistant/components/prometheus/__init__.py", line 297, in _handle_sensor
metric, self.prometheus_client.Gauge, f"Sensor data measured in {unit}"
File "/usr/src/homeassistant/homeassistant/components/prometheus/__init__.py", line 163, in _metric
self._metrics[metric] = factory(full_metric_name, documentation, labels)
File "/usr/local/lib/python3.7/site-packages/prometheus_client/metrics.py", line 324, in __init__
labelvalues=labelvalues,
File "/usr/local/lib/python3.7/site-packages/prometheus_client/metrics.py", line 94, in __init__
raise ValueError('Invalid metric name: ' + self._name)
ValueError: Invalid metric name: hass_sensor_unit_uv index
2019-08-24 16:34:42 ERROR (MainThread) [homeassistant.core] Error doing job: Future exception was never retrieved
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/components/prometheus/__init__.py", line 160, in _metric
return self._metrics[metric]
KeyError: 'sensor_unit_掳'
As well as other metrics, like UV:
Traceback (most recent call last):
File "/usr/local/lib/python3.7/concurrent/futures/thread.py", line 57, in run
result = self.fn(*self.args, **self.kwargs)
File "/usr/src/homeassistant/homeassistant/components/prometheus/__init__.py", line 146, in handle_event
getattr(self, handler)(state)
File "/usr/src/homeassistant/homeassistant/components/prometheus/__init__.py", line 297, in _handle_sensor
metric, self.prometheus_client.Gauge, f"Sensor data measured in {unit}"
File "/usr/src/homeassistant/homeassistant/components/prometheus/__init__.py", line 163, in _metric
self._metrics[metric] = factory(full_metric_name, documentation, labels)
File "/usr/local/lib/python3.7/site-packages/prometheus_client/metrics.py", line 324, in __init__
labelvalues=labelvalues,
File "/usr/local/lib/python3.7/site-packages/prometheus_client/metrics.py", line 94, in __init__
raise ValueError('Invalid metric name: ' + self._name)
ValueError: Invalid metric name: hass_sensor_unit_uv index
2019-08-24 16:34:42 ERROR (MainThread) [homeassistant.core] Error doing job: Future exception was never retrieved
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/components/prometheus/__init__.py", line 160, in _metric
return self._metrics[metric]
KeyError: 'sensor_unit_uv index'
Beyond that, it also has the general "convert to float" problems.
There hasn't been any activity on this issue recently. Due to the high number of incoming GitHub notifications, we have to clean some of the old issues, as many of them have already been resolved with the latest updates.
Please make sure to update to the latest Home Assistant version and check if that solves the issue. Let us know if that works for you by adding a comment 馃憤
This issue now has been marked as stale and will be closed if no further activity occurs. Thank you for your contributions.
Most helpful comment
You are right, if the filters doesn't work at all it should be a separate issue.
I've posted here in case the issue was more about the entities being casted even though they are filtered.
Since i've never saw the component working i'm not sure what was the issue between the two.
can someone confirm that filters are/were working ?
EDIT : i think i've found the way to fix the filter thing, it just seems to be completely missing. I'll do the PR as soon as i got some free time.
EDIT 2 : Finally got how filters are supposed to work (they actually are) and made a PR to fix docs 馃憤
https://github.com/home-assistant/home-assistant.io/pull/9226
Here you can see updated docs before it is actually merged :
https://deploy-preview-9226--home-assistant-docs.netlify.com/components/prometheus/