Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Version 2.0.7 #55

Merged
merged 12 commits into from
Mar 26, 2024
27 changes: 22 additions & 5 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,27 @@
# Changelog for Affaldshåndtering DK Home Assistant Integration

## Version 2.0.7

**Date**: `2024-03-xx`

## What's Changed

**NOTE**: A new category 'plast' has been added, so you will have to redownload the images files.

- Removed Furesø kommune as they are no longer using Renoweb. Closing [#51](https://github.com/briis/affalddk/issues/51)
- Added Lejre kommune, that was left out in the initial release. Closing [#52](https://github.com/briis/affalddk/issues/52)
- Fixing wrong date count on sensors. Closing [#54](https://github.com/briis/affalddk/issues/54)
- Fixed categories for Solrød kommune. Closing [#53](https://github.com/briis/affalddk/issues/53)
- Fixing the `calendar.get_events` service call so that it now supports a start and end date. Thank you to @chamook for the initial Pull Request.
- Partly fix of #59. Catagorize container `Pap og papir/metal, glas og hård plast` correctly for Sorø Kommune
- Bumped minimum required HA version to 2024.2.0, to ensure that HA is using Python 3.12. Previous versions of Python might not work.
- Bump dependency `pyrenoweb` to 2.0.17

---------------------------

<details>
<summary><b>PREVIOUS CHANGES</b></summary>

## Version 2.0.6

**Date**: `2024-03-23`
Expand All @@ -13,11 +35,6 @@
- Fixing occasionally wrong address id being returned.
- Bump dependency `pyrenoweb` to 2.0.15

---------------------------

<details>
<summary><b>PREVIOUS CHANGES</b></summary>


## Version 2.0.5

Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,6 @@ Here is the list of currently supported Municipalities
- Fredensborg
- Frederiksberg
- Frederikssund
- Furesø
- Gentofte
- Gladsaxe
- Glostrup
Expand All @@ -147,6 +146,7 @@ Here is the list of currently supported Municipalities
- Jammerbugt
- Kerteminde
- Køge
- Lejre
- Lyngby-Taarbæk
- Mariagerfjord
- Næstved
Expand Down
5 changes: 5 additions & 0 deletions custom_components/affalddk/calendar.py
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,11 @@ async def async_get_events(self, hass: HomeAssistant, start_date: datetime.datet
_start: datetime.date = _pickup_events.date
_end: datetime.date = _start + timedelta(days=1)

if start_date.date() > _start:
continue
if end_date.date() < _end:
continue

if _start and _end:
events.append(
CalendarEvent(
Expand Down
4 changes: 2 additions & 2 deletions custom_components/affalddk/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
"iot_class": "cloud_polling",
"issue_tracker": "https://github.com/briis/affalddk/issues",
"requirements": [
"pyrenoweb==2.0.15"
"pyrenoweb==2.0.17"
],
"version": "2.0.6"
"version": "2.0.7"
}
11 changes: 8 additions & 3 deletions custom_components/affalddk/sensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,11 @@ class AffaldDKSensorEntityDescription(SensorEntityDescription):
name="Pap",
native_unit_of_measurement="dage",
),
AffaldDKSensorEntityDescription(
key="plast",
name="Plast",
native_unit_of_measurement="dage",
),
AffaldDKSensorEntityDescription(
key="plastmetal",
name="Plast & Metal",
Expand Down Expand Up @@ -252,7 +257,7 @@ def native_unit_of_measurement(self) -> str | None:
pickup_time: datetime.date = self._pickup_events.date
_pickup_days = (pickup_time - current_time).days
if pickup_time:
if _pickup_days + 1 == 1:
if _pickup_days == 1:
return "dag"

return super().native_unit_of_measurement
Expand All @@ -266,7 +271,7 @@ def native_value(self) -> StateType:
pickup_time: datetime.date = self._pickup_events.date
_pickup_days = (pickup_time - current_time).days
if pickup_time:
return _pickup_days + 1
return _pickup_days

@property
def icon(self) -> str | None:
Expand All @@ -282,7 +287,7 @@ def extra_state_attributes(self) -> None:
_timestamp = dt.today()
_current_date = dt.today()
_current_date = _current_date.date()
_state = (_date - _current_date).days + 1
_state = (_date - _current_date).days
if _state < 0:
_state = 0
_day_number = _date.weekday()
Expand Down
2 changes: 1 addition & 1 deletion hacs.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "Affaldshåndtering DK",
"content_in_root": false,
"render_readme": true,
"homeassistant": "2023.6.0",
"homeassistant": "2024.2.0",
"country": [
"DK"
]
Expand Down
1 change: 1 addition & 0 deletions images/affalddk/plast.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
colorlog==6.8.2
homeassistant==2024.3.1
homeassistant==2024.3.3
pip>=23.2.1,<24.1
ruff==0.3.4