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:
parent
ac788a7ee7
commit
6d280084fb
1 changed files with 10 additions and 1 deletions
|
@ -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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue