Extend zwave_js discovery scheme for lights (#46907)
parent
d02b27a5d0
commit
d4d68ebc64
|
@ -221,22 +221,6 @@ DISCOVERY_SCHEMAS = [
|
|||
type={"number"},
|
||||
),
|
||||
),
|
||||
# lights
|
||||
# primary value is the currentValue (brightness)
|
||||
ZWaveDiscoverySchema(
|
||||
platform="light",
|
||||
device_class_generic={"Multilevel Switch", "Remote Switch"},
|
||||
device_class_specific={
|
||||
"Tunable Color Light",
|
||||
"Binary Tunable Color Light",
|
||||
"Tunable Color Switch",
|
||||
"Multilevel Remote Switch",
|
||||
"Multilevel Power Switch",
|
||||
"Multilevel Scene Switch",
|
||||
"Unused",
|
||||
},
|
||||
primary_value=SWITCH_MULTILEVEL_CURRENT_VALUE_SCHEMA,
|
||||
),
|
||||
# binary sensors
|
||||
ZWaveDiscoverySchema(
|
||||
platform="binary_sensor",
|
||||
|
@ -381,6 +365,15 @@ DISCOVERY_SCHEMAS = [
|
|||
device_class_specific={"Fan Switch"},
|
||||
primary_value=SWITCH_MULTILEVEL_CURRENT_VALUE_SCHEMA,
|
||||
),
|
||||
# lights
|
||||
# primary value is the currentValue (brightness)
|
||||
# catch any device with multilevel CC as light
|
||||
# NOTE: keep this at the bottom of the discovery scheme,
|
||||
# to handle all others that need the multilevel CC first
|
||||
ZWaveDiscoverySchema(
|
||||
platform="light",
|
||||
primary_value=SWITCH_MULTILEVEL_CURRENT_VALUE_SCHEMA,
|
||||
),
|
||||
]
|
||||
|
||||
|
||||
|
|
|
@ -148,6 +148,12 @@ def iblinds_v2_state_fixture():
|
|||
return json.loads(load_fixture("zwave_js/cover_iblinds_v2_state.json"))
|
||||
|
||||
|
||||
@pytest.fixture(name="aeon_smart_switch_6_state", scope="session")
|
||||
def aeon_smart_switch_6_state_fixture():
|
||||
"""Load the AEON Labs (ZW096) Smart Switch 6 node state fixture data."""
|
||||
return json.loads(load_fixture("zwave_js/aeon_smart_switch_6_state.json"))
|
||||
|
||||
|
||||
@pytest.fixture(name="ge_12730_state", scope="session")
|
||||
def ge_12730_state_fixture():
|
||||
"""Load the GE 12730 node state fixture data."""
|
||||
|
@ -362,6 +368,14 @@ def iblinds_cover_fixture(client, iblinds_v2_state):
|
|||
return node
|
||||
|
||||
|
||||
@pytest.fixture(name="aeon_smart_switch_6")
|
||||
def aeon_smart_switch_6_fixture(client, aeon_smart_switch_6_state):
|
||||
"""Mock an AEON Labs (ZW096) Smart Switch 6 node."""
|
||||
node = Node(client, aeon_smart_switch_6_state)
|
||||
client.driver.controller.nodes[node.node_id] = node
|
||||
return node
|
||||
|
||||
|
||||
@pytest.fixture(name="ge_12730")
|
||||
def ge_12730_fixture(client, ge_12730_state):
|
||||
"""Mock a GE 12730 fan controller node."""
|
||||
|
|
|
@ -14,6 +14,7 @@ from homeassistant.const import ATTR_SUPPORTED_FEATURES, STATE_OFF, STATE_ON
|
|||
|
||||
BULB_6_MULTI_COLOR_LIGHT_ENTITY = "light.bulb_6_multi_color"
|
||||
EATON_RF9640_ENTITY = "light.allloaddimmer"
|
||||
AEON_SMART_SWITCH_LIGHT_ENTITY = "light.smart_switch_6"
|
||||
|
||||
|
||||
async def test_light(hass, client, bulb_6_multi_color, integration):
|
||||
|
@ -403,3 +404,9 @@ async def test_v4_dimmer_light(hass, client, eaton_rf9640_dimmer, integration):
|
|||
assert state.state == STATE_ON
|
||||
# the light should pick currentvalue which has zwave value 22
|
||||
assert state.attributes[ATTR_BRIGHTNESS] == 57
|
||||
|
||||
|
||||
async def test_optional_light(hass, client, aeon_smart_switch_6, integration):
|
||||
"""Test a device that has an additional light endpoint being identified as light."""
|
||||
state = hass.states.get(AEON_SMART_SWITCH_LIGHT_ENTITY)
|
||||
assert state.state == STATE_ON
|
||||
|
|
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue