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