Update twentemilieu to 0.6.0 (#68171)
This commit is contained in:
parent
fabcdf7498
commit
f7cb10e2f5
8 changed files with 20 additions and 19 deletions
|
@ -34,7 +34,7 @@ async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:
|
||||||
)
|
)
|
||||||
|
|
||||||
coordinator: DataUpdateCoordinator[
|
coordinator: DataUpdateCoordinator[
|
||||||
dict[WasteType, date | None]
|
dict[WasteType, list[date]]
|
||||||
] = DataUpdateCoordinator(
|
] = DataUpdateCoordinator(
|
||||||
hass,
|
hass,
|
||||||
LOGGER,
|
LOGGER,
|
||||||
|
|
|
@ -17,6 +17,6 @@ async def async_get_config_entry_diagnostics(
|
||||||
"""Return diagnostics for a config entry."""
|
"""Return diagnostics for a config entry."""
|
||||||
coordinator: DataUpdateCoordinator = hass.data[DOMAIN][entry.data[CONF_ID]]
|
coordinator: DataUpdateCoordinator = hass.data[DOMAIN][entry.data[CONF_ID]]
|
||||||
return {
|
return {
|
||||||
waste_type: waste_date.isoformat() if waste_date else None
|
waste_type: [waste_date.isoformat() for waste_date in waste_dates]
|
||||||
for waste_type, waste_date in coordinator.data.items()
|
for waste_type, waste_dates in coordinator.data.items()
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
"name": "Twente Milieu",
|
"name": "Twente Milieu",
|
||||||
"config_flow": true,
|
"config_flow": true,
|
||||||
"documentation": "https://www.home-assistant.io/integrations/twentemilieu",
|
"documentation": "https://www.home-assistant.io/integrations/twentemilieu",
|
||||||
"requirements": ["twentemilieu==0.5.0"],
|
"requirements": ["twentemilieu==0.6.0"],
|
||||||
"codeowners": ["@frenck"],
|
"codeowners": ["@frenck"],
|
||||||
"quality_scale": "platinum",
|
"quality_scale": "platinum",
|
||||||
"iot_class": "cloud_polling",
|
"iot_class": "cloud_polling",
|
||||||
|
|
|
@ -90,11 +90,10 @@ async def async_setup_entry(
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
class TwenteMilieuSensor(CoordinatorEntity, SensorEntity):
|
class TwenteMilieuSensor(CoordinatorEntity[dict[WasteType, list[date]]], SensorEntity):
|
||||||
"""Defines a Twente Milieu sensor."""
|
"""Defines a Twente Milieu sensor."""
|
||||||
|
|
||||||
entity_description: TwenteMilieuSensorDescription
|
entity_description: TwenteMilieuSensorDescription
|
||||||
coordinator: DataUpdateCoordinator[dict[WasteType, date | None]]
|
|
||||||
|
|
||||||
def __init__(
|
def __init__(
|
||||||
self,
|
self,
|
||||||
|
@ -117,4 +116,6 @@ class TwenteMilieuSensor(CoordinatorEntity, SensorEntity):
|
||||||
@property
|
@property
|
||||||
def native_value(self) -> date | None:
|
def native_value(self) -> date | None:
|
||||||
"""Return the state of the sensor."""
|
"""Return the state of the sensor."""
|
||||||
return self.coordinator.data.get(self.entity_description.waste_type)
|
if not (dates := self.coordinator.data[self.entity_description.waste_type]):
|
||||||
|
return None
|
||||||
|
return dates[0]
|
||||||
|
|
|
@ -2315,7 +2315,7 @@ ttls==1.4.3
|
||||||
tuya-iot-py-sdk==0.6.6
|
tuya-iot-py-sdk==0.6.6
|
||||||
|
|
||||||
# homeassistant.components.twentemilieu
|
# homeassistant.components.twentemilieu
|
||||||
twentemilieu==0.5.0
|
twentemilieu==0.6.0
|
||||||
|
|
||||||
# homeassistant.components.twilio
|
# homeassistant.components.twilio
|
||||||
twilio==6.32.0
|
twilio==6.32.0
|
||||||
|
|
|
@ -1468,7 +1468,7 @@ ttls==1.4.3
|
||||||
tuya-iot-py-sdk==0.6.6
|
tuya-iot-py-sdk==0.6.6
|
||||||
|
|
||||||
# homeassistant.components.twentemilieu
|
# homeassistant.components.twentemilieu
|
||||||
twentemilieu==0.5.0
|
twentemilieu==0.6.0
|
||||||
|
|
||||||
# homeassistant.components.twilio
|
# homeassistant.components.twilio
|
||||||
twilio==6.32.0
|
twilio==6.32.0
|
||||||
|
|
|
@ -65,11 +65,11 @@ def mock_twentemilieu() -> Generator[None, MagicMock, None]:
|
||||||
twentemilieu = twentemilieu_mock.return_value
|
twentemilieu = twentemilieu_mock.return_value
|
||||||
twentemilieu.unique_id.return_value = 12345
|
twentemilieu.unique_id.return_value = 12345
|
||||||
twentemilieu.update.return_value = {
|
twentemilieu.update.return_value = {
|
||||||
WasteType.NON_RECYCLABLE: date(2021, 11, 1),
|
WasteType.NON_RECYCLABLE: [date(2021, 11, 1), date(2021, 12, 1)],
|
||||||
WasteType.ORGANIC: date(2021, 11, 2),
|
WasteType.ORGANIC: [date(2021, 11, 2)],
|
||||||
WasteType.PACKAGES: date(2021, 11, 3),
|
WasteType.PACKAGES: [date(2021, 11, 3)],
|
||||||
WasteType.PAPER: None,
|
WasteType.PAPER: [],
|
||||||
WasteType.TREE: date(2022, 1, 6),
|
WasteType.TREE: [date(2022, 1, 6)],
|
||||||
}
|
}
|
||||||
yield twentemilieu
|
yield twentemilieu
|
||||||
|
|
||||||
|
|
|
@ -16,9 +16,9 @@ async def test_diagnostics(
|
||||||
assert await get_diagnostics_for_config_entry(
|
assert await get_diagnostics_for_config_entry(
|
||||||
hass, hass_client, init_integration
|
hass, hass_client, init_integration
|
||||||
) == {
|
) == {
|
||||||
"0": "2021-11-01",
|
"0": ["2021-11-01", "2021-12-01"],
|
||||||
"1": "2021-11-02",
|
"1": ["2021-11-02"],
|
||||||
"2": None,
|
"2": [],
|
||||||
"6": "2022-01-06",
|
"6": ["2022-01-06"],
|
||||||
"10": "2021-11-03",
|
"10": ["2021-11-03"],
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue