Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
from datetime import timedelta
from homeassistant.helpers.event import track_time_interval

from homeassistant.const import TEMP_CELSIUS
from homeassistant.const import UnitOfTemperature

from . import (DOHOME_GATEWAY, DoHomeDevice)

Expand Down Expand Up @@ -84,7 +84,7 @@ def state(self):
def unit_of_measurement(self):
"""Return the unit of measurement of this entity, if any."""
if self._is_temperature and self.current_value != 100:
return TEMP_CELSIUS
return UnitOfTemperature.CELSIUS
elif self._is_humidity and self.current_value != 0:
return '%'
elif self._is_illumination and self.current_value != -1:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,10 @@ def is_on(self):
"""Return true if plug is on."""
return self._state

@property
def unique_id(self):
return self._device["name"]

def turn_on(self, **kwargs):
"""Turn the switch on."""
self._state = True
Expand Down Expand Up @@ -116,4 +120,4 @@ def _send_cmd(self, device, cmd, rtn_cmd):
return resp
else:
_LOGGER.debug("Non matching response. device %s, but got %s", device["sid"], dic["dev"][8:12])
return None
return None