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[
|
||||
dict[WasteType, date | None]
|
||||
dict[WasteType, list[date]]
|
||||
] = DataUpdateCoordinator(
|
||||
hass,
|
||||
LOGGER,
|
||||
|
|
|
@ -17,6 +17,6 @@ async def async_get_config_entry_diagnostics(
|
|||
"""Return diagnostics for a config entry."""
|
||||
coordinator: DataUpdateCoordinator = hass.data[DOMAIN][entry.data[CONF_ID]]
|
||||
return {
|
||||
waste_type: waste_date.isoformat() if waste_date else None
|
||||
for waste_type, waste_date in coordinator.data.items()
|
||||
waste_type: [waste_date.isoformat() for waste_date in waste_dates]
|
||||
for waste_type, waste_dates in coordinator.data.items()
|
||||
}
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
"name": "Twente Milieu",
|
||||
"config_flow": true,
|
||||
"documentation": "https://www.home-assistant.io/integrations/twentemilieu",
|
||||
"requirements": ["twentemilieu==0.5.0"],
|
||||
"requirements": ["twentemilieu==0.6.0"],
|
||||
"codeowners": ["@frenck"],
|
||||
"quality_scale": "platinum",
|
||||
"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."""
|
||||
|
||||
entity_description: TwenteMilieuSensorDescription
|
||||
coordinator: DataUpdateCoordinator[dict[WasteType, date | None]]
|
||||
|
||||
def __init__(
|
||||
self,
|
||||
|
@ -117,4 +116,6 @@ class TwenteMilieuSensor(CoordinatorEntity, SensorEntity):
|
|||
@property
|
||||
def native_value(self) -> date | None:
|
||||
"""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
|
||||
|
||||
# homeassistant.components.twentemilieu
|
||||
twentemilieu==0.5.0
|
||||
twentemilieu==0.6.0
|
||||
|
||||
# homeassistant.components.twilio
|
||||
twilio==6.32.0
|
||||
|
|
|
@ -1468,7 +1468,7 @@ ttls==1.4.3
|
|||
tuya-iot-py-sdk==0.6.6
|
||||
|
||||
# homeassistant.components.twentemilieu
|
||||
twentemilieu==0.5.0
|
||||
twentemilieu==0.6.0
|
||||
|
||||
# homeassistant.components.twilio
|
||||
twilio==6.32.0
|
||||
|
|
|
@ -65,11 +65,11 @@ def mock_twentemilieu() -> Generator[None, MagicMock, None]:
|
|||
twentemilieu = twentemilieu_mock.return_value
|
||||
twentemilieu.unique_id.return_value = 12345
|
||||
twentemilieu.update.return_value = {
|
||||
WasteType.NON_RECYCLABLE: date(2021, 11, 1),
|
||||
WasteType.ORGANIC: date(2021, 11, 2),
|
||||
WasteType.PACKAGES: date(2021, 11, 3),
|
||||
WasteType.PAPER: None,
|
||||
WasteType.TREE: date(2022, 1, 6),
|
||||
WasteType.NON_RECYCLABLE: [date(2021, 11, 1), date(2021, 12, 1)],
|
||||
WasteType.ORGANIC: [date(2021, 11, 2)],
|
||||
WasteType.PACKAGES: [date(2021, 11, 3)],
|
||||
WasteType.PAPER: [],
|
||||
WasteType.TREE: [date(2022, 1, 6)],
|
||||
}
|
||||
yield twentemilieu
|
||||
|
||||
|
|
|
@ -16,9 +16,9 @@ async def test_diagnostics(
|
|||
assert await get_diagnostics_for_config_entry(
|
||||
hass, hass_client, init_integration
|
||||
) == {
|
||||
"0": "2021-11-01",
|
||||
"1": "2021-11-02",
|
||||
"2": None,
|
||||
"6": "2022-01-06",
|
||||
"10": "2021-11-03",
|
||||
"0": ["2021-11-01", "2021-12-01"],
|
||||
"1": ["2021-11-02"],
|
||||
"2": [],
|
||||
"6": ["2022-01-06"],
|
||||
"10": ["2021-11-03"],
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue