Garbage pickup date (mijnafvalwijzer.nl) custom_component

Hi, maybe you can try something like:

{{ states.sensor.afvalinfo_gft.attributes["days_until_collection_date"] }}

But it seems you’re using a different component…

2 errors in your template: you’re not using the attributes, but state, and your using a string instead of a number 11:

{{ states.sensor|selectattr('attributes.days_until_collection_date','eq',6)|map(attribute='name')|join(', ') }}

btw, this would give you all available sensors:

{{ states.sensor
|selectattr('attributes.days_until_collection_date')
|selectattr('attributes.days_until_collection_date','!=',null)|map(attribute='name')|join(', ') }}

note that without the first selectattr, you get a list of all sensors :wink:

1 Like

Tnx, i Will try this later on.
I Have some trouble with my Rpi and the SD card. I have to fix this first.

Hi, the master branch has been updated so an exclude waste type option is available. For anyone who would like to give it a try, please do, so I’m sure everything works as exepected and I can release a new version.

Request: https://github.com/xirixiz/homeassistant-afvalwijzer/issues/131
Update: https://github.com/xirixiz/homeassistant-afvalwijzer

If you tested it, please share the outcome in the issue on GitHub. Thanks!

Hi there.
I’m new to Home Assistant and I can’t seem to get the information on my dashboard as is presented on your github page.
I think I have all the sensors and automations in the right place but I’m struggeling with the dashboard, is there a “tutorial” on how to set it up?
Thank you in advance.
Johan.

Hi All! Really happy with the afvakwijzer, but there is only one problem. “day after tomorrow” doesn’t work well. I’ts always the same as “tomorrow”. See screenshot below.

Is there anyone who can help me with this?

Hi @Bas81, this is an error in your config.

sensor.afvalwijzer_day_after_tomorrow is the actual data.
sensor.afvalwijzer_day_after_tomorrow_formatted is a sensor that should be created in HASS based on the data from sensor.afvalwijzer_day_after_tomorrow.

Most probably sensor.afvalwijzer_day_after_tomorrow_formatted is based on the data from sensor.afvalwijzer_tomorrow.

Example: https://github.com/xirixiz/my-hass-config/blob/654c576b2efc3f5f4b31bf1965ad1db97d721756/packages/waste.yaml#L99

Please verify.

Crap! I checked the code more then thousand times I think, but was blind for it :man_facepalming:

image

Thank you very much for your quick reply! I can’t test if it’s working now, but I assume it was the trick.

Thanks a lot!

Hi @xirixiz,

I have another small question. Is it possible to show some smaller pictures (the big ones on top)? Now they are using to much space:

image

Thanks in advance!

Bas

Hi @Bas81, ofcourse that would be possible, but unfortunatly I didn’t create this lovelace view, it was someone else (not sure abouthis name anymore, but I think it was @sjorsjes. Maybe he can help out.

1 Like

Can anyone tell me how I can make the two switches named : trash reminder enabled and Trash is outside.
I have tried to make this , but I don’t understand what I’m doing.

HI @xirixiz

checking the config for States remnants, the sensors made by your CC are the only ones with an attribute hidden:

sensor.py and provider.py set it to self._hidden = False, but isnt that redundant now

I’m trying to do a date conversion to create something like ‘Wednesday 7th’, but I can’t make it work. This is my code in configuration.yaml (never mind the actual datestamp, this is just to test the syntax):

  - platform: template
    sensors:
      trash_restafval_date:
        friendly_name: 'Grijze bak'
        value_template: '{{ as_timestamp(states.sensor.afvalwijzer_gft.state) | timestamp_custom("%Y-%m-%d") }}'

Code above gives value ‘Unknown’. I’ve tried many different variants, but the result is either Unavailable or Unknown. Who can help me with the right syntax?

Replying to myself, this is what eventually worked:

  - platform: template
    sensors:
      afvalwijzer_gft_friendly:
        value_template: > 
                           {{ as_timestamp(strptime(state_attr("sensor.afvalwijzer_gft", "year_month_day_date"), "")) | timestamp_custom('%a %d/%m') }}
        icon_template: mdi:apple
1 Like

And as sharing is caring, this is the full code I use, as the solution above broke ordering by days until pickup. This way this attribute is also added (and of course you can choose to add other attributes in a similar way:

#Transform to day dd/mm
  - platform: template
    sensors:
      afvalwijzer_gft_friendly:
        value_template: > 
          {{ as_timestamp(strptime(state_attr("sensor.afvalwijzer_gft", "year_month_day_date"), "")) | timestamp_custom('%a %d/%m') }}
        attribute_templates:
          days_until_collection_date: >
            {{state_attr("sensor.afvalwijzer_gft","days_until_collection_date")}}
        icon_template: mdi:apple
        friendly_name: 'Afvalwijzer GFT'

Have it installed. First through HACS, but didn`t work. Then removed it, restarted the PI and did it by hand. But no sensors. I have the latest updates and get the next error in the logfile:

Logger: homeassistant.components.sensor
Source: custom_components/afvalwijzer/provider/afvalwijzer.py:69
Integration: Sensor ([documentation](https://www.home-assistant.io/integrations/sensor), [issues](https://github.com/home-assistant/home-assistant/issues?q=is%3Aissue+is%3Aopen+label%3A%22integration%3A+sensor%22))
First occurred: 15:39:40 (1 occurrences)
Last logged: 15:39:40

Error while setting up afvalwijzer platform for sensor

Traceback (most recent call last): File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 250, in _async_setup_platform await asyncio.shield(task) File "/config/custom_components/afvalwijzer/sensor.py", line 68, in async_setup_platform afvalwijzer = await hass.async_add_executor_job( File "/usr/local/lib/python3.9/concurrent/futures/thread.py", line 52, in run result = self.fn(*self.args, **self.kwargs) File "/config/custom_components/afvalwijzer/provider/afvalwijzer.py", line 69, in __init__ ( TypeError: cannot unpack non-iterable NoneType object
1 Like

HI @xirixiz

upon updating to HA 2021.8.2, I see this in the ha core check:

INFO:custom_components.afvalwijzer.const.const:
-------------------------------------------------------------------
Afvalwijzer
This is a custom integration!
If you have any issues with this you need to open an issue here:
https://github.com/xirixiz/homeassistant-afvalwijzer/issues
-------------------------------------------------------------------

not even sure what it means, but maybe worth a look? (didnt yet raise an issue in the GitHub, because I am not sure yet what the implications are…)

Hehehe, I just followed the HACS basics by integrating this :).
It’s just to make sure people are aware that it’s a custom component and where to open an issue, if any :).

right :wink: never saw it afterwards must confess… not using HACS anyways

hello ,

can anybody tel me where i can find the images
it was not in the zip file
the images that i use now it for testing

image