Ensure we send data to influx as float and not as a string value.
parent
9e83a80215
commit
e9b2cf1600
|
@ -7,7 +7,6 @@ For more details about this component, please refer to the documentation at
|
||||||
https://home-assistant.io/components/influxdb/
|
https://home-assistant.io/components/influxdb/
|
||||||
"""
|
"""
|
||||||
import logging
|
import logging
|
||||||
|
|
||||||
import homeassistant.util as util
|
import homeassistant.util as util
|
||||||
from homeassistant.helpers import validate_config
|
from homeassistant.helpers import validate_config
|
||||||
from homeassistant.const import (EVENT_STATE_CHANGED, STATE_ON, STATE_OFF,
|
from homeassistant.const import (EVENT_STATE_CHANGED, STATE_ON, STATE_OFF,
|
||||||
|
@ -77,6 +76,10 @@ def setup(hass, config):
|
||||||
_state = 0
|
_state = 0
|
||||||
else:
|
else:
|
||||||
_state = state.state
|
_state = state.state
|
||||||
|
try:
|
||||||
|
_state = float(_state)
|
||||||
|
except ValueError:
|
||||||
|
pass
|
||||||
|
|
||||||
measurement = state.attributes.get('unit_of_measurement', state.domain)
|
measurement = state.attributes.get('unit_of_measurement', state.domain)
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue