Set zwave_js cover device_class for shutters and blinds (#50643)
* Set device_class for shutters and blinds * Add missing. imports * Add tests for device class setting * Clean up * Avoid storing the node in an unused variable * Fix entity name * Extend qubino shutter discovery Co-authored-by: Martin Hjelmare <marhje52@gmail.com>
This commit is contained in:
parent
222336a1db
commit
0556c35e24
5 changed files with 819 additions and 1 deletions
|
@ -9,7 +9,10 @@ from zwave_js_server.model.value import Value as ZwaveValue
|
|||
|
||||
from homeassistant.components.cover import (
|
||||
ATTR_POSITION,
|
||||
DEVICE_CLASS_BLIND,
|
||||
DEVICE_CLASS_GARAGE,
|
||||
DEVICE_CLASS_SHUTTER,
|
||||
DEVICE_CLASS_WINDOW,
|
||||
DOMAIN as COVER_DOMAIN,
|
||||
SUPPORT_CLOSE,
|
||||
SUPPORT_OPEN,
|
||||
|
@ -76,6 +79,15 @@ def percent_to_zwave_position(value: int) -> int:
|
|||
class ZWaveCover(ZWaveBaseEntity, CoverEntity):
|
||||
"""Representation of a Z-Wave Cover device."""
|
||||
|
||||
@property
|
||||
def device_class(self) -> str | None:
|
||||
"""Return the class of this device, from component DEVICE_CLASSES."""
|
||||
if self.info.platform_hint == "window_shutter":
|
||||
return DEVICE_CLASS_SHUTTER
|
||||
if self.info.platform_hint == "window_blind":
|
||||
return DEVICE_CLASS_BLIND
|
||||
return DEVICE_CLASS_WINDOW
|
||||
|
||||
@property
|
||||
def is_closed(self) -> bool | None:
|
||||
"""Return true if cover is closed."""
|
||||
|
|
|
@ -220,6 +220,7 @@ DISCOVERY_SCHEMAS = [
|
|||
# Fibaro Shutter Fibaro FGS222
|
||||
ZWaveDiscoverySchema(
|
||||
platform="cover",
|
||||
hint="window_shutter",
|
||||
manufacturer_id={0x010F},
|
||||
product_id={0x1000},
|
||||
product_type={0x0302},
|
||||
|
@ -228,14 +229,16 @@ DISCOVERY_SCHEMAS = [
|
|||
# Qubino flush shutter
|
||||
ZWaveDiscoverySchema(
|
||||
platform="cover",
|
||||
hint="window_shutter",
|
||||
manufacturer_id={0x0159},
|
||||
product_id={0x0052},
|
||||
product_id={0x0052, 0x0053},
|
||||
product_type={0x0003},
|
||||
primary_value=SWITCH_MULTILEVEL_CURRENT_VALUE_SCHEMA,
|
||||
),
|
||||
# Graber/Bali/Spring Fashion Covers
|
||||
ZWaveDiscoverySchema(
|
||||
platform="cover",
|
||||
hint="window_blind",
|
||||
manufacturer_id={0x026E},
|
||||
product_id={0x5A31},
|
||||
product_type={0x4353},
|
||||
|
@ -244,6 +247,7 @@ DISCOVERY_SCHEMAS = [
|
|||
# iBlinds v2 window blind motor
|
||||
ZWaveDiscoverySchema(
|
||||
platform="cover",
|
||||
hint="window_blind",
|
||||
manufacturer_id={0x0287},
|
||||
product_id={0x000D},
|
||||
product_type={0x0003},
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue