Giter VIP home page Giter VIP logo

home-assistant-sensor-afvalbeheer's Introduction

hacs_badge

"Buy Me A Coffee"

Home Assisant sensor component for Afvalbeheer

Provides Home Assistant sensors for multiple Dutch and Belgium waste collectors using REST API. This sensor works with the following waste collectors: Blink, Cure, Suez, ACV, Twente Milieu, Hellendoorn, Cyclus, DAR, De Fryske Marren, HVC Groep, Meerlanden, RMN (Reinigingsbedrijf Midden Nederland), Schouwen-Duiveland, Peel en Maas, Purmerend, Circulus-Berkel (Afvalvrij), Avalex, Venray, Den Haag, Berkelland, Alphen aan den Rijn, Waalre, ZRD, Spaarnelanden, SudwestFryslan, Montfoort, GAD, Cranendonck, ROVA, RD4, RWM, Limburg.NET, Afval Alert, RecycleApp, DeAfvalApp, Alkmaar, AreaReiniging, Almere, Waardlanden, Reinis, Avri, Omrin, BAR, Assen, RAD, Meppel, Montferland, PreZero, Lingewaard Voorschoten, Westland, Ôffalkalinder, Afval3xBeter and Middelburg-Vlissingen.

Cure users should switch to the waste collector MijnAfvalwijzer

Ophaalkalender users should switch to the waste collector RecycleApp

alt text

Install:

HACS

You can use HACS to install this sensor. It is included by default.

Manual

Copy the files in the /custom_components/afvalbeheer/ folder to: [homeassistant]/config/custom_components/afvalbeheer/

Example configs:

Single instance

afvalbeheer:
  wastecollector: Blink
  resources:
    - restafval
    - gft
    - papier
    - pmd
  postcode: 1111AA
  streetnumber: 1
  suffix: a                        # (optional)
  upcomingsensor: 0                # (optional)
  dateformat: '%d-%m-%Y'           # (optional)
  dateonly: 0                      # (optional)
  name: ""                         # (optional)
  nameprefix: 1                    # (optional)
  builtinicons: 0                  # (optional)
  dutch: 0                         # (optional)

Multiple instances

afvalbeheer:
  - wastecollector: Blink
    resources:
      - restafval
      - gft
      - papier
      - pmd
    postcode: 1111AA
    streetnumber: 1
  - wastecollector: Blink
    resources:
      - restafval
      - gft
      - papier
      - pmd
    postcode: 1111AA
    streetnumber: 2

Wastecollector

wastecollector:

