FKF Budapest Garbage Collection schedule

I wrote a custom_component platform and a related custom Lovelace card for providing and displaying Budapest Department of Public (FKF) garbage collection schedule.

fkf_alerted fkf_hide_days


Enjoy!

2 Likes

Hi @amaximus!

First of all
It’s a great feature! Thanks!


but I have two error message
and I didn’t fix it.
Could you please help me?

  • Detected I/O inside the event loop. This is causing stability issues. Please report issue to the custom component author for fkf_garbage_collection doing I/O at custom_components/fkf_garbage_collection/sensor.py, line 81: r = requests.get(url)
  • Detected I/O inside the event loop. This is causing stability issues. Please report issue to the custom component author for fkf_garbage_collection doing I/O at custom_components/fkf_garbage_collection/sensor.py, line 98: r = requests.post(url, data=payload, headers=headers)

Thanks in advance!
Balazs

Hi @balagev79,

thanks for the heads-up. I’m aware of the warnings included by 0.109.0.
Once I’ll have some time, I will update the code to make it compliant.

regards, Atticus

@balagev79, I fixed the I/O issue in event loop in the latest version pushed couple of minutes ago.

I tested it with my address, but I’ve received this error (I keep the HA version on 109.0).
Logger: homeassistant.components.sensor
Source: custom_components/fkf_garbage_collection/sensor.py:118
Integration: Sensor (documentation, issues)
First occurred: 4:06:04 PM (1 occurrences)
Last logged: 4:06:04 PM

fkf_garbage_collection: Error on device update!
Traceback (most recent call last):
File “/usr/src/homeassistant/homeassistant/helpers/entity_platform.py”, line 322, in _async_add_entity
await entity.async_device_update(warning=False)
File “/usr/src/homeassistant/homeassistant/helpers/entity.py”, line 470, in async_device_update
await self.async_update()
File “/config/custom_components/fkf_garbage_collection/sensor.py”, line 166, in async_update
self._fkfdata = await async_get_fkfdata(self)
File “/config/custom_components/fkf_garbage_collection/sensor.py”, line 118, in async_get_fkfdata
gday = tr_elements[0].xpath(’//td[1]/text()’)
IndexError: list index out of range

After that I tried with the example address (Attila Ășt) and it’s worked! My address is street (utca), which is looks like “u.” in FKF database. After that I tested with tĂ©r, Ășt, köz, etc
and it’s worked as well.
Could you please share with me/us the correct street “symbol” what I need to use?

PS: I think “.” is the problem after the street name like: “PetƑfi u.”

Thanks!
Balazs

Could you please share your sensor config (at least the zip code and the publicplace.) to be able to investigate it.

Testing for 1196 PetƑfi u. 59 looks ok:

sensors $more test_fkf.yaml
platform: fkf_garbage_collection
name: 'test_fkf'
zipcode: '1196'
publicplace: 'PetƑfi u.'
housenr: '59'
sensors $

test_garbage

Here is my config:
sensor

  • platform: fkf_garbage_collection
    name: ‘fkf_my_schedule’
    zipcode: ‘1181’
    publicplace: ‘Kiss István u.’

Thanks!
Balazs

There was an issue with handling public place names with several items (e.g. Kiss IstvĂĄn u.) that has been fixed this morning.
Please update the sensor (and the associated card) and get back to me with results.
You may consider reporing issues at https://github.com/amaximus/fkf-garbage-collection/issues.

Perfect! Thanks it works!

Hi @amaximus
suddenly my sensor has a state of “unknown”

My config is:
#FKF Garbage collection
platform: fkf_garbage_collection
name: ‘fkf_my_schedule’
zipcode: !secret zipcode
publicplace: !secret publicplace
housenr: !secret housenr

Zipcode is “1124”
publicplace is “BĂŒrök u.”
in secrets.yaml

Is it possible that I missed something in the config?

You may check to see under Developer Tools->States what is displayed for the sensor. You may also check if you have any error/warning related to the fkf_garbage_collection or to the sensor itself.
I presume it was working before and you did not change anything related.
Versions would be good to be known.

I’m using latest hass version (0.111.4) with latest custom platform version (300acfb) and it works without issues.

The public place should be ‘BĂŒrök utca’ as per fkf.hu/hulladeknaptar

Hi @amaximus 
oh, hack
 I missed that. It did the trick with “utca” instead of “u.”
In fact I recovered the last version from a snapshot and I copied my last faulty entry :persevere:
Now I’ll make a “healthy” snapshot.
Thanks a million! :+1: :v:

Hi @amaximus,

I’ve just discovered this cool integration and thought to ask for some help, since I got stuck with setting up the custom lovelace card. The best I could reach on the dashboard was a card with the name of the entity and the days until the next garbage collection. My custom card’s location differs from the github example but not sure if this is the only reason why I cannot find it when editing the dashboard. “/hacsfiles/fkf-garbage-collection-card/fkf-garbage-collection-card.js” I have even tried to add the card to the dashboard with the configuration editor as a resource too with not much success.

I would appreciate any advice!

Cheers,

Csaba
fkf_card

Hi @csabatth,

first of all you’ll have to have the custom platform e.g. installed from HACS or manually from [1].
You’ll then have to set the sensor up as per the example shown in [1]. Pay attention to how do you specify the address fields.
Then restart HACS to have the sensor in effect.
Once you see the sensor and its attributes under Developer Tools->States, specifying the sensor in the card configuration it should show the schedule.

[1] https://github.com/amaximus/fkf-garbage-collection

Hi @amaximus,

Thanks for the quick response first of all! The sensor works fine and I can see all the upcoming garbage collection dates, my challenge is the proper card configuration apparently. When I try to add a new card to my dashboard then I cannot find the custom card downloaded from HACS, but I can of course add a new card manually based on the sensor entity. But it is nowhere near to your linked example i.e. there is only a single row and the remaining days is shown, that’s it.

I have tried to add these lines to the configuration (with some minor modifications like sensor name, etc.) but it did not help either:

resources:
  - {type: js, url: '/local/community/fkf-garbage-collection-card/fkf-garbage-collection-card.js'}
    cards:
      - type: custom:fkf-garbage-collection-card
        entity: sensor.my_garbage_schedule
        title: 'My garbage schedule'
        icon_size: 35px

I assume that I’m supposed to see the custom card when I try to add a new card to my lovelace dashboard, but this is not the case unfortunately. Did I miss something?

Cheers,

Csaba

Hi @csabatth,

please note that the resource definition should go into the configuration.yaml. The path should be /hacsfiles/fkf-garbage-collection-card/fkf-garbage-collection-card.js (I updated the Readme)
After adding/modifying it you’ll have to restart HA in order to have it in effect.

Card definition should go into your Lovelace dashboard definition file (default: ui-lovelace.yaml).
Please also note that the card does not support configuration flow, thus you’ll have to add the effective yaml-style definition.

Hi again amaximus,

I works as a charm, however the solution was somewhat different from that you had proposed. fkf_card_new
I added the card configuration to my lovelace configuration (without the resurce part). Up until now I was trying to define the resource as part of the card configuration and I believe that this mistake was the root cause of my problem. However when I tried to add the resource part to the configuration.yaml I got an error message saying that integration called “resource” was not found or something. But it has turned out that this is not needed, maybe because my custom card is part of the resources already under the configuration-lovelace section.

Anyhow, it works now as expected, thanks for pointing me to the right direction and of course for creating this excellent integration!

Cheers,

Csaba

ps.:I could not attach yet another picture about the mentioned resource section under lovelace/resource

I’m glad it got sorted out.

regards, Atticus

Oh this is excellent, thank you!
Do you accept feature requests?: https://www.fkf.hu/kerti-zoldhulladek-gyujtes :slight_smile: