Improve Tahoma Velux support (#27920)

* Improved Velux support. Added Velux Solar Roller Blind. Fixed Velux Integra Window.

* fix indentation

* black formatting

* added new devices in correct sorted order
This commit is contained in:
butako 2019-12-07 15:14:09 +00:00 committed by Martin Hjelmare
parent ee657f3c2f
commit d838a56c1d
2 changed files with 12 additions and 3 deletions

View file

@ -46,6 +46,7 @@ TAHOMA_TYPES = {
"io:SomfyBasicContactIOSystemSensor": "sensor",
"io:SomfyContactIOSystemSensor": "sensor",
"io:VerticalExteriorAwningIOComponent": "cover",
"io:VerticalInteriorBlindVeluxIOComponent": "cover",
"io:WindowOpenerVeluxIOComponent": "cover",
"io:GarageOpenerIOComponent": "cover",
"io:DiscreteGarageOpenerIOComponent": "cover",

14
homeassistant/components/tahoma/cover.py Normal file → Executable file
View file

@ -35,6 +35,7 @@ TAHOMA_DEVICE_CLASSES = {
"io:RollerShutterVeluxIOComponent": DEVICE_CLASS_SHUTTER,
"io:RollerShutterWithLowSpeedManagementIOComponent": DEVICE_CLASS_SHUTTER,
"io:VerticalExteriorAwningIOComponent": DEVICE_CLASS_AWNING,
"io:VerticalInteriorBlindVeluxIOComponent": DEVICE_CLASS_BLIND,
"io:WindowOpenerVeluxIOComponent": DEVICE_CLASS_WINDOW,
"io:GarageOpenerIOComponent": DEVICE_CLASS_GARAGE,
"io:DiscreteGarageOpenerIOComponent": DEVICE_CLASS_GARAGE,
@ -163,10 +164,15 @@ class TahomaCover(TahomaDevice, CoverDevice):
def set_cover_position(self, **kwargs):
"""Move the cover to a specific position."""
if self.tahoma_device.type == HORIZONTAL_AWNING:
self.apply_action("setPosition", kwargs.get(ATTR_POSITION, 0))
if self.tahoma_device.type == "io:WindowOpenerVeluxIOComponent":
command = "setClosure"
else:
self.apply_action("setPosition", 100 - kwargs.get(ATTR_POSITION, 0))
command = "setPosition"
if self.tahoma_device.type == HORIZONTAL_AWNING:
self.apply_action(command, kwargs.get(ATTR_POSITION, 0))
else:
self.apply_action(command, 100 - kwargs.get(ATTR_POSITION, 0))
@property
def is_closed(self):
@ -235,6 +241,8 @@ class TahomaCover(TahomaDevice, CoverDevice):
HORIZONTAL_AWNING,
"io:RollerShutterGenericIOComponent",
"io:VerticalExteriorAwningIOComponent",
"io:VerticalInteriorBlindVeluxIOComponent",
"io:WindowOpenerVeluxIOComponent",
):
self.apply_action("stop")
else: