Fix ozw pure rgb dimmer light (#38877)

* Fix ozw pure rgb light

* Add test
This commit is contained in:
Martin Hjelmare 2020-08-15 20:41:30 +02:00 committed by GitHub
parent 9c6b019ca9
commit 0f1e70ca79
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 238 additions and 19 deletions

View file

@ -33,6 +33,12 @@ def light_new_ozw_data_fixture():
return load_fixture("ozw/light_new_ozw_network_dump.csv")
@pytest.fixture(name="light_pure_rgb_dimmer_data", scope="session")
def light_pure_rgb_dimmer_data_fixture():
"""Load light rgb and dimmer MQTT data and return it."""
return load_fixture("ozw/light_pure_rgb_dimmer_dump.csv")
@pytest.fixture(name="light_no_rgb_data", scope="session")
def light_no_rgb_data_fixture():
"""Load light dimmer MQTT data and return it."""
@ -139,6 +145,17 @@ async def light_rgb_msg_fixture(hass):
return message
@pytest.fixture(name="light_pure_rgb_msg")
async def light_pure_rgb_msg_fixture(hass):
"""Return a mock MQTT msg with a pure rgb light actuator message."""
light_json = json.loads(
await hass.async_add_executor_job(load_fixture, "ozw/light_pure_rgb.json")
)
message = MQTTMessage(topic=light_json["topic"], payload=light_json["payload"])
message.encode()
return message
@pytest.fixture(name="switch_msg")
async def switch_msg_fixture(hass):
"""Return a mock MQTT msg with a switch actuator message."""