Skip to content

Commit

Permalink
Merge pull request #15 from DavidBilodeau1/DavidBilodeau1-patch-1
Browse files Browse the repository at this point in the history
fixed a bug when recyclage was changed
  • Loading branch information
DavidBilodeau1 authored Jan 5, 2025
2 parents aee3953 + eae973e commit d2158b2
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ To display the next waste collection date as something more user-friendly, I mad
{% set t = now() %} # compare with now
{% set midnight = today_at() %}
# convert sensor value as y-m-d to datetime
{% set event_date = as_local(states('sensor.saguenay_rec_schedule') | as_datetime('%Y-%m-%d')) %}
{% set event_date = as_local(states('sensor.saguenay_récupération_schedule') | as_datetime('%Y-%m-%d')) %}
{% if event_date %}
{% set delta = (event_date - midnight).days %} # get difference in days
{% if delta == 0 %}
Expand Down
2 changes: 1 addition & 1 deletion custom_components/saguenay_collection/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,5 @@
"iot_class": "cloud_polling",
"issue_tracker": "https://github.com/DavidBilodeau1/saguenay_collection/issues",
"requirements": ["requests"],
"version": "1.0.4"
"version": "1.0.5"
}
8 changes: 4 additions & 4 deletions custom_components/saguenay_collection/sensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,9 @@ async def async_setup_entry(hass, config_entry, async_add_entities):
await coordinator.async_config_entry_first_refresh()

sensors = [
CollectionSensor(coordinator, "COM"),
CollectionSensor(coordinator, "ORD"),
CollectionSensor(coordinator, "REC"),
CollectionSensor(coordinator, "compostage"),
CollectionSensor(coordinator, "ordure"),
CollectionSensor(coordinator, "récupération"),
]
async_add_entities(sensors)

Expand All @@ -43,7 +43,7 @@ def fetch_data():
results = {}
for schedule in self.schedules:
try:
schedule_type = schedule.get("acronyme", "Unknown").lower()
schedule_type = schedule.get("nom", "Unknown").lower()
horaire_id = schedule.get("horaire_id")

_LOGGER.debug("Fetching data for schedule: %s with horaire_id: %s", schedule_type, horaire_id)
Expand Down

0 comments on commit d2158b2

Please sign in to comment.