From d838a56c1d0b4f04a522fa846f7752a5b58b4004 Mon Sep 17 00:00:00 2001 From: butako <1004460+butako@users.noreply.github.com> Date: Sat, 7 Dec 2019 15:14:09 +0000 Subject: [PATCH] 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 --- homeassistant/components/tahoma/__init__.py | 1 + homeassistant/components/tahoma/cover.py | 14 +++++++++++--- 2 files changed, 12 insertions(+), 3 deletions(-) mode change 100644 => 100755 homeassistant/components/tahoma/cover.py diff --git a/homeassistant/components/tahoma/__init__.py b/homeassistant/components/tahoma/__init__.py index 02cdba5c46a..640cc6418d0 100644 --- a/homeassistant/components/tahoma/__init__.py +++ b/homeassistant/components/tahoma/__init__.py @@ -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", diff --git a/homeassistant/components/tahoma/cover.py b/homeassistant/components/tahoma/cover.py old mode 100644 new mode 100755 index 6c5dcbd807c..e11c2f4cdf5 --- a/homeassistant/components/tahoma/cover.py +++ b/homeassistant/components/tahoma/cover.py @@ -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: