amaximus / fkf-garbage-collection Goto Github PK
View Code? Open in Web Editor NEWFKF Budapest Garbage Collection custom component for Home Assistant
FKF Budapest Garbage Collection custom component for Home Assistant
I am using your integration for a long time, and now I have added the last two options to enable the green garbage schedule, but it seems unavailable, how ever it should be every Wednesday.
.
This is my config in my sensors.yaml
And these attributes of the sensor.fkf_my_schedule are available:
current: current
next_communal_days: 1
next_green_days: null
next_selective_days: 19
calendar_lang: en
provider: Data provided by fkf.hu
items: 6
in0: 1
day0: Friday
date0: 2024.03.22
garbage0: communal
in1: 8
day1: Friday
date1: 2024.03.29
garbage1: communal
in2: 15
day2: Friday
date2: 2024.04.05
garbage2: communal
in3: 19
day3: Tuesday
date3: 2024.04.09
garbage3: selective
in4: 22
day4: Friday
date4: 2024.04.12
garbage4: communal
in5: 29
day5: Friday
date5: 2024.04.19
garbage5: communal
icon: mdi:trash-can-outline
friendly_name: fkf_my_schedule
If HA versions are needed:
Core 2024.3.1
Supervisor 2024.03.0
Operating System 12.1
Frontend 20240307.0
There are districts, where the green waste collection day depends on the address location, the collection in those districts is distributed for the several weekdays:
9 https://www.fkf.hu/kerti-zoldhulladek-korzetek-iv-kerulet
10 https://www.fkf.hu/kerti-zoldhulladek-korzetek-x-kerulet
14 https://www.fkf.hu/kerti-zoldhulladek-korzetek-xiv-kerulet
15 https://www.fkf.hu/kerti-zoldhulladek-korzetek-xv-kerulet
16 https://www.fkf.hu/kerti-zoldhulladek-korzetek-xvi-kerulet
17 https://www.fkf.hu/kerti-zoldhulladek-korzetek-xvii-kerulet
18 https://www.fkf.hu/kerti-zoldhulladek-korzetek-xviii-kerulet
19 https://www.fkf.hu/kerti-zoldhulladek-korzetek-xix-kerulet
20 https://www.fkf.hu/kerti-zoldhulladek-korzetek-xx-kerulet
21 https://www.fkf.hu/kerti-zoldhulladek-korzetek-xxi-kerulet
22 https://www.fkf.hu/kerti-zoldhulladek-korzetek-xxiii-kerulet
Currently the first day of a district's list is displayed in HA.
The solution might be challenging, as the color squares near the days are stored in images, and the polygons for the day are colored on a custom google map layer.
Two solution ideas:
Hi amaximus,
tried to implement your sensor and card...but log shows the following:
Log Details (WARNING)
Logger: homeassistant.helpers.entity
Source: helpers/entity.py:284
First occurred: 9:52:47 PM (1 occurrences)
Last logged: 9:52:47 PM
Updating state for sensor.fkf_my_schedule (<class 'custom_components.fkf_garbage_collection.sensor.FKFGarbageCollectionSensor'>) took 2.034 seconds. Please report it to the custom component author.
Card sadly doesn't even appear. Is there a way to solve this?
Would be glad for any help here.
Btw. looks beautiful, can't wait to make it work. :-)
Hi amaximus,
I couldn't set the calendar language to Hungarian.
Please see below my config.
platform: fkf_garbage_collection
name: 'fkf'
zipcode: !secret fkf_zipcode
publicplace: !secret fkf_publicplace
housenr: !secret fkf_housenr
offsetdays: 1
calendar: false
calendar_lang: hu
green: true
greencolor: rozsaszin
fkf-garbage-collection-card shows weekdays in English.
Could you give me a hint how to resolve this issue?
Thank you,
varmik
I receive the following error message when setting up the sensor:
aiohttp.client_exceptions.ClientConnectorCertificateError: Cannot connect to host www.fkf.hu:443 ssl:True [SSLCertVerificationError: (1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:1125)')]
fkf changed its SSL cert recently issued by e-Szigno, I am not sure if this has anything to do with the above issue though.
Lately we experience that FKF's website becomes unavailable for various periods of time. If somebody starts/restarts HA during such a period, the component does not load at all and generates this error in the log:
2021-11-08 19:20:30 ERROR (MainThread) [homeassistant.components.sensor] fkf_garbage_collection: Error on device update!
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 431, in _async_add_entity
await entity.async_device_update(warning=False)
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 651, in async_device_update
await task
File "/config/custom_components/fkf_garbage_collection/sensor.py", line 349, in async_update
fkfdata = await async_get_fkfdata(self)
File "/config/custom_components/fkf_garbage_collection/sensor.py", line 197, in async_get_fkfdata
async with self._session.post(url, data=payload, headers=headers) as response:
File "/usr/local/lib/python3.9/site-packages/aiohttp/client.py", line 1117, in __aenter__
self._resp = await self._coro
File "/usr/local/lib/python3.9/site-packages/aiohttp/client.py", line 544, in _request
await resp.start(conn)
File "/usr/local/lib/python3.9/site-packages/aiohttp/client_reqrep.py", line 890, in start
message, payload = await self._protocol.read() # type: ignore
File "/usr/local/lib/python3.9/site-packages/aiohttp/streams.py", line 604, in read
await self._waiter
aiohttp.client_exceptions.ServerDisconnectedError: Server disconnected
The situation can only be recovered by restarting HA when FKF website is available.
My suggestion is to avoid this, is to handle this error, and load the component with the sensors set to unavailable and not current (maybe reload the last values from recorder). The component should re-check periodically for the site becoming available and update the sensors accordingly after that.
For ZIP code 1184 and any street, next_green_days: null
is in attributes of the sensor. Looks like the code doesn't parse for the street at all, because various zones of the 18. district are collected on various days:
https://www.fkf.hu/kerti-zoldhulladek-korzetek-xviii-kerulet
Same for 17. district, 04. district etc
Hello,
I really like your development and used it without issue until now.
With the help of Custom Button Card and templating, I created some indication/warning cards on my Dashboard, but this change resulted in my own card representation does not work any more...
To make it work again, I would need to understand the new concept of the data model, but from the entity states viewer I could not find out what to expect.
I can share the code of the card if that helps in understanding my problem.
Thanks in advance
sensor:
kártya
type: custom:fkf-garbage-collection-card
entity: sensor.kukat_kivinni
icon_size: 35px
items_number: 1
hide_wday: true
due_1_color: red
hide_before: 1
2021-12-12 11:04:27 ERROR (MainThread) [homeassistant.components.sensor] fkf_garbage_collection: Error on device update!
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 431, in _async_add_entity
await entity.async_device_update(warning=False)
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 684, in async_device_update
await task
File "/config/custom_components/fkf_garbage_collection/sensor.py", line 369, in async_update
fkfdata = await async_get_fkfdata(self)
File "/config/custom_components/fkf_garbage_collection/sensor.py", line 271, in async_get_fkfdata
_LOGGER.debug("Fetch info for %s/%s/%s: %s", self._zipcode, self._publicplace, self._housenr, s)
UnboundLocalError: local variable 's' referenced before assignment
type: custom:fkf-garbage-collection-card
card_mod:
style: |
ha-card {
background: lightgrey;
box-shadow: none;
color: red
}
entity: sensor.fkf_my_schedule
title: Kuka
icon_size: 35px
I see the integration updates sensor once per hour. But if for some reason it could not update the sensor it stays as 'unknown' till the next refresh (actually, only two 'next' fields are at 'null', the rest are not updated, see below). Also, I could not find any error message in log for this unsuccessful update event. My router is usually off during night and I see corresponding connectivity issues in log for this period. But this issue occurred during day, when the internet is on and no log msg, maybe there is another bug?
items: 6 in0: 1 day0: Friday date0: 2022.01.07 garbage0: communal in1: 8 day1: Friday date1: 2022.01.14 garbage1: communal in2: 14 day2: Thursday date2: 2022.01.20 garbage2: selective in3: 15 day3: Friday date3: 2022.01.21 garbage3: communal in4: 22 day4: Friday date4: 2022.01.28 garbage4: communal in5: 29 day5: Friday date5: 2022.02.04 garbage5: communal current: current next_communal_days: null next_selective_days: null calendar_lang: en provider: Data provided by fkf.hu icon: mdi:trash-can-outline friendly_name: fkf_garbage_schedule
I use this integration for a while with own UI card. But I have never seen the 'green' garbage schedule is appeared in the sensor, considering the green: true
in my configuration.yaml
of course. How can I catch it?
Below what I have at the moment, there are only communal or selective items:
items: 7
in0: 0
day0: Thursday
date0: 2023.07.06
garbage0: selective
in1: 1
day1: Friday
date1: 2023.07.07
garbage1: communal
in2: 8
day2: Friday
date2: 2023.07.14
garbage2: communal
in3: 15
day3: Friday
date3: 2023.07.21
garbage3: communal
in4: 22
day4: Friday
date4: 2023.07.28
garbage4: communal
in5: 28
day5: Thursday
date5: 2023.08.03
garbage5: selective
in6: 29
day6: Friday
date6: 2023.08.04
garbage6: communal
current: current
next_communal_days: 1
next_green_days: null
next_selective_days: 0
calendar_lang: en
provider: Data provided by fkf.hu
icon: mdi:recycle
friendly_name: fkf_garbage_schedule
Pont gondoltam arra pár hete hogy írni kéne egy bővítményt erre a célra.
Köszönjük!
It would be good if garbage collection dates could be integrated into native HA calendar. I think you should inherit from CalendarEventDevice instead of Entity.
Hello!
Are you planning to use the JSON attribute here too as in [bkk_stop] (amaximus/bkk_stop@c57faa2)?
I thing this would be a cool feature for data processing because of Jinja templates restricts.
Thank you!
It’s only shown me a date since the last update, and that’s not well. I've already uninstalled the extension and reinstalled it. Unfortunately, I didn't realize what could be wrong. Do you have any ideas?
Thanks for the help!
https://horvathkaroly.hu/fkf_1.png
https://horvathkaroly.hu/fkf_2.png
Szia Attila,
Nem tudom jelezte-e már valaki, de nekem úgy tunik, hogy a 2023.6-os update "eltörte" az integrációt, 5.4-re történö visszaállás után ismét muködik.
Köszönöm ha foglalkozol vele.
Udv.
Csaba
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.