Choose your collector from this list:

  • ACV
  • Afval3xBeter
  • Afvalstoffendienstkalender
  • AfvalAlert
  • Alkmaar
  • Almere
  • AlphenAanDenRijn
  • AreaReiniging
  • Assen
  • Avalex
  • Avri
  • BAR
  • Berkelland
  • Blink
  • Circulus
  • Cranendonck
  • Cure (use MijnAfvalwijzer)
  • Cyclus
  • DAR
  • DeAfvalApp
  • DeFryskeMarren
  • DenHaag
  • GAD
  • Hellendoorn
  • HVC
  • Limburg.NET (don't forget the streetname and cityname option)
  • Lingewaard
  • Meerlanden
  • Meppel
  • Middelburg-Vlissingen
  • MijnAfvalwijzer
  • Mijnafvalzaken
  • Montferland
  • Montfoort
  • Ôffalkalinder
  • Omrin
  • PeelEnMaas
  • PreZero
  • Purmerend
  • RAD
  • RecycleApp (don't forget the streetname option)
  • RD4
  • RWM
  • Reinis
  • ROVA
  • RMN
  • Schouwen-Duiveland
  • Spaarnelanden
  • SudwestFryslan
  • Twente Milieu
  • Venray
  • Voorschoten
  • Waalre
  • Waardlanden
  • Westland
  • Woerden
  • ZRD

Resources

resources:

This is a list of fractions you want a sensor for. At least one option is required. Not all fractions work with all collectors. Main resources options:

  • restafval
  • gft
  • papier
  • pmd

Some collectors also use some of these options:

  • gftgratis
  • textiel
  • glas
  • grofvuil
  • asbest
  • apparaten
  • chemisch
  • sloopafval
  • takken
  • pbd
  • duobak
  • restwagen
  • sortibak

Postcode

Postcode is required and is your own postcode

Streetnumber

Streetnumber is required and is your own street number

Suffix

suffix: a

Optional streetnumber suffix

Streetname

streetname: ?

Streetname is only required for Ophaalkalender.be and Limburg.NET

Cityname

cityname: ?

Cityname is only required for Limburg.NET

Print all available waste fractions

printwastetypes: 1

If you set this option the sensor will print a list of all possible waste fractions for your address and waste collector on every restart of your HA system. You can find this list in the persistent notifications.

Upcoming sensor

upcomingsensor: 1

If you activate this option you'll get 3 extra sensors (today, tomorrow and next upcoming) which are handy for automations. The today sensor will display the fractions collected today. The tomorrow sensor will display the fractions collected tomorrow. The next upcoming sensor will display the date and fractions closest in the future. Default is 0.

Date format

dateformat:

If you want to adjust the way the date is presented. You can do it using the dateformat option. All python strftime options should work. Default is '%d-%m-%Y', which will result in per example:

21-9-2019.

If you wish to remove the year and the dashes and want to show the name of the month abbreviated, you would provide '%d %b'. Which will result in:

21 Sep

Date only

dateonly: 1

If you don't want to add dayname, tomorrow or today in front of date activate this option. Default is 0.

Day of week

dayofweek: 1

This option adds the name of the day to the state of the sensor when the date is within 7 days. Default is 1.

Day of week only

dayofweekonly: 1

This option removes the date from the sensor if dayofweek is active. Default is 0.

Always show day

alwaysshowday: 1

This option removes the 7 day limit of dayofweek. Default is 0.

Date object

dateobject: 1

If you want the sensor state to be a date-time object. Default is 0 (state as string).

Name

name: 'your custom name'

If you want a custom name to be added to the sensor name. By default, no name is added. This is especially useful when you configure more than one sensor using this platform.

Name prefix

nameprefix: 0

If you don't want to add the waste collecoctors name to the sensor name. Default is 1.

Built in icons

builtinicons: 1

If you don't want to use the icons from your waste collector you can use the built in icons. Default is 0. For now only these fractions are supported:

  • gft
  • gftgratis
  • glas
  • papier
  • pmd
  • pbd
  • restafval

Screenshot 2022-10-19 at 09 23 13

Use new built in icons

builtiniconsnew: 1

Set this option if you want to use the new built in icons. Option builtinicons has to be 1. Default is 0. For now only these fractions are supported:

  • gft
  • gftgratis
  • glas
  • papier
  • pmd
  • pbd
  • plastic
  • zacht-plastic
  • restafval
  • kca
  • textiel
  • kerstbomen
  • grofvuil
  • tuinafval

Screenshot 2022-10-19 at 09 21 50

Disable the use of entity_picture

disableicons: 1

If you want to assign MDI icons (in your customize section) to these sensors, you'll need to set this option to 1.

Translation

dutch: 1

If you want to display the names of the days in dutch. Default is 0.

Update interval

updateinterval: 12

If you want to adjust the update interval, you can set this option to the desired hours. Default is 12.

Customer ID for Ximmio commercial address

customerid: 123456

If you use have a commercial address (and use one of the Ximmio waste collectors), you need to input your Customer ID. Default is empty.

Credits

Omrin API - @Jordi1990

"Buy Me A Coffee"

home-assistant-sensor-afvalbeheer's People

Contributors

arjenz avatar basschipper avatar bonno avatar brodock avatar dirixmjm avatar dus-stock avatar fsaris avatar golles avatar harpid avatar heinoldenhuis avatar jdruwe avatar jordi1990 avatar jorritvdven avatar koenhendriks avatar luukd avatar mpepping avatar pippyn avatar pjanssen avatar ralphje avatar robinvg avatar robvanuden avatar romkabouter avatar sandergols-tomtom avatar slootjes avatar speedyfirecyclone avatar stefanroelofs avatar tuimz avatar weilera avatar wrt54g avatar xirixiz avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

home-assistant-sensor-afvalbeheer's Issues

Avri (or use AfvalApp as source?)

Hi,

Thanks for this nice component! I'm not a developer myself sadly so not able to fully assess or do this, but is there any possibility the Avri that takes care of all the Gemeenten in Regio Rivierenland can be added?

www.avri.nl

They do also feature on the website: http://www.deafvalapp.nl (which I used for Homey previously), so that might be another source to get information from?

Again not sure if anything is possible, but if you could have a look that would be much appreciated!

PC: 4033KA, Numb: 15

Thanks.

PMD for Cranendonck

The PMD for Cranendonck is not being shown (unknown)
Guessing a translation is missing or something.

Add Alkmaar

Hi,

I'd like to request Alkmaar to be added to this sensor. The URL of the API is https://inzamelkalender.stadswerk072.nl/ .
From what is looks like the API is the same as the other cities already present in this sensor. I tried adding it myself but I'm not fluent in Python and don't know how to debug in HA.

Feature Request: Add extra option to dateonly

When i set dateonly to 0, you have the days before the date, if i set it to 1 , you dont get the date.
Is it possible to add a third option?:

I would like to have tomorrow or today without the date, but when its further away, i would be nice to have only the date (and not the day with it)…

Cranendonck PMD not working

I cannot get the PMD data working for Cranendonck. Somehow it's not recognised. It;'s in the rest data: id:1 and title "Plastic en blik/drankkarton'

Can you take a look to fix?

Please add Arnhem / Suez

Hi,

Could you add Arnhem to the code, I did test with this URL that is provided by Suez at https://inzamelwijzer.suez.nl/adres/ .

On one of the sites of gemeente Arnhem this one was provided as alternative to the standard afvalwijzer. The syntax is identical to "Alphen aan de Rijn" so I used that as a template.

Hans

HVC PBD doen't work (anymore)

Goodmorning,

Since a couple of days the HVC PBD config doesn't work anymore. Any idea what it might be?

Thanks!

Interface:

image

Config:

image

no pmd from hvc collector

The pmd sensor is giving no results after waiting for some hours.
I cannot figure out if that pmd-sensor is working for HVC or if I should use another sensor.

Meerlanden uknown

I have added meerlanden as waste collector but it's not showing me any data.


sensor.meerlanden_gft  unknown
sensor.meerlanden_papier  unknown
sensor.meerlanden_pmd  unknown
sensor.meerlanden_restafval  unknown

Is this only in available in some areas?

current config looks looks like this:

  - platform: afvalbeheer
    wastecollector: meerlanden
    resources:                       
      - restafval
      - gft
      - papier
      - pmd
    postcode: 2131AN      
    streetnumber: 13      
    upcomingsensor: 0     
    dateformat: '%d-%m-%Y'
    dateonly: 0           
    nameprefix: 1         
    builtinicons: 0 

Isn't this available in my region?

HVC PMD sensor is not working

Hi,

The PMD sensor of HVC doesnt seem to work. When I request the "Afvalstromen" by hand from the HVC api, I get the following title: "title": "Plastic, blik & drinkpakken",
Somehow this is not recognized by the PMD sensor. My guess it's related tothe RENAME_TITLES array. Hope you can have a look at it. Thanks!

Regards, Matthijs

Cure not working anymore

Hi,

I got a problem when getting the data for Cure.
See below:

Update for sensor.gft fails
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 279, in async_update_ha_state
    await self.async_device_update()
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 476, in async_device_update
    await self.hass.async_add_executor_job(self.update)
  File "/usr/local/lib/python3.7/concurrent/futures/thread.py", line 57, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/config/custom_components/afvalbeheer/sensor.py", line 366, in update
    self.data.update()
  File "/usr/src/homeassistant/homeassistant/util/__init__.py", line 240, in wrapper
    result = method(*args, **kwargs)
  File "/config/custom_components/afvalbeheer/sensor.py", line 264, in update
    response = requests.get(url).json()
  File "/usr/local/lib/python3.7/site-packages/requests/models.py", line 897, in json
    return complexjson.loads(self.text, **kwargs)
  File "/usr/local/lib/python3.7/site-packages/simplejson/__init__.py", line 525, in loads
    return _default_decoder.decode(s)
  File "/usr/local/lib/python3.7/site-packages/simplejson/decoder.py", line 370, in decode
    obj, end = self.raw_decode(s)
  File "/usr/local/lib/python3.7/site-packages/simplejson/decoder.py", line 400, in raw_decode
    return self.scan_once(s, idx=_w(s, idx).end())
simplejson.errors.JSONDecodeError: Expecting value: line 3 column 1 (char 4)

Not sure if im wrong but isn't the url changed to
https://www.mijnafvalwijzer.nl

Thanks.

Config error

Hi,

I'm trying to set up this plugin in HA i have hacs installed and moved the files to it's location, but i get a syntax error from HA Error loading /config/configuration.yaml: while parsing a block mapping in "/config/sensors.yaml", line 2, column 7 expected <block end>, but found '<scalar>' in "/config/sensors.yaml", line 12, column 40
i copied your code and only changed my zipcode and number, sensor: - platform: afvalbeheer wastecollector: Cure (required) resources: (at least 1 required) - restafval - gft - papier - pmd postcode: 5645BE (required) streetnumber: 122 (required) upcomingsensor: 0 (optional) dateformat: '%d-%m-%Y' (optional) dateonly: 0 (optional) name: '' (optional) nameprefix: 1 (optional) builtinicons: 0 (optional) disableicons: 0 (optional) dutch: 0 (optional)
I hope you guys can help me :)

have a awesome day,

Waste Collector (Cure) defined a waste type twice

So today it is the day Papier en karton is picked up. According to the sensor it is not due till the 7th of November. In the app of Cure the 7th of November is marked as pickup date for Papier en karton but also today as expected.

By inspecting the API I found that both dates are available but with a different ID in the result.

Today
{ id: 131, parent_id: 0, title: "Papier en karton", slug: "", tags: null, page_title: "Papier en karton", content: "<p><strong>Wat</strong></p> <p>Papier en karton m....", menu_title: "Papier en karton", icon: "doos-karton-papier", icon_data: "data:image/svg+xml;base64,PD94bWwgdm...", ophaaldatum: "2019-10-10" }

The 7th of November
{ id: 124, parent_id: 0, title: "Papier en karton", slug: "", tags: null, page_title: "Papier en karton", content: "<p><strong>Wat</strong><br /> .....", menu_title: "Papier en karton", icon: "doos-karton-papier", icon_data: "data:image/svg+xml;base64,PD94bWw.....", ophaaldatum: "2019-11-07" }

It seems like a bug on the waste collectors end but maybe it is an idea to do an extra check if there are two of the same kind and just give back the one with the earliest pickup date.

Can you add Veldhoven (Afvalinfo.nl)

I live in Veldhoven (postal codes 5500 - 5509) and the calendar is generated by Afvalinfo.nl.
the api used by afvalinfo.nl seems to be almost similar to the ones you integrated already. Can this one be integrated as well (is available in the Afvalinfo integration, but I like your integration more)?

PMD for meerlanden

Deze werkt op het moment niet en ik krijg een unkown.

        "id": 14,
        "parent_id": 0,
        "title": "Plastic, Blik en Drinkpakken",
        "slug": "plastic",
        "tags": null,
        "page_title": "Plastic, Blik en Drinkpakken",
        "content": "...",
        "menu_title": "Plastic, Blik en Drinkpakken",
        "icon": "petfles-blik-drankpak_pmd",
        "icon_data": "",
        "ophaaldatum": "2020-01-16"
    },

zo ziet de json eruit van meerlanden. geen title "pmd" iig.

Ik probeer door de code te graven om te kijken waar het mis gaat maar ben er nog niet goed achter hoe ik dit debug in HA.

"Day" is missing with HVC PBD

PBD doesn't show the day of the pick-up date.

- Not working: PBD

image

- Working: GFT

image

Configuration:

  - platform: afvalbeheer
    wastecollector: HVC
    resources:
      - restafval
      - gft
      - papier
      - pbd
    postcode: 0000XX
    streetnumber: 24
    upcomingsensor: 0
    dateformat: '%d-%m-%Y'
    dateonly: 0
    name: ""
    nameprefix: 1
    builtinicons: 0
    dutch: 1

Thanks for your briljant hassio integration btw :-)

[README] Wastecollector configuration

Your README states that you can choose a wastecollector of a given list. They only work in lowercase though, so either the README should be updated, or the code should do a toLowerCase.

Ophaalkalender sensor missing a collection

I just installed it and compared it to the "ophaal kalender" and it seems that it miss the next collection:

Image of the sensor:
image

Image of the calendar:
image

Config:

- platform: afvalbeheer
  wastecollector: ophaalkalender
  resources:
    - restafval
    - papier
    - pmd
    - gft
  postcode: !secret ophaalkalender_postcode
  streetname: !secret ophaalkalender_streetname

Version using is 3.1.0

PMD for GAD (Hilversum, Wijdemeren etc)

Although there are already 2 other PMD for .. topics I'm making this a separate issue because I'm not sure it's the same one. PMD for GAD is not recognized and gives a value unknown in HA.

A link to the output for a nearby building: https://inzamelkalender.gad.nl/rest/adressen/1696200000288611/afvalstromen

Tried adding plastic to recources in the config and RENAME_TITLES in the sensor.py but to no avail, unfortunately I'm not a python wizz so I'm not getting any firther on my own.

name / nameprefix doesnt seem to work

i cant seem to successfully add name: and/or nameprefix: 0 to the configuration.yaml without error:
sensor:

  • platform: afvalbeheer
    wastecollector: ophaalkalender
    resources:
    • restafval
    • pmd
    • papier
      postcode: postalcode
      streetname: streename
      streetnumber: streetnumber
      dateformat: '%d-%m-%Y'
      builtinicons: 1
      name: 'pmd'
      nameprefix: 0
      afbeelding

without any name setting it works perfectly 👍 :

  • platform: afvalbeheer
    wastecollector: ophaalkalender
    resources:
    • restafval
    • pmd
    • papier
      postcode: postalcode
      streetname: streename
      streetnumber: streetnumber
      dateformat: '%d-%m-%Y'
      builtinicons: 1
      #name: 'pmd'
      #nameprefix: 0

