1
0
mirror of https://github.com/home-assistant/core.git synced 2025-12-24 21:06:19 +00:00

Add support for DHT and DS18B20 sensors via Konnected firmware (#21189)

* mvp basic temperature sensor support

* support for DHT temperature & humidity

* add support for ds18b20 sensors

* improve resolution of device settings

* update requirements_all.txt

* re-organize new file

* don't use filter(lambda: syntax

* set unique_id on entities to allow renaming in the UI

* leverage base Entity module to do C to F conversion

* add option for setting poll_interval

* use handler pattern to handle updates from Konnected device

* cleanups from code review
This commit is contained in:
Nate Clark
2019-03-04 10:56:41 -05:00
committed by Martin Hjelmare
parent 158e25562b
commit f62eb22ef8
7 changed files with 358 additions and 108 deletions

View File

@@ -6,7 +6,7 @@ from homeassistant.components.konnected import (
CONF_PAUSE, CONF_REPEAT, STATE_LOW, STATE_HIGH)
from homeassistant.helpers.entity import ToggleEntity
from homeassistant.const import (
CONF_DEVICES, CONF_SWITCHES, CONF_PIN, ATTR_STATE)
ATTR_STATE, CONF_DEVICES, CONF_NAME, CONF_PIN, CONF_SWITCHES)
_LOGGER = logging.getLogger(__name__)
@@ -40,10 +40,13 @@ class KonnectedSwitch(ToggleEntity):
self._pause = self._data.get(CONF_PAUSE)
self._repeat = self._data.get(CONF_REPEAT)
self._state = self._boolean_state(self._data.get(ATTR_STATE))
self._name = self._data.get(
'name', 'Konnected {} Actuator {}'.format(
device_id, PIN_TO_ZONE[pin_num]))
_LOGGER.debug("Created new switch: %s", self._name)
self._unique_id = '{}-{}'.format(device_id, PIN_TO_ZONE[pin_num])
self._name = self._data.get(CONF_NAME)
@property
def unique_id(self) -> str:
"""Return the unique id."""
return self._unique_id
@property
def name(self):