let the user supply the sensor name
This commit is contained in:
parent
a764817ee9
commit
956a6418cc
1 changed files with 3 additions and 4 deletions
|
@ -26,6 +26,7 @@ from homeassistant.const import (STATE_UNKNOWN, CONF_ACCESS_TOKEN, CONF_NAME)
|
|||
_LOGGER = logging.getLogger(__name__)
|
||||
|
||||
REQUIREMENTS = ['eliqonline==1.0.11']
|
||||
DEFAULT_NAME = "ELIQ Energy Usage"
|
||||
|
||||
MIN_TIME_BETWEEN_UPDATES = timedelta(seconds=30)
|
||||
|
||||
|
@ -36,7 +37,7 @@ def setup_platform(hass, config, add_devices, discovery_info=None):
|
|||
import eliqonline
|
||||
|
||||
access_token = config.get(CONF_ACCESS_TOKEN)
|
||||
name = config.get(CONF_NAME)
|
||||
name = config.get(CONF_NAME, DEFAULT_NAME)
|
||||
channel_id = config.get("channel_id")
|
||||
|
||||
if not access_token:
|
||||
|
@ -54,9 +55,7 @@ class EliqSensor(Entity):
|
|||
""" Implements a Eliq sensor. """
|
||||
|
||||
def __init__(self, api, channel_id, name):
|
||||
self._name = "Energy Usage"
|
||||
if name:
|
||||
self._name = name + " " + self._name
|
||||
self._name = name
|
||||
self._unit_of_measurement = "W"
|
||||
self._state = STATE_UNKNOWN
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue