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
1 changed files with 8 additions and 6 deletions
|
@ -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…
Add table
Reference in a new issue