pippyn / Home-Assistant-Sensor-Afvalbeheer

Provides Home Assistant sensors for multiple Dutch and Belgium waste collectors
Apache License 2.0
277 stars 86 forks source link

Address and waste data not found #505

Closed Jacob-nr5 closed 6 days ago

Jacob-nr5 commented 2 weeks ago

No data after the last upgrade HA to 2024.8, Current installed versions HA: 2024.8.3 Afvalbeheer 5.3.8 HACS 2.0.0

HA Log: 2024-08-27 16:12:26.064 ERROR (SyncWorker_5) [custom_components.afvalbeheer.API] Address not found! 2024-08-27 16:12:26.127 ERROR (MainThread) [custom_components.afvalbeheer.API] No Waste data found!

Config:

Afvalbeheer

afvalbeheer: wastecollector: Meppel resources:

pippyn commented 2 weeks ago

Duplicate of #503

Jacob-nr5 commented 2 weeks ago

503 is closed, but I still have the same errror.

Updated to the version 5.3.9

Goz3rr commented 2 weeks ago

This is not a duplicate of #503, Meppel has changed apps to MijnAfvalwijzer since the 1st of august. Changing from wastecollector: Meppel to wastecollector: MijnAfvalwijzer works as a workaround, although it does create new sensors.

The only thing I noticed is on the new platform HA no longer has a 'vet' resource, and enabling printwastetypes: 1 also only shows 'GFT, Papier, PMD'. I suspect the new resource is now called 'keukenafval', that's what the tooltip shows on mijnafvalwijzer.nl anyways.

pippyn commented 2 weeks ago

You are right. I'm sorry. It's not a workaround, it's a fix. But it will create new entities in most cases.

Jacob-nr5 commented 2 weeks ago

@pippyn, thanks for all the hardwork and creating of the new entities. Now the "vetgoed"is seen as "GTF", the other seems good

@Goz3rr, you are right, thanks. I changed meppel to mijnafvalwijzer and I got new working sensors again. :-)

pippyn commented 2 weeks ago

@Jacob-nr5 Can you give me your config (with an address) so I can do some tests?

Jacob-nr5 commented 2 weeks ago

The new config. The old config is in the top of this page.

Afvalbeheer

afvalbeheer: wastecollector: mijnafvalwijzer resources:

pippyn commented 2 weeks ago

The issue is that the fraction VET-goed is specific to Meppel, where they refer to it using the code keukenafval. Therefore, it will be mapped to GFT.

Goz3rr commented 2 weeks ago

I think it definitely should not be GFT, as explained here it's frying oil, electrical devices and textiles.

VET-goed (vetten, elektrische apparaten, textiel) De gemeente haalt Vetten (frituurvet en -olie), Elektrische apparaten (tot 10 kg) en Textiel bij u thuis op. Raadpleeg hiervoor de Afvalkalender.

pippyn commented 2 weeks ago

I understand. But Meppel uses the wrong code for this fraction, namely keukenafval. If I change this mapping a lot of other people will see VET-goed when it should be GFT. I'm not sure how I'm able to fix this.

Goz3rr commented 2 weeks ago

Keep Meppel as it's own wastecollector type as it is at the moment, but point it at MijnAfvalwijzer? Has the added bonus of not breaking existing configs

pippyn commented 2 weeks ago

That is a really hacky solution, I'll find a better way

Goz3rr commented 2 weeks ago

I suppose, this is what I did locally so I didn't have to change the config, it didn't create new entities and I didn't have to modify any automations.

If you don't find a better solution let me know and I can clean it up and throw this in a PR. I suppose you could also do it a little bit neater with inheritance but this was a quick fix.

diff --git custom_components/afvalbeheer/API.py custom_components/afvalbeheer/API.py
index 281c324..8fea3f8 100644
--- custom_components/afvalbeheer/API.py
+++ custom_components/afvalbeheer/API.py
@@ -114,7 +114,7 @@ class WasteData(object):
     def __select_collector(self):
         if self.waste_collector in XIMMIO_COLLECTOR_IDS.keys():
             self.collector = XimmioCollector(self.hass, self.waste_collector, self.postcode, self.street_number, self.suffix, self.address_id, self.customer_id)
-        elif self.waste_collector in ["mijnafvalwijzer", "afvalstoffendienstkalender", "rova"]:
+        elif self.waste_collector in ["mijnafvalwijzer", "afvalstoffendienstkalender", "rova", "meppel"]:
             self.collector = AfvalwijzerCollector(self.hass, self.waste_collector, self.postcode, self.street_number, self.suffix)
         elif self.waste_collector == "afvalalert":
             self.collector = AfvalAlertCollector(self.hass, self.waste_collector, self.postcode, self.street_number, self.suffix)
@@ -275,6 +275,9 @@ class AfvalwijzerCollector(WasteCollector):
         self.apikey = '5ef443e778f41c4f75c69459eea6e6ae0c2d92de729aa0fc61653815fbd6a8ca'
         if self.waste_collector == "rova":
             self.waste_collector_url = "inzamelkalender." + self.waste_collector
+        elif self.waste_collector == "meppel":
+            self.WASTE_TYPE_MAPPING['keukenafval'] = WASTE_TYPE_VETGOED
+            self.waste_collector_url = "mijnafvalwijzer"
         else:
             self.waste_collector_url = self.waste_collector

diff --git custom_components/afvalbeheer/const.py custom_components/afvalbeheer/const.py
index 1d3f97b..86c10e1 100644
--- custom_components/afvalbeheer/const.py
+++ custom_components/afvalbeheer/const.py
@@ -111,7 +111,6 @@ XIMMIO_COLLECTOR_IDS = {
     'hellendoorn':      '24434f5b-7244-412b-9306-3a2bd1e22bc1',
     'meerlanden':       '800bf8d7-6dd1-4490-ba9d-b419d6dc8a45',
     'ximmio':           '800bf8d7-6dd1-4490-ba9d-b419d6dc8a45',
-    'meppel':           'b7a594c7-2490-4413-88f9-94749a3ec62a',
     'rad':              '13a2cad9-36d0-4b01-b877-efcb421a864d',
     'twentemilieu':     '8d97bb56-5afd-4cbc-a651-b4f7314264b4',
     'waardlanden':      '942abcf6-3775-400d-ae5d-7380d728b23c',
@@ -156,6 +155,7 @@ WASTE_TYPE_REMAINDER = 'Restwagen'
 WASTE_TYPE_TEXTILE = 'Textiel'
 WASTE_TYPE_TREE = 'Kerstbomen'
 WASTE_TYPE_BULKYGARDENWASTE = 'Tuinafval'
+WASTE_TYPE_VETGOED = 'Vet'

 FRACTION_ICONS = {
     'gft':              'data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiPz4NCjwhRE9DVFlQRSBzdmcgUFVCTElDICItLy9XM0MvL0RURCBTVkcgMS4xLy9FTiIgImh0dHA6Ly93d3cudzMub3JnL0dyYXBoaWNzL1NWRy8xLjEvRFREL3N2ZzExLmR0ZCI+DQo8IS0tIENyZWF0b3I6IENvcmVsRFJBVyBYNiAtLT4NCjxzdmcgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIiB4bWw6c3BhY2U9InByZXNlcnZlIiB3aWR0aD0iNS4zMzMzM2luIiBoZWlnaHQ9IjUuMzMzMzNpbiIgdmVyc2lvbj0i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ping for providing your own fraction mapping. So this config will work for VET-goed:

afvalbeheer:
  - wastecollector: mijnafvalwijzer
    resources:
      - GFT
      - Papier
      - PMD
      - VET-goed
    postcode: 7943RK
    streetnumber: 4
    custommapping:
      keukenafval: VET-goed
Jacob-nr5 commented 1 week ago

Version v5.4.0 adds a new option named custommapping for providing your own fraction mapping. So this config will work for VET-goed:

afvalbeheer:
  - wastecollector: mijnafvalwijzer
    resources:
      - GFT
      - Papier
      - PMD
      - VET-goed
    postcode: 7943RK
    streetnumber: 4
    custommapping:
      keukenafval: VET-goed

Thanks, this is working. :-)