Remove v4 multilevel transitional currentValue workaround in zwave_js (#45884)

* Remove v4 multilevel transitional currentValue workaround

This was only needed because the get-after-set was reporting a
transitional currentValue instead of the final one.
zwave-js v6.1.1 removes the get-after-set functionality completely, so
this is no longer required (and breaks status reporting entirely)

* Fix tests to check currentValue instead of targetValue as well
This commit is contained in:
Jesse Campbell 2021-02-03 06:02:49 -05:00 committed by GitHub
parent 40ba182144
commit eaa9fff3ba
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 5 additions and 13 deletions

View file

@ -105,14 +105,6 @@ class ZwaveLight(ZWaveBaseEntity, LightEntity):
Z-Wave multilevel switches use a range of [0, 99] to control brightness.
"""
# prefer targetValue only if CC Version >= 4
# otherwise use currentValue (pre V4 dimmers)
if (
self._target_value
and self._target_value.value is not None
and self._target_value.cc_version >= 4
):
return round((self._target_value.value / 99) * 255)
if self.info.primary_value.value is not None:
return round((self.info.primary_value.value / 99) * 255)
return 0

View file

@ -88,7 +88,7 @@ def bulb_6_multi_color_state_fixture():
@pytest.fixture(name="eaton_rf9640_dimmer_state", scope="session")
def eaton_rf9640_dimmer_state_fixture():
"""Load the bulb 6 multi-color node state fixture data."""
"""Load the eaton rf9640 dimmer node state fixture data."""
return json.loads(load_fixture("zwave_js/eaton_rf9640_dimmer_state.json"))

View file

@ -395,5 +395,5 @@ async def test_v4_dimmer_light(hass, client, eaton_rf9640_dimmer, integration):
assert state
assert state.state == STATE_ON
# the light should pick targetvalue which has zwave value 20
assert state.attributes[ATTR_BRIGHTNESS] == 52
# the light should pick currentvalue which has zwave value 22
assert state.attributes[ATTR_BRIGHTNESS] == 57

View file

@ -124,7 +124,7 @@
"max": 99,
"label": "Current value"
},
"value": 0,
"value": 22,
"ccVersion": 4
},
{
@ -779,4 +779,4 @@
"ccVersion": 3
}
]
}
}