Add ZwaveStringSensor to OZW integration (#38676)

* Add ZwaveStringSensor to OZW integration

* Remove unnecessary new line

* Set enabled default to false for ZwaveStringSensor

* Add missing decorator for property

* Add a test for ZwaveStringSensor

* Also test state of ZWaveStringSensor

* Remove entity type check
This commit is contained in:
Fritiof Hedman authored and GitHub committed 2020-08-23 15:16:26 +02:00
1 parent 62b1f23328
commit 961f36c679
4 files changed
+54

No files matched your search

+6
View File
@@ -87,6 +87,12 @@ def lock_data_fixture():
return load_fixture("ozw/lock_network_dump.csv")
@pytest.fixture(name="string_sensor_data", scope="session")
def string_sensor_fixture():
"""Load string sensor MQTT data and return it."""
return load_fixture("ozw/sensor_string_value_network_dump.csv")
@pytest.fixture(name="sent_messages")
def sent_messages_fixture():
"""Fixture to capture sent messages."""
+21
View File
@@ -74,3 +74,24 @@ async def test_sensor_enabled(hass, generic_data, sensor_msg):
assert state is not None
assert state.state == "0"
assert state.attributes["label"] == "Clear"
async def test_string_sensor(hass, string_sensor_data):
"""Test so the returned type is a string sensor."""
registry = await hass.helpers.entity_registry.async_get_registry()
entry = registry.async_get_or_create(
SENSOR_DOMAIN,
DOMAIN,
"1-49-73464969749610519",
suggested_object_id="id_150_z_wave_module_user_code",
disabled_by=None,
)
await setup_ozw(hass, fixture=string_sensor_data)
await hass.async_block_till_done()
state = hass.states.get(entry.entity_id)
assert state is not None
assert state.state == "asdfgh"