afbeelding

Thanks in advance for the feedback

Sensor pmd circulus-berkel

This sensor does not work after the latest update.

I have also put pbd but that one does also not work.

Connection issue

I have an issue with HA version 0.93.2. Afvalbheer won't show any data anymore.

In the log file i see:

2019-05-25 12:07:40 ERROR (SyncWorker_12) [custom_components.afvalbeheer.sensor] Error occurred while fetching data: ConnectionError(MaxRetryError("HTTPSConnectionPool(host='inzamelkalender.hvcgroep.nl', port=443): Max retries exceeded with url: /rest/adressen/[mypostalcode] (Caused by NewConnectionError('<urllib3.connection.VerifiedHTTPSConnection object at 0x6cdbbf10>: Failed to establish a new connection: [Errno -3] Try again'))"))

Any clue?

Sensor is not working for Rova

I try to use it but for Rova it seems not to work..

This is my config:
- platform: afvalbeheer wastecollector: Rova resources: - restafval - gft - papier - pmd postcode: ###### streetnumber: ## upcomingsensor: 1 dateformat: '%d %b %Y' dateonly: 0 nameprefix: 1 builtinicons: 0 dutch: 1

In the logs I see:
`You are using a custom integration for afvalbeheer which has not been tested by Home Assistant. This component might cause stability problems, be sure to disable it if you do experience issues with Home Assistant.

Update for sensor.rova_gft fails
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 279, in async_update_ha_state
await self.async_device_update()
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 461, in async_device_update
await self.hass.async_add_executor_job(self.update)
File "/usr/local/lib/python3.7/concurrent/futures/thread.py", line 57, in run
result = self.fn(*self.args, **self.kwargs)
File "/config/custom_components/afvalbeheer/sensor.py", line 362, in update
self.data.update()
File "/usr/src/homeassistant/homeassistant/util/init.py", line 240, in wrapper
result = method(*args, **kwargs)
File "/config/custom_components/afvalbeheer/sensor.py", line 260, in update
response = requests.get(url).json()
File "/usr/local/lib/python3.7/site-packages/requests/models.py", line 897, in json
return complexjson.loads(self.text, **kwargs)
File "/usr/local/lib/python3.7/site-packages/simplejson/init.py", line 525, in loads
return _default_decoder.decode(s)
File "/usr/local/lib/python3.7/site-packages/simplejson/decoder.py", line 370, in decode
obj, end = self.raw_decode(s)
File "/usr/local/lib/python3.7/site-packages/simplejson/decoder.py", line 400, in raw_decode
return self.scan_once(s, idx=_w(s, idx).end())
simplejson.errors.JSONDecodeError: Expecting value: line 1 column 1 (char 0)

Update for sensor.rova_vandaag fails
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 279, in async_update_ha_state
await self.async_device_update()
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 461, in async_device_update
await self.hass.async_add_executor_job(self.update)
File "/usr/local/lib/python3.7/concurrent/futures/thread.py", line 57, in run
result = self.fn(*self.args, **self.kwargs)
File "/config/custom_components/afvalbeheer/sensor.py", line 449, in update
self.data.update()
File "/usr/src/homeassistant/homeassistant/util/init.py", line 240, in wrapper
result = method(*args, **kwargs)
File "/config/custom_components/afvalbeheer/sensor.py", line 260, in update
response = requests.get(url).json()
File "/usr/local/lib/python3.7/site-packages/requests/models.py", line 897, in json
return complexjson.loads(self.text, **kwargs)
File "/usr/local/lib/python3.7/site-packages/simplejson/init.py", line 525, in loads
return _default_decoder.decode(s)
File "/usr/local/lib/python3.7/site-packages/simplejson/decoder.py", line 370, in decode
obj, end = self.raw_decode(s)
File "/usr/local/lib/python3.7/site-packages/simplejson/decoder.py", line 400, in raw_decode
return self.scan_once(s, idx=_w(s, idx).end())
simplejson.errors.JSONDecodeError: Expecting value: line 1 column 1 (char 0)

Update for sensor.rova_papier fails
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 279, in async_update_ha_state
await self.async_device_update()
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 461, in async_device_update
await self.hass.async_add_executor_job(self.update)
File "/usr/local/lib/python3.7/concurrent/futures/thread.py", line 57, in run
result = self.fn(*self.args, **self.kwargs)
File "/config/custom_components/afvalbeheer/sensor.py", line 362, in update
self.data.update()
File "/usr/src/homeassistant/homeassistant/util/init.py", line 240, in wrapper
result = method(*args, **kwargs)
File "/config/custom_components/afvalbeheer/sensor.py", line 260, in update
response = requests.get(url).json()
File "/usr/local/lib/python3.7/site-packages/requests/models.py", line 897, in json
return complexjson.loads(self.text, **kwargs)
File "/usr/local/lib/python3.7/site-packages/simplejson/init.py", line 525, in loads
return _default_decoder.decode(s)
File "/usr/local/lib/python3.7/site-packages/simplejson/decoder.py", line 370, in decode
obj, end = self.raw_decode(s)
File "/usr/local/lib/python3.7/site-packages/simplejson/decoder.py", line 400, in raw_decode
return self.scan_once(s, idx=_w(s, idx).end())
simplejson.errors.JSONDecodeError: Expecting value: line 1 column 1 (char 0)

Update for sensor.rova_morgen fails
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 279, in async_update_ha_state
await self.async_device_update()
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 461, in async_device_update
await self.hass.async_add_executor_job(self.update)
File "/usr/local/lib/python3.7/concurrent/futures/thread.py", line 57, in run
result = self.fn(*self.args, **self.kwargs)
File "/config/custom_components/afvalbeheer/sensor.py", line 449, in update
self.data.update()
File "/usr/src/homeassistant/homeassistant/util/init.py", line 240, in wrapper
result = method(*args, **kwargs)
File "/config/custom_components/afvalbeheer/sensor.py", line 260, in update
response = requests.get(url).json()
File "/usr/local/lib/python3.7/site-packages/requests/models.py", line 897, in json
return complexjson.loads(self.text, **kwargs)
File "/usr/local/lib/python3.7/site-packages/simplejson/init.py", line 525, in loads
return _default_decoder.decode(s)
File "/usr/local/lib/python3.7/site-packages/simplejson/decoder.py", line 370, in decode
obj, end = self.raw_decode(s)
File "/usr/local/lib/python3.7/site-packages/simplejson/decoder.py", line 400, in raw_decode
return self.scan_once(s, idx=_w(s, idx).end())
simplejson.errors.JSONDecodeError: Expecting value: line 1 column 1 (char 0)

Update for sensor.rova_restafval fails
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 279, in async_update_ha_state
await self.async_device_update()
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 461, in async_device_update
await self.hass.async_add_executor_job(self.update)
File "/usr/local/lib/python3.7/concurrent/futures/thread.py", line 57, in run
result = self.fn(*self.args, **self.kwargs)
File "/config/custom_components/afvalbeheer/sensor.py", line 362, in update
self.data.update()
File "/usr/src/homeassistant/homeassistant/util/init.py", line 240, in wrapper
result = method(*args, **kwargs)
File "/config/custom_components/afvalbeheer/sensor.py", line 260, in update
response = requests.get(url).json()
File "/usr/local/lib/python3.7/site-packages/requests/models.py", line 897, in json
return complexjson.loads(self.text, **kwargs)
File "/usr/local/lib/python3.7/site-packages/simplejson/init.py", line 525, in loads
return _default_decoder.decode(s)
File "/usr/local/lib/python3.7/site-packages/simplejson/decoder.py", line 370, in decode
obj, end = self.raw_decode(s)
File "/usr/local/lib/python3.7/site-packages/simplejson/decoder.py", line 400, in raw_decode
return self.scan_once(s, idx=_w(s, idx).end())
simplejson.errors.JSONDecodeError: Expecting value: line 1 column 1 (char 0)

Update for sensor.rova_pmd fails
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 279, in async_update_ha_state
await self.async_device_update()
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 461, in async_device_update
await self.hass.async_add_executor_job(self.update)
File "/usr/local/lib/python3.7/concurrent/futures/thread.py", line 57, in run
result = self.fn(*self.args, **self.kwargs)
File "/config/custom_components/afvalbeheer/sensor.py", line 362, in update
self.data.update()
File "/usr/src/homeassistant/homeassistant/util/init.py", line 240, in wrapper
result = method(*args, **kwargs)
File "/config/custom_components/afvalbeheer/sensor.py", line 260, in update
response = requests.get(url).json()
File "/usr/local/lib/python3.7/site-packages/requests/models.py", line 897, in json
return complexjson.loads(self.text, **kwargs)
File "/usr/local/lib/python3.7/site-packages/simplejson/init.py", line 525, in loads
return _default_decoder.decode(s)
File "/usr/local/lib/python3.7/site-packages/simplejson/decoder.py", line 370, in decode
obj, end = self.raw_decode(s)
File "/usr/local/lib/python3.7/site-packages/simplejson/decoder.py", line 400, in raw_decode
return self.scan_once(s, idx=_w(s, idx).end())
simplejson.errors.JSONDecodeError: Expecting value: line 1 column 1 (char 0)`

state as timestamp with device_class attribute

Hi, I was trying to get these look nice in a Home Feed card and that works only if the actual state is a timestamp and the device has a device_class: timestamp as attribute, then my visual can calculate time until etc. I made the change myself, by adding CONF_DEVICE_CLASS, DEVICE_CLASS_TIMESTAMP from const as imports, and adding CONF_DEVICE_CLASS: DEVICE_CLASS_TIMESTAMP, in the attributes of the WasteSensor, and finally disabling all Today/Tomorrow logic in the update and just having this as line 575: self._state = pick_update and disabling the if in the line before and the whole else block in the lines after.

Could you consider making behaviour possible either by default or as an option. Visually this creates this, when using visuals that parse datetimes:
image

Sort-date attribute is always 0

Hello,

I want to make use of the sort-date attribute as described in this resolved issue : #33

However, the sort-date attribute stays 0 whatever I try.

image

My config:

  - platform: afvalbeheer
    wastecollector: Ophaalkalender
    resources:
      - restafval
      - gft
      - papier
      - pmd
      - glas
      - textiel
    postcode: ZZZZ
    streetname: ZZZZ
    streetnumber: Z
    dateonly: 1
    dateformat: '%d/%m/%Y'
    dateobject: 1

Thanks in advance for your help.

Add translation for Today and Tomorrow

Hi,

I have tried it myself but I can't seem to get it to work. Is it possible to add translations for the words "Today" and "Tomorrow" so I can show "Today, 26-08-2019" in my own language?

Or can you tell me how I can implement it myself and if it works you can add it if you want.

Thanks in advance!

Update documentation to include fraction type PBD

I couldn't get PMD to work with the waste collector GAD, browsing through the closed issues I found the reason, the fraction is called PBD. This type is not mentioned in the documentation, it would be helpful to add this in the list of fraction types and add an explanation this is commonly used instead of PMD.

Great work on this (I was looking for this functionality and thanks to HACS found it)

Add option to use mdi icons

The current implementation only allows to use the build in icons or the icons from the waste collector. Both are not really in the same style as the common icons in home assistant. Overwriting the icons in ‘customize entities’ with standard mdi icons is also not working. Is it possible to add this, to just use the customize entities option of home assistant for changing icons?

Add support for RD4

The Garbage collector RD4 operates in the southern part of Limburg. I've found several official ways to retrieve the data:

JSON: https://app.rd4.nl/nsi/api/v1/wastecalendars. This is what the official RD4 'Milieu App' connects to, and returns categories where 0 is restafval, 1 is GFT, 2 is Oud Papier, 3 is Snoeiafval, 4 is Kerstbomen, 5 is PMD and 6 is BEST. This requires an API_KEY and Basic Authorization header (see below).

HTML: https://www.rd4info.nl/NSI/Burger/Aspx/afvalkalender_public_text.aspx?pc=POSTALCODE&nr=NUMBER&t=ADDITION, e.g.: https://www.rd4info.nl/NSI/Burger/Aspx/afvalkalender_public_text.aspx?pc=6411XZ&nr=41&t=. This is not my address, just grabbed one from Funda.

JSON: https://rd4.syzygy.eu/POSTALCODE/NUMBER/, e.g.: https://rd4.syzygy.eu/6411XZ/41. I'm not entirely sure where this URL comes from and if it's future proof.

The downside with the first JSON approach is that it requires an API_KEY and Authorization. The API_KEY seems common but the (basic) Authorization seems to be different depending solely on the address. The same address on different devices yields the same Authorization key, so I'm guessing they assigned a different Authorization key to each collection route. API and Authorization can be sniffed when using the official app, but that's far from user friendly.

The downside with the HTML approach is it obviously needs extracting data from the HTML, but there's a nice LUA script that might 'inspire' you at https://github.com/jvanderzande/mijnafvalwijzer/blob/master/script_time_huisvuil-zuidlimburg.lua.

The downside with the second/last JSON approach is there's a category Overig where they combined things like Kerstbomen, BEST and Snoeiafval so those are not specified.

Still, any update to the sensors would be nice!

Documentation: Add "kerstbomen" as possible fraction type

A little bit late, but I found you can actually retrieve the date for the fraction "kerstbomen" (with GAD at least). So you might add that to the possible list of fraction types. (it currently actually retrieves 5-jan-2021 for me).

resources:
  - kerstbomen

database error

yesterday i moved to a recorder setup after that i'm getting the following error

