mirror of
https://github.com/home-assistant/core.git
synced 2025-07-23 13:17:32 +00:00
Influxdb sensor state set to unknown if query return no points (#4148)
* Influxdb sensor state set to unknown if query return no points * Update influxdb.py
This commit is contained in:
parent
f3595f790a
commit
df68de8032
@ -172,9 +172,11 @@ class InfluxSensorData(object):
|
||||
|
||||
points = list(self.influx.query(self.query).get_points())
|
||||
if len(points) == 0:
|
||||
_LOGGER.error('Query returned no points : %s', self.query)
|
||||
return
|
||||
if len(points) > 1:
|
||||
_LOGGER.warning('Query returned multiple points, only first one'
|
||||
' shown : %s', self.query)
|
||||
self.value = points[0].get('value')
|
||||
_LOGGER.warning('Query returned no points, sensor state set'
|
||||
' to UNKNOWN : %s', self.query)
|
||||
self.value = None
|
||||
else:
|
||||
if len(points) > 1:
|
||||
_LOGGER.warning('Query returned multiple points, only first'
|
||||
' one shown : %s', self.query)
|
||||
self.value = points[0].get('value')
|
||||
|
Loading…
x
Reference in New Issue
Block a user