Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion homeassistant/components/recollect_waste/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"config_flow": true,
"documentation": "https://www.home-assistant.io/integrations/recollect_waste",
"requirements": [
"aiorecollect==1.0.1"
"aiorecollect==1.0.4"
],
"codeowners": [
"@bachya"
Expand Down
24 changes: 14 additions & 10 deletions homeassistant/components/recollect_waste/sensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,19 @@

from homeassistant.components.sensor import PLATFORM_SCHEMA, SensorEntity
from homeassistant.config_entries import SOURCE_IMPORT, ConfigEntry
from homeassistant.const import ATTR_ATTRIBUTION, CONF_FRIENDLY_NAME, CONF_NAME
from homeassistant.const import (
ATTR_ATTRIBUTION,
CONF_FRIENDLY_NAME,
CONF_NAME,
DEVICE_CLASS_TIMESTAMP,
)
from homeassistant.core import HomeAssistant, callback
from homeassistant.helpers import config_validation as cv
from homeassistant.helpers.update_coordinator import (
CoordinatorEntity,
DataUpdateCoordinator,
)
from homeassistant.util.dt import as_utc

from .const import CONF_PLACE_ID, CONF_SERVICE_ID, DATA_COORDINATOR, DOMAIN, LOGGER

Expand All @@ -25,7 +31,6 @@

DEFAULT_ATTRIBUTION = "Pickup data provided by ReCollect Waste"
DEFAULT_NAME = "recollect_waste"
DEFAULT_ICON = "mdi:trash-can-outline"

PLATFORM_SCHEMA = PLATFORM_SCHEMA.extend(
{
Expand Down Expand Up @@ -87,16 +92,16 @@ def __init__(self, coordinator: DataUpdateCoordinator, entry: ConfigEntry) -> No
self._entry = entry
self._state = None

@property
def device_class(self) -> dict:
"""Return the device class."""
return DEVICE_CLASS_TIMESTAMP
Comment thread
bachya marked this conversation as resolved.

@property
def extra_state_attributes(self) -> dict:
"""Return the state attributes."""
return self._attributes

@property
def icon(self) -> str:
"""Icon to use in the frontend."""
return DEFAULT_ICON

@property
def name(self) -> str:
"""Return the name of the sensor."""
Expand Down Expand Up @@ -128,9 +133,8 @@ def update_from_latest_data(self) -> None:
"""Update the state."""
pickup_event = self.coordinator.data[0]
next_pickup_event = self.coordinator.data[1]
next_date = str(next_pickup_event.date)

self._state = pickup_event.date
self._state = as_utc(pickup_event.date).isoformat()
self._attributes.update(
{
ATTR_PICKUP_TYPES: async_get_pickup_type_names(
Expand All @@ -140,6 +144,6 @@ def update_from_latest_data(self) -> None:
ATTR_NEXT_PICKUP_TYPES: async_get_pickup_type_names(
self._entry, next_pickup_event.pickup_types
),
ATTR_NEXT_PICKUP_DATE: next_date,
ATTR_NEXT_PICKUP_DATE: as_utc(next_pickup_event.date).isoformat(),
}
)
2 changes: 1 addition & 1 deletion requirements_all.txt
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,7 @@ aiopvpc==2.0.2
aiopylgtv==0.4.0

# homeassistant.components.recollect_waste
aiorecollect==1.0.1
aiorecollect==1.0.4

# homeassistant.components.shelly
aioshelly==0.6.2
Expand Down
2 changes: 1 addition & 1 deletion requirements_test_all.txt
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ aiopvpc==2.0.2
aiopylgtv==0.4.0

# homeassistant.components.recollect_waste
aiorecollect==1.0.1
aiorecollect==1.0.4

# homeassistant.components.shelly
aioshelly==0.6.2
Expand Down