Use parametrize in drop connect sensor tests (#107078)
* Use parametrize in drop connect sensor tests * Use parametrize in drop connect sensor tests * Make common helper * Assert the whole entity state * fix --------- Co-authored-by: Jan Bouwhuis <jbouwh@users.noreply.github.com> Co-authored-by: jbouwh <jan@jbsoft.nl>
This commit is contained in:
parent
9fd31f6c92
commit
486bb6d89f
3 changed files with 1032 additions and 273 deletions
|
@ -1,5 +1,7 @@
|
||||||
"""Define common test values."""
|
"""Define common test values."""
|
||||||
|
|
||||||
|
from syrupy import SnapshotAssertion
|
||||||
|
|
||||||
from homeassistant.components.drop_connect.const import (
|
from homeassistant.components.drop_connect.const import (
|
||||||
CONF_COMMAND_TOPIC,
|
CONF_COMMAND_TOPIC,
|
||||||
CONF_DATA_TOPIC,
|
CONF_DATA_TOPIC,
|
||||||
|
@ -12,6 +14,9 @@ from homeassistant.components.drop_connect.const import (
|
||||||
DOMAIN,
|
DOMAIN,
|
||||||
)
|
)
|
||||||
from homeassistant.config_entries import ConfigEntry
|
from homeassistant.config_entries import ConfigEntry
|
||||||
|
from homeassistant.const import STATE_UNKNOWN
|
||||||
|
from homeassistant.core import HomeAssistant
|
||||||
|
from homeassistant.helpers import entity_registry as er
|
||||||
|
|
||||||
from tests.common import MockConfigEntry
|
from tests.common import MockConfigEntry
|
||||||
|
|
||||||
|
@ -216,3 +221,27 @@ def config_entry_ro_filter() -> ConfigEntry:
|
||||||
},
|
},
|
||||||
version=1,
|
version=1,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
def help_assert_entries(
|
||||||
|
hass: HomeAssistant,
|
||||||
|
entity_registry: er.EntityRegistry,
|
||||||
|
snapshot: SnapshotAssertion,
|
||||||
|
config_entry: ConfigEntry,
|
||||||
|
step: str,
|
||||||
|
assert_unknown: bool = False,
|
||||||
|
) -> None:
|
||||||
|
"""Assert platform entities and state."""
|
||||||
|
entity_entries = er.async_entries_for_config_entry(
|
||||||
|
entity_registry, config_entry.entry_id
|
||||||
|
)
|
||||||
|
assert entity_entries
|
||||||
|
if assert_unknown:
|
||||||
|
for entity_entry in entity_entries:
|
||||||
|
assert hass.states.get(entity_entry.entity_id).state == STATE_UNKNOWN
|
||||||
|
return
|
||||||
|
|
||||||
|
for entity_entry in entity_entries:
|
||||||
|
assert hass.states.get(entity_entry.entity_id) == snapshot(
|
||||||
|
name=f"{entity_entry.entity_id}-{step}"
|
||||||
|
)
|
||||||
|
|
919
tests/components/drop_connect/snapshots/test_sensor.ambr
Normal file
919
tests/components/drop_connect/snapshots/test_sensor.ambr
Normal file
|
@ -0,0 +1,919 @@
|
||||||
|
# serializer version: 1
|
||||||
|
# name: test_sensors[filter][sensor.filter_battery-data]
|
||||||
|
StateSnapshot({
|
||||||
|
'attributes': ReadOnlyDict({
|
||||||
|
'device_class': 'battery',
|
||||||
|
'friendly_name': 'Filter Battery',
|
||||||
|
'state_class': <SensorStateClass.MEASUREMENT: 'measurement'>,
|
||||||
|
'unit_of_measurement': '%',
|
||||||
|
}),
|
||||||
|
'context': <ANY>,
|
||||||
|
'entity_id': 'sensor.filter_battery',
|
||||||
|
'last_changed': <ANY>,
|
||||||
|
'last_reported': <ANY>,
|
||||||
|
'last_updated': <ANY>,
|
||||||
|
'state': '12',
|
||||||
|
})
|
||||||
|
# ---
|
||||||
|
# name: test_sensors[filter][sensor.filter_battery-reset]
|
||||||
|
StateSnapshot({
|
||||||
|
'attributes': ReadOnlyDict({
|
||||||
|
'device_class': 'battery',
|
||||||
|
'friendly_name': 'Filter Battery',
|
||||||
|
'state_class': <SensorStateClass.MEASUREMENT: 'measurement'>,
|
||||||
|
'unit_of_measurement': '%',
|
||||||
|
}),
|
||||||
|
'context': <ANY>,
|
||||||
|
'entity_id': 'sensor.filter_battery',
|
||||||
|
'last_changed': <ANY>,
|
||||||
|
'last_reported': <ANY>,
|
||||||
|
'last_updated': <ANY>,
|
||||||
|
'state': '0',
|
||||||
|
})
|
||||||
|
# ---
|
||||||
|
# name: test_sensors[filter][sensor.filter_current_water_pressure-data]
|
||||||
|
StateSnapshot({
|
||||||
|
'attributes': ReadOnlyDict({
|
||||||
|
'device_class': 'pressure',
|
||||||
|
'friendly_name': 'Filter Current water pressure',
|
||||||
|
'state_class': <SensorStateClass.MEASUREMENT: 'measurement'>,
|
||||||
|
'unit_of_measurement': <UnitOfPressure.KPA: 'kPa'>,
|
||||||
|
}),
|
||||||
|
'context': <ANY>,
|
||||||
|
'entity_id': 'sensor.filter_current_water_pressure',
|
||||||
|
'last_changed': <ANY>,
|
||||||
|
'last_reported': <ANY>,
|
||||||
|
'last_updated': <ANY>,
|
||||||
|
'state': '263.3797174',
|
||||||
|
})
|
||||||
|
# ---
|
||||||
|
# name: test_sensors[filter][sensor.filter_current_water_pressure-reset]
|
||||||
|
StateSnapshot({
|
||||||
|
'attributes': ReadOnlyDict({
|
||||||
|
'device_class': 'pressure',
|
||||||
|
'friendly_name': 'Filter Current water pressure',
|
||||||
|
'state_class': <SensorStateClass.MEASUREMENT: 'measurement'>,
|
||||||
|
'unit_of_measurement': <UnitOfPressure.KPA: 'kPa'>,
|
||||||
|
}),
|
||||||
|
'context': <ANY>,
|
||||||
|
'entity_id': 'sensor.filter_current_water_pressure',
|
||||||
|
'last_changed': <ANY>,
|
||||||
|
'last_reported': <ANY>,
|
||||||
|
'last_updated': <ANY>,
|
||||||
|
'state': 'unknown',
|
||||||
|
})
|
||||||
|
# ---
|
||||||
|
# name: test_sensors[filter][sensor.filter_water_flow_rate-data]
|
||||||
|
StateSnapshot({
|
||||||
|
'attributes': ReadOnlyDict({
|
||||||
|
'device_class': 'volume_flow_rate',
|
||||||
|
'friendly_name': 'Filter Water flow rate',
|
||||||
|
'state_class': <SensorStateClass.MEASUREMENT: 'measurement'>,
|
||||||
|
'unit_of_measurement': <UnitOfVolumeFlowRate.GALLONS_PER_MINUTE: 'gal/min'>,
|
||||||
|
}),
|
||||||
|
'context': <ANY>,
|
||||||
|
'entity_id': 'sensor.filter_water_flow_rate',
|
||||||
|
'last_changed': <ANY>,
|
||||||
|
'last_reported': <ANY>,
|
||||||
|
'last_updated': <ANY>,
|
||||||
|
'state': '19.84',
|
||||||
|
})
|
||||||
|
# ---
|
||||||
|
# name: test_sensors[filter][sensor.filter_water_flow_rate-reset]
|
||||||
|
StateSnapshot({
|
||||||
|
'attributes': ReadOnlyDict({
|
||||||
|
'device_class': 'volume_flow_rate',
|
||||||
|
'friendly_name': 'Filter Water flow rate',
|
||||||
|
'state_class': <SensorStateClass.MEASUREMENT: 'measurement'>,
|
||||||
|
'unit_of_measurement': <UnitOfVolumeFlowRate.GALLONS_PER_MINUTE: 'gal/min'>,
|
||||||
|
}),
|
||||||
|
'context': <ANY>,
|
||||||
|
'entity_id': 'sensor.filter_water_flow_rate',
|
||||||
|
'last_changed': <ANY>,
|
||||||
|
'last_reported': <ANY>,
|
||||||
|
'last_updated': <ANY>,
|
||||||
|
'state': '0.0',
|
||||||
|
})
|
||||||
|
# ---
|
||||||
|
# name: test_sensors[hub][sensor.hub_drop_1_c0ffee_average_daily_water_usage-data]
|
||||||
|
StateSnapshot({
|
||||||
|
'attributes': ReadOnlyDict({
|
||||||
|
'device_class': 'water',
|
||||||
|
'friendly_name': 'Hub DROP-1_C0FFEE Average daily water usage',
|
||||||
|
'state_class': <SensorStateClass.TOTAL: 'total'>,
|
||||||
|
'unit_of_measurement': <UnitOfVolume.LITERS: 'L'>,
|
||||||
|
}),
|
||||||
|
'context': <ANY>,
|
||||||
|
'entity_id': 'sensor.hub_drop_1_c0ffee_average_daily_water_usage',
|
||||||
|
'last_changed': <ANY>,
|
||||||
|
'last_reported': <ANY>,
|
||||||
|
'last_updated': <ANY>,
|
||||||
|
'state': '287.691295584',
|
||||||
|
})
|
||||||
|
# ---
|
||||||
|
# name: test_sensors[hub][sensor.hub_drop_1_c0ffee_average_daily_water_usage-reset]
|
||||||
|
StateSnapshot({
|
||||||
|
'attributes': ReadOnlyDict({
|
||||||
|
'device_class': 'water',
|
||||||
|
'friendly_name': 'Hub DROP-1_C0FFEE Average daily water usage',
|
||||||
|
'state_class': <SensorStateClass.TOTAL: 'total'>,
|
||||||
|
'unit_of_measurement': <UnitOfVolume.LITERS: 'L'>,
|
||||||
|
}),
|
||||||
|
'context': <ANY>,
|
||||||
|
'entity_id': 'sensor.hub_drop_1_c0ffee_average_daily_water_usage',
|
||||||
|
'last_changed': <ANY>,
|
||||||
|
'last_reported': <ANY>,
|
||||||
|
'last_updated': <ANY>,
|
||||||
|
'state': '0.0',
|
||||||
|
})
|
||||||
|
# ---
|
||||||
|
# name: test_sensors[hub][sensor.hub_drop_1_c0ffee_battery-data]
|
||||||
|
StateSnapshot({
|
||||||
|
'attributes': ReadOnlyDict({
|
||||||
|
'device_class': 'battery',
|
||||||
|
'friendly_name': 'Hub DROP-1_C0FFEE Battery',
|
||||||
|
'state_class': <SensorStateClass.MEASUREMENT: 'measurement'>,
|
||||||
|
'unit_of_measurement': '%',
|
||||||
|
}),
|
||||||
|
'context': <ANY>,
|
||||||
|
'entity_id': 'sensor.hub_drop_1_c0ffee_battery',
|
||||||
|
'last_changed': <ANY>,
|
||||||
|
'last_reported': <ANY>,
|
||||||
|
'last_updated': <ANY>,
|
||||||
|
'state': '50',
|
||||||
|
})
|
||||||
|
# ---
|
||||||
|
# name: test_sensors[hub][sensor.hub_drop_1_c0ffee_battery-reset]
|
||||||
|
StateSnapshot({
|
||||||
|
'attributes': ReadOnlyDict({
|
||||||
|
'device_class': 'battery',
|
||||||
|
'friendly_name': 'Hub DROP-1_C0FFEE Battery',
|
||||||
|
'state_class': <SensorStateClass.MEASUREMENT: 'measurement'>,
|
||||||
|
'unit_of_measurement': '%',
|
||||||
|
}),
|
||||||
|
'context': <ANY>,
|
||||||
|
'entity_id': 'sensor.hub_drop_1_c0ffee_battery',
|
||||||
|
'last_changed': <ANY>,
|
||||||
|
'last_reported': <ANY>,
|
||||||
|
'last_updated': <ANY>,
|
||||||
|
'state': '0',
|
||||||
|
})
|
||||||
|
# ---
|
||||||
|
# name: test_sensors[hub][sensor.hub_drop_1_c0ffee_current_water_pressure-data]
|
||||||
|
StateSnapshot({
|
||||||
|
'attributes': ReadOnlyDict({
|
||||||
|
'device_class': 'pressure',
|
||||||
|
'friendly_name': 'Hub DROP-1_C0FFEE Current water pressure',
|
||||||
|
'state_class': <SensorStateClass.MEASUREMENT: 'measurement'>,
|
||||||
|
'unit_of_measurement': <UnitOfPressure.KPA: 'kPa'>,
|
||||||
|
}),
|
||||||
|
'context': <ANY>,
|
||||||
|
'entity_id': 'sensor.hub_drop_1_c0ffee_current_water_pressure',
|
||||||
|
'last_changed': <ANY>,
|
||||||
|
'last_reported': <ANY>,
|
||||||
|
'last_updated': <ANY>,
|
||||||
|
'state': '428.8538854',
|
||||||
|
})
|
||||||
|
# ---
|
||||||
|
# name: test_sensors[hub][sensor.hub_drop_1_c0ffee_current_water_pressure-reset]
|
||||||
|
StateSnapshot({
|
||||||
|
'attributes': ReadOnlyDict({
|
||||||
|
'device_class': 'pressure',
|
||||||
|
'friendly_name': 'Hub DROP-1_C0FFEE Current water pressure',
|
||||||
|
'state_class': <SensorStateClass.MEASUREMENT: 'measurement'>,
|
||||||
|
'unit_of_measurement': <UnitOfPressure.KPA: 'kPa'>,
|
||||||
|
}),
|
||||||
|
'context': <ANY>,
|
||||||
|
'entity_id': 'sensor.hub_drop_1_c0ffee_current_water_pressure',
|
||||||
|
'last_changed': <ANY>,
|
||||||
|
'last_reported': <ANY>,
|
||||||
|
'last_updated': <ANY>,
|
||||||
|
'state': '0.0',
|
||||||
|
})
|
||||||
|
# ---
|
||||||
|
# name: test_sensors[hub][sensor.hub_drop_1_c0ffee_high_water_pressure_today-data]
|
||||||
|
StateSnapshot({
|
||||||
|
'attributes': ReadOnlyDict({
|
||||||
|
'device_class': 'pressure',
|
||||||
|
'friendly_name': 'Hub DROP-1_C0FFEE High water pressure today',
|
||||||
|
'state_class': <SensorStateClass.MEASUREMENT: 'measurement'>,
|
||||||
|
'unit_of_measurement': <UnitOfPressure.KPA: 'kPa'>,
|
||||||
|
}),
|
||||||
|
'context': <ANY>,
|
||||||
|
'entity_id': 'sensor.hub_drop_1_c0ffee_high_water_pressure_today',
|
||||||
|
'last_changed': <ANY>,
|
||||||
|
'last_reported': <ANY>,
|
||||||
|
'last_updated': <ANY>,
|
||||||
|
'state': '427.474934',
|
||||||
|
})
|
||||||
|
# ---
|
||||||
|
# name: test_sensors[hub][sensor.hub_drop_1_c0ffee_high_water_pressure_today-reset]
|
||||||
|
StateSnapshot({
|
||||||
|
'attributes': ReadOnlyDict({
|
||||||
|
'device_class': 'pressure',
|
||||||
|
'friendly_name': 'Hub DROP-1_C0FFEE High water pressure today',
|
||||||
|
'state_class': <SensorStateClass.MEASUREMENT: 'measurement'>,
|
||||||
|
'unit_of_measurement': <UnitOfPressure.KPA: 'kPa'>,
|
||||||
|
}),
|
||||||
|
'context': <ANY>,
|
||||||
|
'entity_id': 'sensor.hub_drop_1_c0ffee_high_water_pressure_today',
|
||||||
|
'last_changed': <ANY>,
|
||||||
|
'last_reported': <ANY>,
|
||||||
|
'last_updated': <ANY>,
|
||||||
|
'state': '0.0',
|
||||||
|
})
|
||||||
|
# ---
|
||||||
|
# name: test_sensors[hub][sensor.hub_drop_1_c0ffee_low_water_pressure_today-data]
|
||||||
|
StateSnapshot({
|
||||||
|
'attributes': ReadOnlyDict({
|
||||||
|
'device_class': 'pressure',
|
||||||
|
'friendly_name': 'Hub DROP-1_C0FFEE Low water pressure today',
|
||||||
|
'state_class': <SensorStateClass.MEASUREMENT: 'measurement'>,
|
||||||
|
'unit_of_measurement': <UnitOfPressure.KPA: 'kPa'>,
|
||||||
|
}),
|
||||||
|
'context': <ANY>,
|
||||||
|
'entity_id': 'sensor.hub_drop_1_c0ffee_low_water_pressure_today',
|
||||||
|
'last_changed': <ANY>,
|
||||||
|
'last_reported': <ANY>,
|
||||||
|
'last_updated': <ANY>,
|
||||||
|
'state': '420.580177',
|
||||||
|
})
|
||||||
|
# ---
|
||||||
|
# name: test_sensors[hub][sensor.hub_drop_1_c0ffee_low_water_pressure_today-reset]
|
||||||
|
StateSnapshot({
|
||||||
|
'attributes': ReadOnlyDict({
|
||||||
|
'device_class': 'pressure',
|
||||||
|
'friendly_name': 'Hub DROP-1_C0FFEE Low water pressure today',
|
||||||
|
'state_class': <SensorStateClass.MEASUREMENT: 'measurement'>,
|
||||||
|
'unit_of_measurement': <UnitOfPressure.KPA: 'kPa'>,
|
||||||
|
}),
|
||||||
|
'context': <ANY>,
|
||||||
|
'entity_id': 'sensor.hub_drop_1_c0ffee_low_water_pressure_today',
|
||||||
|
'last_changed': <ANY>,
|
||||||
|
'last_reported': <ANY>,
|
||||||
|
'last_updated': <ANY>,
|
||||||
|
'state': '0.0',
|
||||||
|
})
|
||||||
|
# ---
|
||||||
|
# name: test_sensors[hub][sensor.hub_drop_1_c0ffee_peak_water_flow_rate_today-data]
|
||||||
|
StateSnapshot({
|
||||||
|
'attributes': ReadOnlyDict({
|
||||||
|
'device_class': 'volume_flow_rate',
|
||||||
|
'friendly_name': 'Hub DROP-1_C0FFEE Peak water flow rate today',
|
||||||
|
'state_class': <SensorStateClass.MEASUREMENT: 'measurement'>,
|
||||||
|
'unit_of_measurement': <UnitOfVolumeFlowRate.GALLONS_PER_MINUTE: 'gal/min'>,
|
||||||
|
}),
|
||||||
|
'context': <ANY>,
|
||||||
|
'entity_id': 'sensor.hub_drop_1_c0ffee_peak_water_flow_rate_today',
|
||||||
|
'last_changed': <ANY>,
|
||||||
|
'last_reported': <ANY>,
|
||||||
|
'last_updated': <ANY>,
|
||||||
|
'state': '13.8',
|
||||||
|
})
|
||||||
|
# ---
|
||||||
|
# name: test_sensors[hub][sensor.hub_drop_1_c0ffee_peak_water_flow_rate_today-reset]
|
||||||
|
StateSnapshot({
|
||||||
|
'attributes': ReadOnlyDict({
|
||||||
|
'device_class': 'volume_flow_rate',
|
||||||
|
'friendly_name': 'Hub DROP-1_C0FFEE Peak water flow rate today',
|
||||||
|
'state_class': <SensorStateClass.MEASUREMENT: 'measurement'>,
|
||||||
|
'unit_of_measurement': <UnitOfVolumeFlowRate.GALLONS_PER_MINUTE: 'gal/min'>,
|
||||||
|
}),
|
||||||
|
'context': <ANY>,
|
||||||
|
'entity_id': 'sensor.hub_drop_1_c0ffee_peak_water_flow_rate_today',
|
||||||
|
'last_changed': <ANY>,
|
||||||
|
'last_reported': <ANY>,
|
||||||
|
'last_updated': <ANY>,
|
||||||
|
'state': '0.0',
|
||||||
|
})
|
||||||
|
# ---
|
||||||
|
# name: test_sensors[hub][sensor.hub_drop_1_c0ffee_total_water_used_today-data]
|
||||||
|
StateSnapshot({
|
||||||
|
'attributes': ReadOnlyDict({
|
||||||
|
'device_class': 'water',
|
||||||
|
'friendly_name': 'Hub DROP-1_C0FFEE Total water used today',
|
||||||
|
'state_class': <SensorStateClass.TOTAL: 'total'>,
|
||||||
|
'unit_of_measurement': <UnitOfVolume.LITERS: 'L'>,
|
||||||
|
}),
|
||||||
|
'context': <ANY>,
|
||||||
|
'entity_id': 'sensor.hub_drop_1_c0ffee_total_water_used_today',
|
||||||
|
'last_changed': <ANY>,
|
||||||
|
'last_reported': <ANY>,
|
||||||
|
'last_updated': <ANY>,
|
||||||
|
'state': '881.13030096168',
|
||||||
|
})
|
||||||
|
# ---
|
||||||
|
# name: test_sensors[hub][sensor.hub_drop_1_c0ffee_total_water_used_today-reset]
|
||||||
|
StateSnapshot({
|
||||||
|
'attributes': ReadOnlyDict({
|
||||||
|
'device_class': 'water',
|
||||||
|
'friendly_name': 'Hub DROP-1_C0FFEE Total water used today',
|
||||||
|
'state_class': <SensorStateClass.TOTAL: 'total'>,
|
||||||
|
'unit_of_measurement': <UnitOfVolume.LITERS: 'L'>,
|
||||||
|
}),
|
||||||
|
'context': <ANY>,
|
||||||
|
'entity_id': 'sensor.hub_drop_1_c0ffee_total_water_used_today',
|
||||||
|
'last_changed': <ANY>,
|
||||||
|
'last_reported': <ANY>,
|
||||||
|
'last_updated': <ANY>,
|
||||||
|
'state': '0.0',
|
||||||
|
})
|
||||||
|
# ---
|
||||||
|
# name: test_sensors[hub][sensor.hub_drop_1_c0ffee_water_flow_rate-data]
|
||||||
|
StateSnapshot({
|
||||||
|
'attributes': ReadOnlyDict({
|
||||||
|
'device_class': 'volume_flow_rate',
|
||||||
|
'friendly_name': 'Hub DROP-1_C0FFEE Water flow rate',
|
||||||
|
'state_class': <SensorStateClass.MEASUREMENT: 'measurement'>,
|
||||||
|
'unit_of_measurement': <UnitOfVolumeFlowRate.GALLONS_PER_MINUTE: 'gal/min'>,
|
||||||
|
}),
|
||||||
|
'context': <ANY>,
|
||||||
|
'entity_id': 'sensor.hub_drop_1_c0ffee_water_flow_rate',
|
||||||
|
'last_changed': <ANY>,
|
||||||
|
'last_reported': <ANY>,
|
||||||
|
'last_updated': <ANY>,
|
||||||
|
'state': '5.77',
|
||||||
|
})
|
||||||
|
# ---
|
||||||
|
# name: test_sensors[hub][sensor.hub_drop_1_c0ffee_water_flow_rate-reset]
|
||||||
|
StateSnapshot({
|
||||||
|
'attributes': ReadOnlyDict({
|
||||||
|
'device_class': 'volume_flow_rate',
|
||||||
|
'friendly_name': 'Hub DROP-1_C0FFEE Water flow rate',
|
||||||
|
'state_class': <SensorStateClass.MEASUREMENT: 'measurement'>,
|
||||||
|
'unit_of_measurement': <UnitOfVolumeFlowRate.GALLONS_PER_MINUTE: 'gal/min'>,
|
||||||
|
}),
|
||||||
|
'context': <ANY>,
|
||||||
|
'entity_id': 'sensor.hub_drop_1_c0ffee_water_flow_rate',
|
||||||
|
'last_changed': <ANY>,
|
||||||
|
'last_reported': <ANY>,
|
||||||
|
'last_updated': <ANY>,
|
||||||
|
'state': '0.0',
|
||||||
|
})
|
||||||
|
# ---
|
||||||
|
# name: test_sensors[leak][sensor.leak_detector_battery-data]
|
||||||
|
StateSnapshot({
|
||||||
|
'attributes': ReadOnlyDict({
|
||||||
|
'device_class': 'battery',
|
||||||
|
'friendly_name': 'Leak Detector Battery',
|
||||||
|
'state_class': <SensorStateClass.MEASUREMENT: 'measurement'>,
|
||||||
|
'unit_of_measurement': '%',
|
||||||
|
}),
|
||||||
|
'context': <ANY>,
|
||||||
|
'entity_id': 'sensor.leak_detector_battery',
|
||||||
|
'last_changed': <ANY>,
|
||||||
|
'last_reported': <ANY>,
|
||||||
|
'last_updated': <ANY>,
|
||||||
|
'state': '100',
|
||||||
|
})
|
||||||
|
# ---
|
||||||
|
# name: test_sensors[leak][sensor.leak_detector_battery-reset]
|
||||||
|
StateSnapshot({
|
||||||
|
'attributes': ReadOnlyDict({
|
||||||
|
'device_class': 'battery',
|
||||||
|
'friendly_name': 'Leak Detector Battery',
|
||||||
|
'state_class': <SensorStateClass.MEASUREMENT: 'measurement'>,
|
||||||
|
'unit_of_measurement': '%',
|
||||||
|
}),
|
||||||
|
'context': <ANY>,
|
||||||
|
'entity_id': 'sensor.leak_detector_battery',
|
||||||
|
'last_changed': <ANY>,
|
||||||
|
'last_reported': <ANY>,
|
||||||
|
'last_updated': <ANY>,
|
||||||
|
'state': '0',
|
||||||
|
})
|
||||||
|
# ---
|
||||||
|
# name: test_sensors[leak][sensor.leak_detector_temperature-data]
|
||||||
|
StateSnapshot({
|
||||||
|
'attributes': ReadOnlyDict({
|
||||||
|
'device_class': 'temperature',
|
||||||
|
'friendly_name': 'Leak Detector Temperature',
|
||||||
|
'state_class': <SensorStateClass.MEASUREMENT: 'measurement'>,
|
||||||
|
'unit_of_measurement': <UnitOfTemperature.CELSIUS: '°C'>,
|
||||||
|
}),
|
||||||
|
'context': <ANY>,
|
||||||
|
'entity_id': 'sensor.leak_detector_temperature',
|
||||||
|
'last_changed': <ANY>,
|
||||||
|
'last_reported': <ANY>,
|
||||||
|
'last_updated': <ANY>,
|
||||||
|
'state': '20.1111111111111',
|
||||||
|
})
|
||||||
|
# ---
|
||||||
|
# name: test_sensors[leak][sensor.leak_detector_temperature-reset]
|
||||||
|
StateSnapshot({
|
||||||
|
'attributes': ReadOnlyDict({
|
||||||
|
'device_class': 'temperature',
|
||||||
|
'friendly_name': 'Leak Detector Temperature',
|
||||||
|
'state_class': <SensorStateClass.MEASUREMENT: 'measurement'>,
|
||||||
|
'unit_of_measurement': <UnitOfTemperature.CELSIUS: '°C'>,
|
||||||
|
}),
|
||||||
|
'context': <ANY>,
|
||||||
|
'entity_id': 'sensor.leak_detector_temperature',
|
||||||
|
'last_changed': <ANY>,
|
||||||
|
'last_reported': <ANY>,
|
||||||
|
'last_updated': <ANY>,
|
||||||
|
'state': '-17.7777777777778',
|
||||||
|
})
|
||||||
|
# ---
|
||||||
|
# name: test_sensors[protection_valve][sensor.protection_valve_battery-data]
|
||||||
|
StateSnapshot({
|
||||||
|
'attributes': ReadOnlyDict({
|
||||||
|
'device_class': 'battery',
|
||||||
|
'friendly_name': 'Protection Valve Battery',
|
||||||
|
'state_class': <SensorStateClass.MEASUREMENT: 'measurement'>,
|
||||||
|
'unit_of_measurement': '%',
|
||||||
|
}),
|
||||||
|
'context': <ANY>,
|
||||||
|
'entity_id': 'sensor.protection_valve_battery',
|
||||||
|
'last_changed': <ANY>,
|
||||||
|
'last_reported': <ANY>,
|
||||||
|
'last_updated': <ANY>,
|
||||||
|
'state': '0',
|
||||||
|
})
|
||||||
|
# ---
|
||||||
|
# name: test_sensors[protection_valve][sensor.protection_valve_battery-reset]
|
||||||
|
StateSnapshot({
|
||||||
|
'attributes': ReadOnlyDict({
|
||||||
|
'device_class': 'battery',
|
||||||
|
'friendly_name': 'Protection Valve Battery',
|
||||||
|
'state_class': <SensorStateClass.MEASUREMENT: 'measurement'>,
|
||||||
|
'unit_of_measurement': '%',
|
||||||
|
}),
|
||||||
|
'context': <ANY>,
|
||||||
|
'entity_id': 'sensor.protection_valve_battery',
|
||||||
|
'last_changed': <ANY>,
|
||||||
|
'last_reported': <ANY>,
|
||||||
|
'last_updated': <ANY>,
|
||||||
|
'state': '0',
|
||||||
|
})
|
||||||
|
# ---
|
||||||
|
# name: test_sensors[protection_valve][sensor.protection_valve_current_water_pressure-data]
|
||||||
|
StateSnapshot({
|
||||||
|
'attributes': ReadOnlyDict({
|
||||||
|
'device_class': 'pressure',
|
||||||
|
'friendly_name': 'Protection Valve Current water pressure',
|
||||||
|
'state_class': <SensorStateClass.MEASUREMENT: 'measurement'>,
|
||||||
|
'unit_of_measurement': <UnitOfPressure.KPA: 'kPa'>,
|
||||||
|
}),
|
||||||
|
'context': <ANY>,
|
||||||
|
'entity_id': 'sensor.protection_valve_current_water_pressure',
|
||||||
|
'last_changed': <ANY>,
|
||||||
|
'last_reported': <ANY>,
|
||||||
|
'last_updated': <ANY>,
|
||||||
|
'state': '422.6486041',
|
||||||
|
})
|
||||||
|
# ---
|
||||||
|
# name: test_sensors[protection_valve][sensor.protection_valve_current_water_pressure-reset]
|
||||||
|
StateSnapshot({
|
||||||
|
'attributes': ReadOnlyDict({
|
||||||
|
'device_class': 'pressure',
|
||||||
|
'friendly_name': 'Protection Valve Current water pressure',
|
||||||
|
'state_class': <SensorStateClass.MEASUREMENT: 'measurement'>,
|
||||||
|
'unit_of_measurement': <UnitOfPressure.KPA: 'kPa'>,
|
||||||
|
}),
|
||||||
|
'context': <ANY>,
|
||||||
|
'entity_id': 'sensor.protection_valve_current_water_pressure',
|
||||||
|
'last_changed': <ANY>,
|
||||||
|
'last_reported': <ANY>,
|
||||||
|
'last_updated': <ANY>,
|
||||||
|
'state': '0.0',
|
||||||
|
})
|
||||||
|
# ---
|
||||||
|
# name: test_sensors[protection_valve][sensor.protection_valve_temperature-data]
|
||||||
|
StateSnapshot({
|
||||||
|
'attributes': ReadOnlyDict({
|
||||||
|
'device_class': 'temperature',
|
||||||
|
'friendly_name': 'Protection Valve Temperature',
|
||||||
|
'state_class': <SensorStateClass.MEASUREMENT: 'measurement'>,
|
||||||
|
'unit_of_measurement': <UnitOfTemperature.CELSIUS: '°C'>,
|
||||||
|
}),
|
||||||
|
'context': <ANY>,
|
||||||
|
'entity_id': 'sensor.protection_valve_temperature',
|
||||||
|
'last_changed': <ANY>,
|
||||||
|
'last_reported': <ANY>,
|
||||||
|
'last_updated': <ANY>,
|
||||||
|
'state': '21.3888888888889',
|
||||||
|
})
|
||||||
|
# ---
|
||||||
|
# name: test_sensors[protection_valve][sensor.protection_valve_temperature-reset]
|
||||||
|
StateSnapshot({
|
||||||
|
'attributes': ReadOnlyDict({
|
||||||
|
'device_class': 'temperature',
|
||||||
|
'friendly_name': 'Protection Valve Temperature',
|
||||||
|
'state_class': <SensorStateClass.MEASUREMENT: 'measurement'>,
|
||||||
|
'unit_of_measurement': <UnitOfTemperature.CELSIUS: '°C'>,
|
||||||
|
}),
|
||||||
|
'context': <ANY>,
|
||||||
|
'entity_id': 'sensor.protection_valve_temperature',
|
||||||
|
'last_changed': <ANY>,
|
||||||
|
'last_reported': <ANY>,
|
||||||
|
'last_updated': <ANY>,
|
||||||
|
'state': '-17.7777777777778',
|
||||||
|
})
|
||||||
|
# ---
|
||||||
|
# name: test_sensors[protection_valve][sensor.protection_valve_water_flow_rate-data]
|
||||||
|
StateSnapshot({
|
||||||
|
'attributes': ReadOnlyDict({
|
||||||
|
'device_class': 'volume_flow_rate',
|
||||||
|
'friendly_name': 'Protection Valve Water flow rate',
|
||||||
|
'state_class': <SensorStateClass.MEASUREMENT: 'measurement'>,
|
||||||
|
'unit_of_measurement': <UnitOfVolumeFlowRate.GALLONS_PER_MINUTE: 'gal/min'>,
|
||||||
|
}),
|
||||||
|
'context': <ANY>,
|
||||||
|
'entity_id': 'sensor.protection_valve_water_flow_rate',
|
||||||
|
'last_changed': <ANY>,
|
||||||
|
'last_reported': <ANY>,
|
||||||
|
'last_updated': <ANY>,
|
||||||
|
'state': '7.1',
|
||||||
|
})
|
||||||
|
# ---
|
||||||
|
# name: test_sensors[protection_valve][sensor.protection_valve_water_flow_rate-reset]
|
||||||
|
StateSnapshot({
|
||||||
|
'attributes': ReadOnlyDict({
|
||||||
|
'device_class': 'volume_flow_rate',
|
||||||
|
'friendly_name': 'Protection Valve Water flow rate',
|
||||||
|
'state_class': <SensorStateClass.MEASUREMENT: 'measurement'>,
|
||||||
|
'unit_of_measurement': <UnitOfVolumeFlowRate.GALLONS_PER_MINUTE: 'gal/min'>,
|
||||||
|
}),
|
||||||
|
'context': <ANY>,
|
||||||
|
'entity_id': 'sensor.protection_valve_water_flow_rate',
|
||||||
|
'last_changed': <ANY>,
|
||||||
|
'last_reported': <ANY>,
|
||||||
|
'last_updated': <ANY>,
|
||||||
|
'state': '0.0',
|
||||||
|
})
|
||||||
|
# ---
|
||||||
|
# name: test_sensors[pump_controller][sensor.pump_controller_current_water_pressure-data]
|
||||||
|
StateSnapshot({
|
||||||
|
'attributes': ReadOnlyDict({
|
||||||
|
'device_class': 'pressure',
|
||||||
|
'friendly_name': 'Pump Controller Current water pressure',
|
||||||
|
'state_class': <SensorStateClass.MEASUREMENT: 'measurement'>,
|
||||||
|
'unit_of_measurement': <UnitOfPressure.KPA: 'kPa'>,
|
||||||
|
}),
|
||||||
|
'context': <ANY>,
|
||||||
|
'entity_id': 'sensor.pump_controller_current_water_pressure',
|
||||||
|
'last_changed': <ANY>,
|
||||||
|
'last_reported': <ANY>,
|
||||||
|
'last_updated': <ANY>,
|
||||||
|
'state': '428.8538854',
|
||||||
|
})
|
||||||
|
# ---
|
||||||
|
# name: test_sensors[pump_controller][sensor.pump_controller_current_water_pressure-reset]
|
||||||
|
StateSnapshot({
|
||||||
|
'attributes': ReadOnlyDict({
|
||||||
|
'device_class': 'pressure',
|
||||||
|
'friendly_name': 'Pump Controller Current water pressure',
|
||||||
|
'state_class': <SensorStateClass.MEASUREMENT: 'measurement'>,
|
||||||
|
'unit_of_measurement': <UnitOfPressure.KPA: 'kPa'>,
|
||||||
|
}),
|
||||||
|
'context': <ANY>,
|
||||||
|
'entity_id': 'sensor.pump_controller_current_water_pressure',
|
||||||
|
'last_changed': <ANY>,
|
||||||
|
'last_reported': <ANY>,
|
||||||
|
'last_updated': <ANY>,
|
||||||
|
'state': '0.0',
|
||||||
|
})
|
||||||
|
# ---
|
||||||
|
# name: test_sensors[pump_controller][sensor.pump_controller_temperature-data]
|
||||||
|
StateSnapshot({
|
||||||
|
'attributes': ReadOnlyDict({
|
||||||
|
'device_class': 'temperature',
|
||||||
|
'friendly_name': 'Pump Controller Temperature',
|
||||||
|
'state_class': <SensorStateClass.MEASUREMENT: 'measurement'>,
|
||||||
|
'unit_of_measurement': <UnitOfTemperature.CELSIUS: '°C'>,
|
||||||
|
}),
|
||||||
|
'context': <ANY>,
|
||||||
|
'entity_id': 'sensor.pump_controller_temperature',
|
||||||
|
'last_changed': <ANY>,
|
||||||
|
'last_reported': <ANY>,
|
||||||
|
'last_updated': <ANY>,
|
||||||
|
'state': '20.4444444444444',
|
||||||
|
})
|
||||||
|
# ---
|
||||||
|
# name: test_sensors[pump_controller][sensor.pump_controller_temperature-reset]
|
||||||
|
StateSnapshot({
|
||||||
|
'attributes': ReadOnlyDict({
|
||||||
|
'device_class': 'temperature',
|
||||||
|
'friendly_name': 'Pump Controller Temperature',
|
||||||
|
'state_class': <SensorStateClass.MEASUREMENT: 'measurement'>,
|
||||||
|
'unit_of_measurement': <UnitOfTemperature.CELSIUS: '°C'>,
|
||||||
|
}),
|
||||||
|
'context': <ANY>,
|
||||||
|
'entity_id': 'sensor.pump_controller_temperature',
|
||||||
|
'last_changed': <ANY>,
|
||||||
|
'last_reported': <ANY>,
|
||||||
|
'last_updated': <ANY>,
|
||||||
|
'state': '-17.7777777777778',
|
||||||
|
})
|
||||||
|
# ---
|
||||||
|
# name: test_sensors[pump_controller][sensor.pump_controller_water_flow_rate-data]
|
||||||
|
StateSnapshot({
|
||||||
|
'attributes': ReadOnlyDict({
|
||||||
|
'device_class': 'volume_flow_rate',
|
||||||
|
'friendly_name': 'Pump Controller Water flow rate',
|
||||||
|
'state_class': <SensorStateClass.MEASUREMENT: 'measurement'>,
|
||||||
|
'unit_of_measurement': <UnitOfVolumeFlowRate.GALLONS_PER_MINUTE: 'gal/min'>,
|
||||||
|
}),
|
||||||
|
'context': <ANY>,
|
||||||
|
'entity_id': 'sensor.pump_controller_water_flow_rate',
|
||||||
|
'last_changed': <ANY>,
|
||||||
|
'last_reported': <ANY>,
|
||||||
|
'last_updated': <ANY>,
|
||||||
|
'state': '2.2',
|
||||||
|
})
|
||||||
|
# ---
|
||||||
|
# name: test_sensors[pump_controller][sensor.pump_controller_water_flow_rate-reset]
|
||||||
|
StateSnapshot({
|
||||||
|
'attributes': ReadOnlyDict({
|
||||||
|
'device_class': 'volume_flow_rate',
|
||||||
|
'friendly_name': 'Pump Controller Water flow rate',
|
||||||
|
'state_class': <SensorStateClass.MEASUREMENT: 'measurement'>,
|
||||||
|
'unit_of_measurement': <UnitOfVolumeFlowRate.GALLONS_PER_MINUTE: 'gal/min'>,
|
||||||
|
}),
|
||||||
|
'context': <ANY>,
|
||||||
|
'entity_id': 'sensor.pump_controller_water_flow_rate',
|
||||||
|
'last_changed': <ANY>,
|
||||||
|
'last_reported': <ANY>,
|
||||||
|
'last_updated': <ANY>,
|
||||||
|
'state': '0.0',
|
||||||
|
})
|
||||||
|
# ---
|
||||||
|
# name: test_sensors[ro_filter][sensor.ro_filter_cartridge_1_life_remaining-data]
|
||||||
|
StateSnapshot({
|
||||||
|
'attributes': ReadOnlyDict({
|
||||||
|
'friendly_name': 'RO Filter Cartridge 1 life remaining',
|
||||||
|
'state_class': <SensorStateClass.MEASUREMENT: 'measurement'>,
|
||||||
|
'unit_of_measurement': '%',
|
||||||
|
}),
|
||||||
|
'context': <ANY>,
|
||||||
|
'entity_id': 'sensor.ro_filter_cartridge_1_life_remaining',
|
||||||
|
'last_changed': <ANY>,
|
||||||
|
'last_reported': <ANY>,
|
||||||
|
'last_updated': <ANY>,
|
||||||
|
'state': '59',
|
||||||
|
})
|
||||||
|
# ---
|
||||||
|
# name: test_sensors[ro_filter][sensor.ro_filter_cartridge_1_life_remaining-reset]
|
||||||
|
StateSnapshot({
|
||||||
|
'attributes': ReadOnlyDict({
|
||||||
|
'friendly_name': 'RO Filter Cartridge 1 life remaining',
|
||||||
|
'state_class': <SensorStateClass.MEASUREMENT: 'measurement'>,
|
||||||
|
'unit_of_measurement': '%',
|
||||||
|
}),
|
||||||
|
'context': <ANY>,
|
||||||
|
'entity_id': 'sensor.ro_filter_cartridge_1_life_remaining',
|
||||||
|
'last_changed': <ANY>,
|
||||||
|
'last_reported': <ANY>,
|
||||||
|
'last_updated': <ANY>,
|
||||||
|
'state': '0',
|
||||||
|
})
|
||||||
|
# ---
|
||||||
|
# name: test_sensors[ro_filter][sensor.ro_filter_cartridge_2_life_remaining-data]
|
||||||
|
StateSnapshot({
|
||||||
|
'attributes': ReadOnlyDict({
|
||||||
|
'friendly_name': 'RO Filter Cartridge 2 life remaining',
|
||||||
|
'state_class': <SensorStateClass.MEASUREMENT: 'measurement'>,
|
||||||
|
'unit_of_measurement': '%',
|
||||||
|
}),
|
||||||
|
'context': <ANY>,
|
||||||
|
'entity_id': 'sensor.ro_filter_cartridge_2_life_remaining',
|
||||||
|
'last_changed': <ANY>,
|
||||||
|
'last_reported': <ANY>,
|
||||||
|
'last_updated': <ANY>,
|
||||||
|
'state': '80',
|
||||||
|
})
|
||||||
|
# ---
|
||||||
|
# name: test_sensors[ro_filter][sensor.ro_filter_cartridge_2_life_remaining-reset]
|
||||||
|
StateSnapshot({
|
||||||
|
'attributes': ReadOnlyDict({
|
||||||
|
'friendly_name': 'RO Filter Cartridge 2 life remaining',
|
||||||
|
'state_class': <SensorStateClass.MEASUREMENT: 'measurement'>,
|
||||||
|
'unit_of_measurement': '%',
|
||||||
|
}),
|
||||||
|
'context': <ANY>,
|
||||||
|
'entity_id': 'sensor.ro_filter_cartridge_2_life_remaining',
|
||||||
|
'last_changed': <ANY>,
|
||||||
|
'last_reported': <ANY>,
|
||||||
|
'last_updated': <ANY>,
|
||||||
|
'state': '0',
|
||||||
|
})
|
||||||
|
# ---
|
||||||
|
# name: test_sensors[ro_filter][sensor.ro_filter_cartridge_3_life_remaining-data]
|
||||||
|
StateSnapshot({
|
||||||
|
'attributes': ReadOnlyDict({
|
||||||
|
'friendly_name': 'RO Filter Cartridge 3 life remaining',
|
||||||
|
'state_class': <SensorStateClass.MEASUREMENT: 'measurement'>,
|
||||||
|
'unit_of_measurement': '%',
|
||||||
|
}),
|
||||||
|
'context': <ANY>,
|
||||||
|
'entity_id': 'sensor.ro_filter_cartridge_3_life_remaining',
|
||||||
|
'last_changed': <ANY>,
|
||||||
|
'last_reported': <ANY>,
|
||||||
|
'last_updated': <ANY>,
|
||||||
|
'state': '59',
|
||||||
|
})
|
||||||
|
# ---
|
||||||
|
# name: test_sensors[ro_filter][sensor.ro_filter_cartridge_3_life_remaining-reset]
|
||||||
|
StateSnapshot({
|
||||||
|
'attributes': ReadOnlyDict({
|
||||||
|
'friendly_name': 'RO Filter Cartridge 3 life remaining',
|
||||||
|
'state_class': <SensorStateClass.MEASUREMENT: 'measurement'>,
|
||||||
|
'unit_of_measurement': '%',
|
||||||
|
}),
|
||||||
|
'context': <ANY>,
|
||||||
|
'entity_id': 'sensor.ro_filter_cartridge_3_life_remaining',
|
||||||
|
'last_changed': <ANY>,
|
||||||
|
'last_reported': <ANY>,
|
||||||
|
'last_updated': <ANY>,
|
||||||
|
'state': '0',
|
||||||
|
})
|
||||||
|
# ---
|
||||||
|
# name: test_sensors[ro_filter][sensor.ro_filter_inlet_tds-data]
|
||||||
|
StateSnapshot({
|
||||||
|
'attributes': ReadOnlyDict({
|
||||||
|
'friendly_name': 'RO Filter Inlet TDS',
|
||||||
|
'state_class': <SensorStateClass.MEASUREMENT: 'measurement'>,
|
||||||
|
'unit_of_measurement': 'ppm',
|
||||||
|
}),
|
||||||
|
'context': <ANY>,
|
||||||
|
'entity_id': 'sensor.ro_filter_inlet_tds',
|
||||||
|
'last_changed': <ANY>,
|
||||||
|
'last_reported': <ANY>,
|
||||||
|
'last_updated': <ANY>,
|
||||||
|
'state': '164',
|
||||||
|
})
|
||||||
|
# ---
|
||||||
|
# name: test_sensors[ro_filter][sensor.ro_filter_inlet_tds-reset]
|
||||||
|
StateSnapshot({
|
||||||
|
'attributes': ReadOnlyDict({
|
||||||
|
'friendly_name': 'RO Filter Inlet TDS',
|
||||||
|
'state_class': <SensorStateClass.MEASUREMENT: 'measurement'>,
|
||||||
|
'unit_of_measurement': 'ppm',
|
||||||
|
}),
|
||||||
|
'context': <ANY>,
|
||||||
|
'entity_id': 'sensor.ro_filter_inlet_tds',
|
||||||
|
'last_changed': <ANY>,
|
||||||
|
'last_reported': <ANY>,
|
||||||
|
'last_updated': <ANY>,
|
||||||
|
'state': '0',
|
||||||
|
})
|
||||||
|
# ---
|
||||||
|
# name: test_sensors[ro_filter][sensor.ro_filter_outlet_tds-data]
|
||||||
|
StateSnapshot({
|
||||||
|
'attributes': ReadOnlyDict({
|
||||||
|
'friendly_name': 'RO Filter Outlet TDS',
|
||||||
|
'state_class': <SensorStateClass.MEASUREMENT: 'measurement'>,
|
||||||
|
'unit_of_measurement': 'ppm',
|
||||||
|
}),
|
||||||
|
'context': <ANY>,
|
||||||
|
'entity_id': 'sensor.ro_filter_outlet_tds',
|
||||||
|
'last_changed': <ANY>,
|
||||||
|
'last_reported': <ANY>,
|
||||||
|
'last_updated': <ANY>,
|
||||||
|
'state': '9',
|
||||||
|
})
|
||||||
|
# ---
|
||||||
|
# name: test_sensors[ro_filter][sensor.ro_filter_outlet_tds-reset]
|
||||||
|
StateSnapshot({
|
||||||
|
'attributes': ReadOnlyDict({
|
||||||
|
'friendly_name': 'RO Filter Outlet TDS',
|
||||||
|
'state_class': <SensorStateClass.MEASUREMENT: 'measurement'>,
|
||||||
|
'unit_of_measurement': 'ppm',
|
||||||
|
}),
|
||||||
|
'context': <ANY>,
|
||||||
|
'entity_id': 'sensor.ro_filter_outlet_tds',
|
||||||
|
'last_changed': <ANY>,
|
||||||
|
'last_reported': <ANY>,
|
||||||
|
'last_updated': <ANY>,
|
||||||
|
'state': '0',
|
||||||
|
})
|
||||||
|
# ---
|
||||||
|
# name: test_sensors[softener][sensor.softener_battery-data]
|
||||||
|
StateSnapshot({
|
||||||
|
'attributes': ReadOnlyDict({
|
||||||
|
'device_class': 'battery',
|
||||||
|
'friendly_name': 'Softener Battery',
|
||||||
|
'state_class': <SensorStateClass.MEASUREMENT: 'measurement'>,
|
||||||
|
'unit_of_measurement': '%',
|
||||||
|
}),
|
||||||
|
'context': <ANY>,
|
||||||
|
'entity_id': 'sensor.softener_battery',
|
||||||
|
'last_changed': <ANY>,
|
||||||
|
'last_reported': <ANY>,
|
||||||
|
'last_updated': <ANY>,
|
||||||
|
'state': '20',
|
||||||
|
})
|
||||||
|
# ---
|
||||||
|
# name: test_sensors[softener][sensor.softener_battery-reset]
|
||||||
|
StateSnapshot({
|
||||||
|
'attributes': ReadOnlyDict({
|
||||||
|
'device_class': 'battery',
|
||||||
|
'friendly_name': 'Softener Battery',
|
||||||
|
'state_class': <SensorStateClass.MEASUREMENT: 'measurement'>,
|
||||||
|
'unit_of_measurement': '%',
|
||||||
|
}),
|
||||||
|
'context': <ANY>,
|
||||||
|
'entity_id': 'sensor.softener_battery',
|
||||||
|
'last_changed': <ANY>,
|
||||||
|
'last_reported': <ANY>,
|
||||||
|
'last_updated': <ANY>,
|
||||||
|
'state': '0',
|
||||||
|
})
|
||||||
|
# ---
|
||||||
|
# name: test_sensors[softener][sensor.softener_capacity_remaining-data]
|
||||||
|
StateSnapshot({
|
||||||
|
'attributes': ReadOnlyDict({
|
||||||
|
'device_class': 'water',
|
||||||
|
'friendly_name': 'Softener Capacity remaining',
|
||||||
|
'state_class': <SensorStateClass.TOTAL: 'total'>,
|
||||||
|
'unit_of_measurement': <UnitOfVolume.LITERS: 'L'>,
|
||||||
|
}),
|
||||||
|
'context': <ANY>,
|
||||||
|
'entity_id': 'sensor.softener_capacity_remaining',
|
||||||
|
'last_changed': <ANY>,
|
||||||
|
'last_reported': <ANY>,
|
||||||
|
'last_updated': <ANY>,
|
||||||
|
'state': '3785.411784',
|
||||||
|
})
|
||||||
|
# ---
|
||||||
|
# name: test_sensors[softener][sensor.softener_capacity_remaining-reset]
|
||||||
|
StateSnapshot({
|
||||||
|
'attributes': ReadOnlyDict({
|
||||||
|
'device_class': 'water',
|
||||||
|
'friendly_name': 'Softener Capacity remaining',
|
||||||
|
'state_class': <SensorStateClass.TOTAL: 'total'>,
|
||||||
|
'unit_of_measurement': <UnitOfVolume.LITERS: 'L'>,
|
||||||
|
}),
|
||||||
|
'context': <ANY>,
|
||||||
|
'entity_id': 'sensor.softener_capacity_remaining',
|
||||||
|
'last_changed': <ANY>,
|
||||||
|
'last_reported': <ANY>,
|
||||||
|
'last_updated': <ANY>,
|
||||||
|
'state': '0.0',
|
||||||
|
})
|
||||||
|
# ---
|
||||||
|
# name: test_sensors[softener][sensor.softener_current_water_pressure-data]
|
||||||
|
StateSnapshot({
|
||||||
|
'attributes': ReadOnlyDict({
|
||||||
|
'device_class': 'pressure',
|
||||||
|
'friendly_name': 'Softener Current water pressure',
|
||||||
|
'state_class': <SensorStateClass.MEASUREMENT: 'measurement'>,
|
||||||
|
'unit_of_measurement': <UnitOfPressure.KPA: 'kPa'>,
|
||||||
|
}),
|
||||||
|
'context': <ANY>,
|
||||||
|
'entity_id': 'sensor.softener_current_water_pressure',
|
||||||
|
'last_changed': <ANY>,
|
||||||
|
'last_reported': <ANY>,
|
||||||
|
'last_updated': <ANY>,
|
||||||
|
'state': '348.1852285',
|
||||||
|
})
|
||||||
|
# ---
|
||||||
|
# name: test_sensors[softener][sensor.softener_current_water_pressure-reset]
|
||||||
|
StateSnapshot({
|
||||||
|
'attributes': ReadOnlyDict({
|
||||||
|
'device_class': 'pressure',
|
||||||
|
'friendly_name': 'Softener Current water pressure',
|
||||||
|
'state_class': <SensorStateClass.MEASUREMENT: 'measurement'>,
|
||||||
|
'unit_of_measurement': <UnitOfPressure.KPA: 'kPa'>,
|
||||||
|
}),
|
||||||
|
'context': <ANY>,
|
||||||
|
'entity_id': 'sensor.softener_current_water_pressure',
|
||||||
|
'last_changed': <ANY>,
|
||||||
|
'last_reported': <ANY>,
|
||||||
|
'last_updated': <ANY>,
|
||||||
|
'state': 'unknown',
|
||||||
|
})
|
||||||
|
# ---
|
||||||
|
# name: test_sensors[softener][sensor.softener_water_flow_rate-data]
|
||||||
|
StateSnapshot({
|
||||||
|
'attributes': ReadOnlyDict({
|
||||||
|
'device_class': 'volume_flow_rate',
|
||||||
|
'friendly_name': 'Softener Water flow rate',
|
||||||
|
'state_class': <SensorStateClass.MEASUREMENT: 'measurement'>,
|
||||||
|
'unit_of_measurement': <UnitOfVolumeFlowRate.GALLONS_PER_MINUTE: 'gal/min'>,
|
||||||
|
}),
|
||||||
|
'context': <ANY>,
|
||||||
|
'entity_id': 'sensor.softener_water_flow_rate',
|
||||||
|
'last_changed': <ANY>,
|
||||||
|
'last_reported': <ANY>,
|
||||||
|
'last_updated': <ANY>,
|
||||||
|
'state': '5.0',
|
||||||
|
})
|
||||||
|
# ---
|
||||||
|
# name: test_sensors[softener][sensor.softener_water_flow_rate-reset]
|
||||||
|
StateSnapshot({
|
||||||
|
'attributes': ReadOnlyDict({
|
||||||
|
'device_class': 'volume_flow_rate',
|
||||||
|
'friendly_name': 'Softener Water flow rate',
|
||||||
|
'state_class': <SensorStateClass.MEASUREMENT: 'measurement'>,
|
||||||
|
'unit_of_measurement': <UnitOfVolumeFlowRate.GALLONS_PER_MINUTE: 'gal/min'>,
|
||||||
|
}),
|
||||||
|
'context': <ANY>,
|
||||||
|
'entity_id': 'sensor.softener_water_flow_rate',
|
||||||
|
'last_changed': <ANY>,
|
||||||
|
'last_reported': <ANY>,
|
||||||
|
'last_updated': <ANY>,
|
||||||
|
'state': '0.0',
|
||||||
|
})
|
||||||
|
# ---
|
|
@ -1,7 +1,14 @@
|
||||||
"""Test DROP sensor entities."""
|
"""Test DROP sensor entities."""
|
||||||
|
|
||||||
from homeassistant.const import STATE_UNKNOWN
|
from collections.abc import Generator
|
||||||
|
from unittest.mock import patch
|
||||||
|
|
||||||
|
import pytest
|
||||||
|
from syrupy import SnapshotAssertion
|
||||||
|
|
||||||
|
from homeassistant.const import Platform
|
||||||
from homeassistant.core import HomeAssistant
|
from homeassistant.core import HomeAssistant
|
||||||
|
from homeassistant.helpers import entity_registry as er
|
||||||
|
|
||||||
from .common import (
|
from .common import (
|
||||||
TEST_DATA_FILTER,
|
TEST_DATA_FILTER,
|
||||||
|
@ -32,288 +39,92 @@ from .common import (
|
||||||
config_entry_pump_controller,
|
config_entry_pump_controller,
|
||||||
config_entry_ro_filter,
|
config_entry_ro_filter,
|
||||||
config_entry_softener,
|
config_entry_softener,
|
||||||
|
help_assert_entries,
|
||||||
)
|
)
|
||||||
|
|
||||||
from tests.common import async_fire_mqtt_message
|
from tests.common import MockConfigEntry, async_fire_mqtt_message
|
||||||
from tests.typing import MqttMockHAClient
|
from tests.typing import MqttMockHAClient
|
||||||
|
|
||||||
|
|
||||||
async def test_sensors_hub(hass: HomeAssistant, mqtt_mock: MqttMockHAClient) -> None:
|
@pytest.fixture(autouse=True)
|
||||||
"""Test DROP sensors for hubs."""
|
def only_sensor_platform() -> Generator[[], None]:
|
||||||
entry = config_entry_hub()
|
"""Only setup the DROP sensor platform."""
|
||||||
entry.add_to_hass(hass)
|
with patch("homeassistant.components.drop_connect.PLATFORMS", [Platform.SENSOR]):
|
||||||
assert await hass.config_entries.async_setup(entry.entry_id)
|
yield
|
||||||
|
|
||||||
current_flow_sensor_name = "sensor.hub_drop_1_c0ffee_water_flow_rate"
|
|
||||||
assert hass.states.get(current_flow_sensor_name).state == STATE_UNKNOWN
|
|
||||||
peak_flow_sensor_name = "sensor.hub_drop_1_c0ffee_peak_water_flow_rate_today"
|
|
||||||
assert hass.states.get(peak_flow_sensor_name).state == STATE_UNKNOWN
|
|
||||||
used_today_sensor_name = "sensor.hub_drop_1_c0ffee_total_water_used_today"
|
|
||||||
assert hass.states.get(used_today_sensor_name).state == STATE_UNKNOWN
|
|
||||||
average_usage_sensor_name = "sensor.hub_drop_1_c0ffee_average_daily_water_usage"
|
|
||||||
assert hass.states.get(average_usage_sensor_name).state == STATE_UNKNOWN
|
|
||||||
psi_sensor_name = "sensor.hub_drop_1_c0ffee_current_water_pressure"
|
|
||||||
assert hass.states.get(psi_sensor_name).state == STATE_UNKNOWN
|
|
||||||
psi_high_sensor_name = "sensor.hub_drop_1_c0ffee_high_water_pressure_today"
|
|
||||||
assert hass.states.get(psi_high_sensor_name).state == STATE_UNKNOWN
|
|
||||||
psi_low_sensor_name = "sensor.hub_drop_1_c0ffee_low_water_pressure_today"
|
|
||||||
assert hass.states.get(psi_low_sensor_name).state == STATE_UNKNOWN
|
|
||||||
battery_sensor_name = "sensor.hub_drop_1_c0ffee_battery"
|
|
||||||
assert hass.states.get(battery_sensor_name).state == STATE_UNKNOWN
|
|
||||||
|
|
||||||
async_fire_mqtt_message(hass, TEST_DATA_HUB_TOPIC, TEST_DATA_HUB_RESET)
|
|
||||||
await hass.async_block_till_done()
|
|
||||||
async_fire_mqtt_message(hass, TEST_DATA_HUB_TOPIC, TEST_DATA_HUB)
|
|
||||||
await hass.async_block_till_done()
|
|
||||||
|
|
||||||
current_flow_sensor = hass.states.get(current_flow_sensor_name)
|
|
||||||
assert current_flow_sensor
|
|
||||||
assert current_flow_sensor.state == "5.77"
|
|
||||||
|
|
||||||
peak_flow_sensor = hass.states.get(peak_flow_sensor_name)
|
|
||||||
assert peak_flow_sensor
|
|
||||||
assert peak_flow_sensor.state == "13.8"
|
|
||||||
|
|
||||||
used_today_sensor = hass.states.get(used_today_sensor_name)
|
|
||||||
assert used_today_sensor
|
|
||||||
assert used_today_sensor.state == "881.13030096168" # liters
|
|
||||||
|
|
||||||
average_usage_sensor = hass.states.get(average_usage_sensor_name)
|
|
||||||
assert average_usage_sensor
|
|
||||||
assert average_usage_sensor.state == "287.691295584" # liters
|
|
||||||
|
|
||||||
psi_sensor = hass.states.get(psi_sensor_name)
|
|
||||||
assert psi_sensor
|
|
||||||
assert psi_sensor.state == "428.8538854" # centibars
|
|
||||||
|
|
||||||
psi_high_sensor = hass.states.get(psi_high_sensor_name)
|
|
||||||
assert psi_high_sensor
|
|
||||||
assert psi_high_sensor.state == "427.474934" # centibars
|
|
||||||
|
|
||||||
psi_low_sensor = hass.states.get(psi_low_sensor_name)
|
|
||||||
assert psi_low_sensor
|
|
||||||
assert psi_low_sensor.state == "420.580177" # centibars
|
|
||||||
|
|
||||||
battery_sensor = hass.states.get(battery_sensor_name)
|
|
||||||
assert battery_sensor
|
|
||||||
assert battery_sensor.state == "50"
|
|
||||||
|
|
||||||
|
|
||||||
async def test_sensors_leak(hass: HomeAssistant, mqtt_mock: MqttMockHAClient) -> None:
|
@pytest.mark.parametrize(
|
||||||
"""Test DROP sensors for leak detectors."""
|
("config_entry", "topic", "reset", "data"),
|
||||||
entry = config_entry_leak()
|
[
|
||||||
entry.add_to_hass(hass)
|
(config_entry_hub(), TEST_DATA_HUB_TOPIC, TEST_DATA_HUB_RESET, TEST_DATA_HUB),
|
||||||
assert await hass.config_entries.async_setup(entry.entry_id)
|
(
|
||||||
|
config_entry_leak(),
|
||||||
battery_sensor_name = "sensor.leak_detector_battery"
|
TEST_DATA_LEAK_TOPIC,
|
||||||
assert hass.states.get(battery_sensor_name).state == STATE_UNKNOWN
|
TEST_DATA_LEAK_RESET,
|
||||||
temp_sensor_name = "sensor.leak_detector_temperature"
|
TEST_DATA_LEAK,
|
||||||
assert hass.states.get(temp_sensor_name).state == STATE_UNKNOWN
|
),
|
||||||
|
(
|
||||||
async_fire_mqtt_message(hass, TEST_DATA_LEAK_TOPIC, TEST_DATA_LEAK_RESET)
|
config_entry_softener(),
|
||||||
await hass.async_block_till_done()
|
TEST_DATA_SOFTENER_TOPIC,
|
||||||
async_fire_mqtt_message(hass, TEST_DATA_LEAK_TOPIC, TEST_DATA_LEAK)
|
TEST_DATA_SOFTENER_RESET,
|
||||||
await hass.async_block_till_done()
|
TEST_DATA_SOFTENER,
|
||||||
|
),
|
||||||
battery_sensor = hass.states.get(battery_sensor_name)
|
(
|
||||||
assert battery_sensor
|
config_entry_filter(),
|
||||||
assert battery_sensor.state == "100"
|
TEST_DATA_FILTER_TOPIC,
|
||||||
|
TEST_DATA_FILTER_RESET,
|
||||||
temp_sensor = hass.states.get(temp_sensor_name)
|
TEST_DATA_FILTER,
|
||||||
assert temp_sensor
|
),
|
||||||
assert temp_sensor.state == "20.1111111111111" # °C
|
(
|
||||||
|
config_entry_protection_valve(),
|
||||||
|
TEST_DATA_PROTECTION_VALVE_TOPIC,
|
||||||
async def test_sensors_softener(
|
TEST_DATA_PROTECTION_VALVE_RESET,
|
||||||
hass: HomeAssistant, mqtt_mock: MqttMockHAClient
|
TEST_DATA_PROTECTION_VALVE,
|
||||||
|
),
|
||||||
|
(
|
||||||
|
config_entry_pump_controller(),
|
||||||
|
TEST_DATA_PUMP_CONTROLLER_TOPIC,
|
||||||
|
TEST_DATA_PUMP_CONTROLLER_RESET,
|
||||||
|
TEST_DATA_PUMP_CONTROLLER,
|
||||||
|
),
|
||||||
|
(
|
||||||
|
config_entry_ro_filter(),
|
||||||
|
TEST_DATA_RO_FILTER_TOPIC,
|
||||||
|
TEST_DATA_RO_FILTER_RESET,
|
||||||
|
TEST_DATA_RO_FILTER,
|
||||||
|
),
|
||||||
|
],
|
||||||
|
ids=[
|
||||||
|
"hub",
|
||||||
|
"leak",
|
||||||
|
"softener",
|
||||||
|
"filter",
|
||||||
|
"protection_valve",
|
||||||
|
"pump_controller",
|
||||||
|
"ro_filter",
|
||||||
|
],
|
||||||
|
)
|
||||||
|
async def test_sensors(
|
||||||
|
hass: HomeAssistant,
|
||||||
|
mqtt_mock: MqttMockHAClient,
|
||||||
|
entity_registry: er.EntityRegistry,
|
||||||
|
snapshot: SnapshotAssertion,
|
||||||
|
config_entry: MockConfigEntry,
|
||||||
|
topic: str,
|
||||||
|
reset: str,
|
||||||
|
data: str,
|
||||||
) -> None:
|
) -> None:
|
||||||
"""Test DROP sensors for softeners."""
|
"""Test DROP sensors."""
|
||||||
entry = config_entry_softener()
|
config_entry.add_to_hass(hass)
|
||||||
entry.add_to_hass(hass)
|
|
||||||
assert await hass.config_entries.async_setup(entry.entry_id)
|
|
||||||
|
|
||||||
battery_sensor_name = "sensor.softener_battery"
|
assert await hass.config_entries.async_setup(config_entry.entry_id)
|
||||||
assert hass.states.get(battery_sensor_name).state == STATE_UNKNOWN
|
|
||||||
current_flow_sensor_name = "sensor.softener_water_flow_rate"
|
|
||||||
assert hass.states.get(current_flow_sensor_name).state == STATE_UNKNOWN
|
|
||||||
psi_sensor_name = "sensor.softener_current_water_pressure"
|
|
||||||
assert hass.states.get(psi_sensor_name).state == STATE_UNKNOWN
|
|
||||||
capacity_sensor_name = "sensor.softener_capacity_remaining"
|
|
||||||
assert hass.states.get(capacity_sensor_name).state == STATE_UNKNOWN
|
|
||||||
|
|
||||||
async_fire_mqtt_message(hass, TEST_DATA_SOFTENER_TOPIC, TEST_DATA_SOFTENER_RESET)
|
|
||||||
await hass.async_block_till_done()
|
await hass.async_block_till_done()
|
||||||
async_fire_mqtt_message(hass, TEST_DATA_SOFTENER_TOPIC, TEST_DATA_SOFTENER)
|
help_assert_entries(hass, entity_registry, snapshot, config_entry, "init", True)
|
||||||
|
|
||||||
|
async_fire_mqtt_message(hass, topic, reset)
|
||||||
await hass.async_block_till_done()
|
await hass.async_block_till_done()
|
||||||
|
help_assert_entries(hass, entity_registry, snapshot, config_entry, "reset")
|
||||||
|
|
||||||
battery_sensor = hass.states.get(battery_sensor_name)
|
async_fire_mqtt_message(hass, topic, data)
|
||||||
assert battery_sensor
|
|
||||||
assert battery_sensor.state == "20"
|
|
||||||
|
|
||||||
current_flow_sensor = hass.states.get(current_flow_sensor_name)
|
|
||||||
assert current_flow_sensor
|
|
||||||
assert current_flow_sensor.state == "5.0"
|
|
||||||
|
|
||||||
psi_sensor = hass.states.get(psi_sensor_name)
|
|
||||||
assert psi_sensor
|
|
||||||
assert psi_sensor.state == "348.1852285" # centibars
|
|
||||||
|
|
||||||
capacity_sensor = hass.states.get(capacity_sensor_name)
|
|
||||||
assert capacity_sensor
|
|
||||||
assert capacity_sensor.state == "3785.411784" # liters
|
|
||||||
|
|
||||||
|
|
||||||
async def test_sensors_filter(hass: HomeAssistant, mqtt_mock: MqttMockHAClient) -> None:
|
|
||||||
"""Test DROP sensors for filters."""
|
|
||||||
entry = config_entry_filter()
|
|
||||||
entry.add_to_hass(hass)
|
|
||||||
assert await hass.config_entries.async_setup(entry.entry_id)
|
|
||||||
|
|
||||||
battery_sensor_name = "sensor.filter_battery"
|
|
||||||
assert hass.states.get(battery_sensor_name).state == STATE_UNKNOWN
|
|
||||||
current_flow_sensor_name = "sensor.filter_water_flow_rate"
|
|
||||||
assert hass.states.get(current_flow_sensor_name).state == STATE_UNKNOWN
|
|
||||||
psi_sensor_name = "sensor.filter_current_water_pressure"
|
|
||||||
assert hass.states.get(psi_sensor_name).state == STATE_UNKNOWN
|
|
||||||
|
|
||||||
async_fire_mqtt_message(hass, TEST_DATA_FILTER_TOPIC, TEST_DATA_FILTER_RESET)
|
|
||||||
await hass.async_block_till_done()
|
await hass.async_block_till_done()
|
||||||
async_fire_mqtt_message(hass, TEST_DATA_FILTER_TOPIC, TEST_DATA_FILTER)
|
help_assert_entries(hass, entity_registry, snapshot, config_entry, "data")
|
||||||
await hass.async_block_till_done()
|
|
||||||
|
|
||||||
battery_sensor = hass.states.get(battery_sensor_name)
|
|
||||||
assert battery_sensor
|
|
||||||
assert battery_sensor.state == "12"
|
|
||||||
|
|
||||||
current_flow_sensor = hass.states.get(current_flow_sensor_name)
|
|
||||||
assert current_flow_sensor
|
|
||||||
assert current_flow_sensor.state == "19.84"
|
|
||||||
|
|
||||||
psi_sensor = hass.states.get(psi_sensor_name)
|
|
||||||
assert psi_sensor
|
|
||||||
assert psi_sensor.state == "263.3797174" # centibars
|
|
||||||
|
|
||||||
|
|
||||||
async def test_sensors_protection_valve(
|
|
||||||
hass: HomeAssistant, mqtt_mock: MqttMockHAClient
|
|
||||||
) -> None:
|
|
||||||
"""Test DROP sensors for protection valves."""
|
|
||||||
entry = config_entry_protection_valve()
|
|
||||||
entry.add_to_hass(hass)
|
|
||||||
assert await hass.config_entries.async_setup(entry.entry_id)
|
|
||||||
|
|
||||||
battery_sensor_name = "sensor.protection_valve_battery"
|
|
||||||
assert hass.states.get(battery_sensor_name).state == STATE_UNKNOWN
|
|
||||||
current_flow_sensor_name = "sensor.protection_valve_water_flow_rate"
|
|
||||||
assert hass.states.get(current_flow_sensor_name).state == STATE_UNKNOWN
|
|
||||||
psi_sensor_name = "sensor.protection_valve_current_water_pressure"
|
|
||||||
assert hass.states.get(psi_sensor_name).state == STATE_UNKNOWN
|
|
||||||
temp_sensor_name = "sensor.protection_valve_temperature"
|
|
||||||
assert hass.states.get(temp_sensor_name).state == STATE_UNKNOWN
|
|
||||||
|
|
||||||
async_fire_mqtt_message(
|
|
||||||
hass, TEST_DATA_PROTECTION_VALVE_TOPIC, TEST_DATA_PROTECTION_VALVE_RESET
|
|
||||||
)
|
|
||||||
await hass.async_block_till_done()
|
|
||||||
async_fire_mqtt_message(
|
|
||||||
hass, TEST_DATA_PROTECTION_VALVE_TOPIC, TEST_DATA_PROTECTION_VALVE
|
|
||||||
)
|
|
||||||
await hass.async_block_till_done()
|
|
||||||
|
|
||||||
battery_sensor = hass.states.get(battery_sensor_name)
|
|
||||||
assert battery_sensor
|
|
||||||
assert battery_sensor.state == "0"
|
|
||||||
|
|
||||||
current_flow_sensor = hass.states.get(current_flow_sensor_name)
|
|
||||||
assert current_flow_sensor
|
|
||||||
assert current_flow_sensor.state == "7.1"
|
|
||||||
|
|
||||||
psi_sensor = hass.states.get(psi_sensor_name)
|
|
||||||
assert psi_sensor
|
|
||||||
assert psi_sensor.state == "422.6486041" # centibars
|
|
||||||
|
|
||||||
temp_sensor = hass.states.get(temp_sensor_name)
|
|
||||||
assert temp_sensor
|
|
||||||
assert temp_sensor.state == "21.3888888888889" # °C
|
|
||||||
|
|
||||||
|
|
||||||
async def test_sensors_pump_controller(
|
|
||||||
hass: HomeAssistant, mqtt_mock: MqttMockHAClient
|
|
||||||
) -> None:
|
|
||||||
"""Test DROP sensors for pump controllers."""
|
|
||||||
entry = config_entry_pump_controller()
|
|
||||||
entry.add_to_hass(hass)
|
|
||||||
assert await hass.config_entries.async_setup(entry.entry_id)
|
|
||||||
|
|
||||||
current_flow_sensor_name = "sensor.pump_controller_water_flow_rate"
|
|
||||||
assert hass.states.get(current_flow_sensor_name).state == STATE_UNKNOWN
|
|
||||||
psi_sensor_name = "sensor.pump_controller_current_water_pressure"
|
|
||||||
assert hass.states.get(psi_sensor_name).state == STATE_UNKNOWN
|
|
||||||
temp_sensor_name = "sensor.pump_controller_temperature"
|
|
||||||
assert hass.states.get(temp_sensor_name).state == STATE_UNKNOWN
|
|
||||||
|
|
||||||
async_fire_mqtt_message(
|
|
||||||
hass, TEST_DATA_PUMP_CONTROLLER_TOPIC, TEST_DATA_PUMP_CONTROLLER_RESET
|
|
||||||
)
|
|
||||||
await hass.async_block_till_done()
|
|
||||||
async_fire_mqtt_message(
|
|
||||||
hass, TEST_DATA_PUMP_CONTROLLER_TOPIC, TEST_DATA_PUMP_CONTROLLER
|
|
||||||
)
|
|
||||||
await hass.async_block_till_done()
|
|
||||||
|
|
||||||
current_flow_sensor = hass.states.get(current_flow_sensor_name)
|
|
||||||
assert current_flow_sensor
|
|
||||||
assert current_flow_sensor.state == "2.2"
|
|
||||||
|
|
||||||
psi_sensor = hass.states.get(psi_sensor_name)
|
|
||||||
assert psi_sensor
|
|
||||||
assert psi_sensor.state == "428.8538854" # centibars
|
|
||||||
|
|
||||||
temp_sensor = hass.states.get(temp_sensor_name)
|
|
||||||
assert temp_sensor
|
|
||||||
assert temp_sensor.state == "20.4444444444444" # °C
|
|
||||||
|
|
||||||
|
|
||||||
async def test_sensors_ro_filter(
|
|
||||||
hass: HomeAssistant, mqtt_mock: MqttMockHAClient
|
|
||||||
) -> None:
|
|
||||||
"""Test DROP sensors for RO filters."""
|
|
||||||
entry = config_entry_ro_filter()
|
|
||||||
entry.add_to_hass(hass)
|
|
||||||
assert await hass.config_entries.async_setup(entry.entry_id)
|
|
||||||
|
|
||||||
tds_in_sensor_name = "sensor.ro_filter_inlet_tds"
|
|
||||||
assert hass.states.get(tds_in_sensor_name).state == STATE_UNKNOWN
|
|
||||||
tds_out_sensor_name = "sensor.ro_filter_outlet_tds"
|
|
||||||
assert hass.states.get(tds_out_sensor_name).state == STATE_UNKNOWN
|
|
||||||
cart1_sensor_name = "sensor.ro_filter_cartridge_1_life_remaining"
|
|
||||||
assert hass.states.get(cart1_sensor_name).state == STATE_UNKNOWN
|
|
||||||
cart2_sensor_name = "sensor.ro_filter_cartridge_2_life_remaining"
|
|
||||||
assert hass.states.get(cart2_sensor_name).state == STATE_UNKNOWN
|
|
||||||
cart3_sensor_name = "sensor.ro_filter_cartridge_3_life_remaining"
|
|
||||||
assert hass.states.get(cart3_sensor_name).state == STATE_UNKNOWN
|
|
||||||
|
|
||||||
async_fire_mqtt_message(hass, TEST_DATA_RO_FILTER_TOPIC, TEST_DATA_RO_FILTER_RESET)
|
|
||||||
await hass.async_block_till_done()
|
|
||||||
async_fire_mqtt_message(hass, TEST_DATA_RO_FILTER_TOPIC, TEST_DATA_RO_FILTER)
|
|
||||||
await hass.async_block_till_done()
|
|
||||||
|
|
||||||
tds_in_sensor = hass.states.get(tds_in_sensor_name)
|
|
||||||
assert tds_in_sensor
|
|
||||||
assert tds_in_sensor.state == "164"
|
|
||||||
|
|
||||||
tds_out_sensor = hass.states.get(tds_out_sensor_name)
|
|
||||||
assert tds_out_sensor
|
|
||||||
assert tds_out_sensor.state == "9"
|
|
||||||
|
|
||||||
cart1_sensor = hass.states.get(cart1_sensor_name)
|
|
||||||
assert cart1_sensor
|
|
||||||
assert cart1_sensor.state == "59"
|
|
||||||
|
|
||||||
cart2_sensor = hass.states.get(cart2_sensor_name)
|
|
||||||
assert cart2_sensor
|
|
||||||
assert cart2_sensor.state == "80"
|
|
||||||
|
|
||||||
cart3_sensor = hass.states.get(cart3_sensor_name)
|
|
||||||
assert cart3_sensor
|
|
||||||
assert cart3_sensor.state == "59"
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue