Wink AC and addidtional sensor support (#5670)
* Added door bell sensors * Initial support for AC units. * Added new device service * Quirky Aros AC unit support * Use super() everywhere and error checking for token request. * Ignore camera sensors during setup of alarms. * Added manufacturer/device attributes to all wink devices. * Fixed style errors * Fixed remaining lint errors.
This commit is contained in:
1 parent
b5f285a789
commit
80a794e587
11 files changed
+361
-88
No files matched your search
@@ -8,10 +8,10 @@ import logging
|
||||
|
||||
from homeassistant.const import TEMP_CELSIUS
|
||||
from homeassistant.helpers.entity import Entity
|
||||
from homeassistant.components.wink import WinkDevice
|
||||
from homeassistant.loader import get_component
|
||||
from homeassistant.components.wink import WinkDevice, DOMAIN
|
||||
|
||||
DEPENDENCIES = ['wink']
|
||||
_LOGGER = logging.getLogger(__name__)
|
||||
|
||||
SENSOR_TYPES = ['temperature', 'humidity', 'balance', 'proximity']
|
||||
|
||||
@@ -21,18 +21,29 @@ def setup_platform(hass, config, add_devices, discovery_info=None):
|
||||
import pywink
|
||||
|
||||
for sensor in pywink.get_sensors():
|
||||
if sensor.capability() in SENSOR_TYPES:
|
||||
add_devices([WinkSensorDevice(sensor, hass)])
|
||||
_id = sensor.object_id() + sensor.name()
|
||||
if _id not in hass.data[DOMAIN]['unique_ids']:
|
||||
if sensor.capability() in SENSOR_TYPES:
|
||||
add_devices([WinkSensorDevice(sensor, hass)])
|
||||
|
||||
for eggtray in pywink.get_eggtrays():
|
||||
add_devices([WinkSensorDevice(eggtray, hass)])
|
||||
_id = eggtray.object_id() + eggtray.name()
|
||||
if _id not in hass.data[DOMAIN]['unique_ids']:
|
||||
add_devices([WinkSensorDevice(eggtray, hass)])
|
||||
|
||||
for tank in pywink.get_propane_tanks():
|
||||
_id = tank.object_id() + tank.name()
|
||||
if _id not in hass.data[DOMAIN]['unique_ids']:
|
||||
add_devices([WinkSensorDevice(tank, hass)])
|
||||
|
||||
for piggy_bank in pywink.get_piggy_banks():
|
||||
try:
|
||||
if piggy_bank.capability() in SENSOR_TYPES:
|
||||
add_devices([WinkSensorDevice(piggy_bank, hass)])
|
||||
except AttributeError:
|
||||
logging.getLogger(__name__).info("Device is not a sensor")
|
||||
_id = piggy_bank.object_id() + piggy_bank.name()
|
||||
if _id not in hass.data[DOMAIN]['unique_ids']:
|
||||
try:
|
||||
if piggy_bank.capability() in SENSOR_TYPES:
|
||||
add_devices([WinkSensorDevice(piggy_bank, hass)])
|
||||
except AttributeError:
|
||||
_LOGGER.info("Device is not a sensor")
|
||||
|
||||
|
||||
class WinkSensorDevice(WinkDevice, Entity):
|
||||
@@ -41,7 +52,6 @@ class WinkSensorDevice(WinkDevice, Entity):
|
||||
def __init__(self, wink, hass):
|
||||
"""Initialize the Wink device."""
|
||||
super().__init__(wink, hass)
|
||||
wink = get_component('wink')
|
||||
self.capability = self.wink.capability()
|
||||
if self.wink.unit() == '°':
|
||||
self._unit_of_measurement = TEMP_CELSIUS
|
||||
|
||||
Reference in new issue
Block a user