Add fan platform to ozw component (#35249)

* Add fan platform

* Add fan discovery schema

* Use constants for dispatcher signal

* Move fan platform to ozw

* Fix fan discovery schema

* Add previous speed to handle value 255

* Make fixture reading more robust

* Add fan tests

* Remove not needed fixture info

* Validate speed

Co-authored-by: Martin Hjelmare <marhje52@gmail.com>
This commit is contained in:
Charles GarwoodandMartin Hjelmare authored and GitHub committed 2020-05-26 19:48:39 -04:00
1 parent 59c112a3f2
commit ca1e643bdc
8 files changed
+341 -1

No files matched your search

+17
View File
@@ -15,6 +15,12 @@ def generic_data_fixture():
return load_fixture("ozw/generic_network_dump.csv")
@pytest.fixture(name="fan_data", scope="session")
def fan_data_fixture():
"""Load fan MQTT data and return it."""
return load_fixture("ozw/fan_network_dump.csv")
@pytest.fixture(name="light_data", scope="session")
def light_data_fixture():
"""Load light dimmer MQTT data and return it."""
@@ -47,6 +53,17 @@ def sent_messages_fixture():
yield sent_messages
@pytest.fixture(name="fan_msg")
async def fan_msg_fixture(hass):
"""Return a mock MQTT msg with a fan actuator message."""
fan_json = json.loads(
await hass.async_add_executor_job(load_fixture, "ozw/fan.json")
)
message = MQTTMessage(topic=fan_json["topic"], payload=fan_json["payload"])
message.encode()
return message
@pytest.fixture(name="light_msg")
async def light_msg_fixture(hass):
"""Return a mock MQTT msg with a light actuator message."""