Add shutter tilt support for Shelly Wave Shutter QNSH-001P10 (#116211)
* Add shutter tilt support for Shelly Wave Shutter QNSH-001P10 * Add shelly_europe_ltd_qnsh_001p10_state.json fixture * Update test_discovery.py * Load shelly wave shutter 001p10 node fixture * Update test_discovery.py Check if entity of first node exists. * Update test_discovery.py Add additional comments * Clean whitespace --------- Co-authored-by: Martin Hjelmare <marhje52@gmail.com>pull/116600/head
parent
71c5f33e69
commit
1170ce1296
|
@ -448,6 +448,61 @@ DISCOVERY_SCHEMAS = [
|
|||
primary_value=SWITCH_MULTILEVEL_CURRENT_VALUE_SCHEMA,
|
||||
required_values=[SWITCH_MULTILEVEL_TARGET_VALUE_SCHEMA],
|
||||
),
|
||||
# Shelly Qubino Wave Shutter QNSH-001P10
|
||||
# Combine both switch_multilevel endpoints into shutter_tilt
|
||||
# if operating mode (71) is set to venetian blind (1)
|
||||
ZWaveDiscoverySchema(
|
||||
platform=Platform.COVER,
|
||||
hint="shutter_tilt",
|
||||
manufacturer_id={0x0460},
|
||||
product_id={0x0082},
|
||||
product_type={0x0003},
|
||||
primary_value=ZWaveValueDiscoverySchema(
|
||||
command_class={CommandClass.SWITCH_MULTILEVEL},
|
||||
property={CURRENT_VALUE_PROPERTY},
|
||||
endpoint={1},
|
||||
type={ValueType.NUMBER},
|
||||
),
|
||||
data_template=CoverTiltDataTemplate(
|
||||
current_tilt_value_id=ZwaveValueID(
|
||||
property_=CURRENT_VALUE_PROPERTY,
|
||||
command_class=CommandClass.SWITCH_MULTILEVEL,
|
||||
endpoint=2,
|
||||
),
|
||||
target_tilt_value_id=ZwaveValueID(
|
||||
property_=TARGET_VALUE_PROPERTY,
|
||||
command_class=CommandClass.SWITCH_MULTILEVEL,
|
||||
endpoint=2,
|
||||
),
|
||||
),
|
||||
required_values=[
|
||||
ZWaveValueDiscoverySchema(
|
||||
command_class={CommandClass.CONFIGURATION},
|
||||
property={71},
|
||||
endpoint={0},
|
||||
value={1},
|
||||
)
|
||||
],
|
||||
),
|
||||
# Shelly Qubino Wave Shutter QNSH-001P10
|
||||
# Disable endpoint 2 (slat),
|
||||
# as these are either combined with endpoint one as shutter_tilt
|
||||
# or it has no practical function.
|
||||
# CC: Switch_Multilevel
|
||||
ZWaveDiscoverySchema(
|
||||
platform=Platform.COVER,
|
||||
hint="shutter",
|
||||
manufacturer_id={0x0460},
|
||||
product_id={0x0082},
|
||||
product_type={0x0003},
|
||||
primary_value=ZWaveValueDiscoverySchema(
|
||||
command_class={CommandClass.SWITCH_MULTILEVEL},
|
||||
property={CURRENT_VALUE_PROPERTY},
|
||||
endpoint={2},
|
||||
type={ValueType.NUMBER},
|
||||
),
|
||||
entity_registry_enabled_default=False,
|
||||
),
|
||||
# Qubino flush shutter
|
||||
ZWaveDiscoverySchema(
|
||||
platform=Platform.COVER,
|
||||
|
|
|
@ -496,6 +496,12 @@ def fibaro_fgr223_shutter_state_fixture():
|
|||
return json.loads(load_fixture("zwave_js/cover_fibaro_fgr223_state.json"))
|
||||
|
||||
|
||||
@pytest.fixture(name="shelly_europe_ltd_qnsh_001p10_state", scope="package")
|
||||
def shelly_europe_ltd_qnsh_001p10_state_fixture():
|
||||
"""Load the Shelly QNSH 001P10 node state fixture data."""
|
||||
return json.loads(load_fixture("zwave_js/shelly_europe_ltd_qnsh_001p10_state.json"))
|
||||
|
||||
|
||||
@pytest.fixture(name="merten_507801_state", scope="package")
|
||||
def merten_507801_state_fixture():
|
||||
"""Load the Merten 507801 Shutter node state fixture data."""
|
||||
|
@ -1095,6 +1101,16 @@ def fibaro_fgr223_shutter_cover_fixture(client, fibaro_fgr223_shutter_state):
|
|||
return node
|
||||
|
||||
|
||||
@pytest.fixture(name="shelly_qnsh_001P10_shutter")
|
||||
def shelly_qnsh_001P10_cover_shutter_fixture(
|
||||
client, shelly_europe_ltd_qnsh_001p10_state
|
||||
):
|
||||
"""Mock a Shelly QNSH 001P10 Shutter node."""
|
||||
node = Node(client, copy.deepcopy(shelly_europe_ltd_qnsh_001p10_state))
|
||||
client.driver.controller.nodes[node.node_id] = node
|
||||
return node
|
||||
|
||||
|
||||
@pytest.fixture(name="merten_507801")
|
||||
def merten_507801_cover_fixture(client, merten_507801_state):
|
||||
"""Mock a Merten 507801 Shutter node."""
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -134,6 +134,32 @@ async def test_merten_507801(
|
|||
assert state
|
||||
|
||||
|
||||
async def test_shelly_001p10_disabled_entities(
|
||||
hass: HomeAssistant, client, shelly_qnsh_001P10_shutter, integration
|
||||
) -> None:
|
||||
"""Test that Shelly 001P10 entity created by endpoint 2 is disabled."""
|
||||
registry = er.async_get(hass)
|
||||
entity_ids = [
|
||||
"cover.wave_shutter_2",
|
||||
]
|
||||
for entity_id in entity_ids:
|
||||
state = hass.states.get(entity_id)
|
||||
assert state is None
|
||||
entry = registry.async_get(entity_id)
|
||||
assert entry
|
||||
assert entry.disabled
|
||||
assert entry.disabled_by is er.RegistryEntryDisabler.INTEGRATION
|
||||
|
||||
# Test enabling entity
|
||||
updated_entry = registry.async_update_entity(entry.entity_id, disabled_by=None)
|
||||
assert updated_entry != entry
|
||||
assert updated_entry.disabled is False
|
||||
|
||||
# Test if the main entity from endpoint 1 was created.
|
||||
state = hass.states.get("cover.wave_shutter")
|
||||
assert state
|
||||
|
||||
|
||||
async def test_merten_507801_disabled_enitites(
|
||||
hass: HomeAssistant, client, merten_507801, integration
|
||||
) -> None:
|
||||
|
|
Loading…
Reference in New Issue