Skip to content

Commit

Permalink
Update sensor_provider.py
Browse files Browse the repository at this point in the history
  • Loading branch information
xirixiz authored Nov 2, 2021
1 parent faeb98c commit 86ac227
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion custom_components/afvalwijzer/sensor_provider.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#!/usr/bin/env python3

import hashlib
from datetime import date, datetime, timedelta

from homeassistant.helpers.entity import Entity
Expand All @@ -16,6 +16,9 @@
CONF_DEFAULT_LABEL,
CONF_ID,
CONF_INCLUDE_DATE_TODAY,
CONF_POSTAL_CODE,
CONF_STREET_NUMBER,
CONF_SUFFIX,
MIN_TIME_BETWEEN_UPDATES,
PARALLEL_UPDATES,
SENSOR_ICON,
Expand Down Expand Up @@ -47,11 +50,20 @@ def __init__(self, hass, waste_type, fetch_afvalwijzer_data, config):
self._is_collection_date_tomorrow = False
self._is_collection_date_day_after_tomorrow = False
self._year_month_day_date = None
self._unique_id = hashlib.sha1(
f"{self.waste_type}{self.config.get(CONF_ID)}{self.config.get(CONF_POSTAL_CODE)}{self.config.get(CONF_STREET_NUMBER)}{self.config.get(CONF_SUFFIX,'')}".encode(
"utf-8"
)
).hexdigest()

@property
def name(self):
return self._name

@property
def unique_id(self):
return self._unique_id

@property
def icon(self):
return self._icon
Expand Down

0 comments on commit 86ac227

Please sign in to comment.