From 6d280084fb5f7386a1cf4d176e390d6d669ec2ee Mon Sep 17 00:00:00 2001 From: gibman Date: Tue, 4 Jun 2019 22:17:43 +0200 Subject: [PATCH] Expose specific device_class for Velux covers (#24279) * Update cover.py Blinds, Rollingshutters and Awnings did not set their respective device_class attribute Previously they would all appear as device_class "window" * fallback device class is always 'window' fallback device class is always 'window' in the event we have an unknown cover type * trailing whitespace removed, trimmed as well * Update cover.py --- homeassistant/components/velux/cover.py | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/homeassistant/components/velux/cover.py b/homeassistant/components/velux/cover.py index 3c1b6ecb1eb..68e25f7a61f 100644 --- a/homeassistant/components/velux/cover.py +++ b/homeassistant/components/velux/cover.py @@ -60,7 +60,16 @@ class VeluxCover(CoverDevice): @property def device_class(self): - """Define this cover as a window.""" + """Define this cover as either window/blind/awning/shutter.""" + from pyvlx.opening_device import Blind, RollerShutter, Window, Awning + if isinstance(self.node, Window): + return 'window' + if isinstance(self.node, Blind): + return 'blind' + if isinstance(self.node, RollerShutter): + return 'shutter' + if isinstance(self.node, Awning): + return 'awning' return 'window' @property