Merge remote-tracking branch 'origin/dev' into dev
# Conflicts: # homeassistant/components/light/zwave.py # homeassistant/components/switch/zwave.py
This commit is contained in:
commit
5b6371ecda
33 files changed
+1306
-245
No files matched your search
@@ -14,6 +14,7 @@ from homeassistant.helpers.event import track_point_in_time
|
||||
import homeassistant.util.dt as dt_util
|
||||
import homeassistant.components.zwave as zwave
|
||||
from homeassistant.helpers.entity import Entity
|
||||
from homeassistant.util import slugify
|
||||
from homeassistant.const import (
|
||||
ATTR_BATTERY_LEVEL, STATE_ON, STATE_OFF,
|
||||
TEMP_CELCIUS, TEMP_FAHRENHEIT, ATTR_LOCATION)
|
||||
@@ -109,6 +110,21 @@ class ZWaveSensor(Entity):
|
||||
|
||||
return "{} {} {}".format(name, self._node.node_id, self._value.label)
|
||||
|
||||
@property
|
||||
def entity_id(self):
|
||||
""" Returns the entity_id of the device if any.
|
||||
The entity_id contains node_id and value instance id
|
||||
to not collide with other entity_ids"""
|
||||
|
||||
entity_id = "sensor.{}_{}".format(slugify(self.name),
|
||||
self._node.node_id)
|
||||
|
||||
# Add the instance id if there is more than one instance for the value
|
||||
if self._value.instance > 1:
|
||||
return "{}_{}".format(entity_id, self._value.instance)
|
||||
|
||||
return entity_id
|
||||
|
||||
@property
|
||||
def state(self):
|
||||
""" Returns the state of the sensor. """
|
||||
|
||||
Reference in new issue
Block a user