`Error adding event: (MySQLdb._exceptions.DataError) (1406, "Data too long for column 'event_data' at row 1") [SQL: INSERT INTO events (event_type, event_data, origin, time_fired, created, context_id, context_user_id) VALUES (%s, %s, %s, %s, %s, %s, %s)] [parameters: ('state_changed', '{"entity_id": "sensor.pmd", "old_state": {"entity_id": "sensor.pmd", "state": "22-04-2020", "attributes": {"Official name": "Zwart kratje PMD BEST", ... (73489 characters truncated) ... :00", "last_updated": "2020-04-09T07:56:17.541387+00:00", "context": {"id": "eaf2296cf7d14416b8314960031a1b0a", "parent_id": null, "user_id": null}}}', 'LOCAL', datetime.datetime(2020, 4, 9, 7, 56, 17, 541437, tzinfo=), datetime.datetime(2020, 4, 9, 7, 56, 17, 544357), 'eaf2296cf7d14416b8314960031a1b0a', None)] (Background on this error at: http://sqlalche.me/e/9h9h)'

Add Attribute with date value (to enable sorting)

Hi, I use this component for a long time. I want to be able to display the fraction collection sorted by date. [https://github.com/thomasloven/lovelace-auto-entities] provides the option for sorting by state (or attribute and others). However the date output of this component is of the type string. This means it will sort alphabetically on the date. This results in wrong sorting in my preferred date format '%d-%m-%Y' For example 07-02-2020, 14-01-2020, 20-01-2020.
I can change the output dateformat of this component to get the sorting to work ('%Y-%m-%d') but I don't like that output (not to speak about my wife).

I think the best option to get this to work is to add a new attribute to the sensors with the actual date value (or the '%Y-%m-%d'value). That way we can sort the entities by Attribute, and can use any display state value without affecting the sort order.

PMD bij GAD komt niet binnen

De scrape voor PMD komt niet door bij het GAD.
De sensor geeft Unkown
GFT ,Rest en Papier doen het wel
Morgen en vandaag zijn ook Unknown

Config

sensor:

  • platform: afvalbeheer
    wastecollector: GAD
    resources:
    - restafval
    - gft
    - papier
    - pmd
    postcode: XXXXXX
    streetnumber: XX
    builtinicons: 1
    nameprefix: 1
    upcomingsensor: 1
    dutch: 0
    dateformat: '%d-%m'

Maximum request exceeded error for Venray

Is it possible to add a interval option? I get the following error (example zipcode + housenumber: 5803BD-1):

Logger: custom_components.afvalbeheer.sensor
First occured: 10:30:24 AM (1 occurences)
Last logged: 10:30:24 AM

Error occurred while fetching data: ConnectionError(MaxRetryError("HTTPSConnectionPool(host='afvalkalender.venray.nl', port=443): Max retries exceeded with url: /rest/adressen/5803BD-1 (Caused by NewConnectionError('<urllib3.connection.VerifiedHTTPSConnection object at 0xabe21db0>: Failed to establish a new connection: [Errno 111] Connection refused'))"))

Color icons

Is it possible to change the color from the icons because it only looks good on a white background.
If you change to another theme you can barely see the images of the different waste kinds

Thank you
afbeelding

Sort by date ?

Great integration, very useful !

Is there anyway to sort by date ?

date restafval incorrect

sorry to bother you here now...
after testing , I get wrong date for restafval:
ophaalkalender afval restafval
17-04-2020
ophaalkalender afval papier
17-04-2020
ophaalkalender afval pmd
24-04-2020

restafval should be 16-01-2020 (always on thursdays, p-k & pmd 3weelky on fridays)
(address is 8650 , Beukhoutstraat 38)

Please support afvalportaal.2go-mobile.com

Hi there,

This is not an issue or bug report, but more a request to help me out implementing this page:

Thttps://afvalportaal.2go-mobile.com/modules/53d8db94-7945-42fd-9742-9bbc71dbe4c1/kalender/

Is there any way this platform could be integrated? Thanks in advance!

[FR] Please make the polling rate less or variable.

I think we need to change the polling rate of the Afvalbeheer API's. See screenshot below. This is the amount it's getting requested within 24 hours.

image

2020-04-19 09:49:22 ERROR (SyncWorker_5) [custom_components.afvalbeheer.sensor] Error occurred while fetching data: ConnectionError(MaxRetryError("HTTPSConnectionPool(host='inzamelkalender.hvcgroep.nl', port=443): Max retries exceeded with url: /rest/adressen/***********/afvalstromen (Caused by NewConnectionError('<urllib3.connection.HTTPSConnection object at 0x7fefb632b390>: Failed to establish a new connection: [Errno -3] Try again'))"))

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.