Add Velux Windows to Tahoma (#11538)
* Add Velux Windows to Tahoma * fix linit * add supported Tahoma devices by @glpatcern * hound * lint * fix logging * lint * lint * remove blank line after docstring * changes based on notes by @armills * fix logging
This commit is contained in:
parent
0d06e8c1c9
commit
02979db3d6
2 changed files with 19 additions and 6 deletions
|
@ -36,6 +36,14 @@ TAHOMA_COMPONENTS = [
|
|||
'sensor', 'cover'
|
||||
]
|
||||
|
||||
TAHOMA_TYPES = {
|
||||
'rts:RollerShutterRTSComponent': 'cover',
|
||||
'rts:CurtainRTSComponent': 'cover',
|
||||
'io:RollerShutterWithLowSpeedManagementIOComponent': 'cover',
|
||||
'io:WindowOpenerVeluxIOComponent': 'cover',
|
||||
'io:LightIOSystemSensor': 'sensor',
|
||||
}
|
||||
|
||||
|
||||
def setup(hass, config):
|
||||
"""Activate Tahoma component."""
|
||||
|
@ -68,6 +76,8 @@ def setup(hass, config):
|
|||
if all(ext not in _device.type for ext in exclude):
|
||||
device_type = map_tahoma_device(_device)
|
||||
if device_type is None:
|
||||
_LOGGER.warning('Unsupported type %s for Tahoma device %s',
|
||||
_device.type, _device.label)
|
||||
continue
|
||||
hass.data[DOMAIN]['devices'][device_type].append(_device)
|
||||
|
||||
|
@ -78,12 +88,8 @@ def setup(hass, config):
|
|||
|
||||
|
||||
def map_tahoma_device(tahoma_device):
|
||||
"""Map tahoma classes to Home Assistant types."""
|
||||
if tahoma_device.type.lower().find("shutter") != -1:
|
||||
return 'cover'
|
||||
elif tahoma_device.type == 'io:LightIOSystemSensor':
|
||||
return 'sensor'
|
||||
return None
|
||||
"""Map Tahoma device types to Home Assistant components."""
|
||||
return TAHOMA_TYPES.get(tahoma_device.type)
|
||||
|
||||
|
||||
class TahomaDevice(Entity):
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue