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
This commit is contained in:
gibman 2019-06-04 22:17:43 +02:00 committed by Paulus Schoutsen
parent ac788a7ee7
commit 6d280084fb

View file

@ -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