Bin / Waste Collection

Followed the guidance above. When I clicked on the selenium UI, observed the session - clicked on it used password, it opened a black window in middle of the page for couple of seconds (remained) blank, then the session closed. Back in HA the entities were added successfully.

Only entry in the HA logs was:

Setup of sensor platform uk_bin_collection is taking over 10 seconds.
6:44:41 PM – (WARNING) Sensor

Gather its now a matter of waiting 12/24hours to see if it refreshes (or is there a way to force this earlier?)

HA logs this morning:-

Timeout fetching Home data
6:45:42 AM – (ERROR) UK Bin Collection Data (custom integration)

Logger: custom_components.uk_bin_collection.sensor
Source: helpers/update_coordinator.py:306
Integration: UK Bin Collection Data (documentation, issues)
First occurred: 6:45:42 AM (1 occurrences)
Last logged: 6:45:42 AM

Full log extract:

2024-01-09 06:44:42.066 INFO (MainThread) [custom_components.uk_bin_collection.sensor] [UKBinCollection] UKBinCollectionApp Updating
2024-01-09 06:45:42.067 ERROR (MainThread) [custom_components.uk_bin_collection.sensor] Timeout fetching Home data
2024-01-09 06:45:42.067 DEBUG (MainThread) [custom_components.uk_bin_collection.sensor] Finished fetching Home data in 60.001 seconds (success: False)
2024-01-09 06:45:42.067 INFO (MainThread) [custom_components.uk_bin_collection.sensor] [UKBinCollection] Applying values for sensor Food waste, black bin, green box, card sack
2024-01-09 06:45:42.074 INFO (MainThread) [custom_components.uk_bin_collection.sensor] [UKBinCollection] Data Stored in self.next_collection: 2024-01-09
2024-01-09 06:45:42.074 INFO (MainThread) [custom_components.uk_bin_collection.sensor] [UKBinCollection] Data Stored in self.name: Home Food waste, black bin, green box, card sack
2024-01-09 06:45:42.074 INFO (MainThread) [custom_components.uk_bin_collection.sensor] [UKBinCollection] _days: 0
2024-01-09 06:45:42.074 INFO (MainThread) [custom_components.uk_bin_collection.sensor] [UKBinCollection] State of the sensor: Today
2024-01-09 06:45:42.074 INFO (MainThread) [custom_components.uk_bin_collection.sensor] [UKBinCollection] Applying values for sensor Food waste, brown bin, paper sack, plastic and cartons bag
2024-01-09 06:45:42.075 INFO (MainThread) [custom_components.uk_bin_collection.sensor] [UKBinCollection] Data Stored in self.next_collection: 2024-01-16
2024-01-09 06:45:42.075 INFO (MainThread) [custom_components.uk_bin_collection.sensor] [UKBinCollection] Data Stored in self.name: Home Food waste, brown bin, paper sack, plastic and cartons bag
2024-01-09 06:45:42.075 INFO (MainThread) [custom_components.uk_bin_collection.sensor] [UKBinCollection] _days: 7
2024-01-09 06:45:42.075 INFO (MainThread) [custom_components.uk_bin_collection.sensor] [UKBinCollection] State of the sensor: Next Week: Tuesday

i think mine has too, but only noticed today. not sure if its been triggerd by the HA update. or The project updates.


TypeError: create_webdriver() missing 1 required positional argument: 'user_agent'
2024-01-15 01:16:52.260 DEBUG (MainThread) [custom_components.uk_bin_collection.sensor] Finished fetching bin data in 0.070 seconds (success: False)
2024-01-15 01:16:52.260 ERROR (MainThread) [homeassistant.components.sensor] Error while setting up uk_bin_collection platform for sensor
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 300, in _async_refresh
    self.data = await self._async_update_data()
                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/config/custom_components/uk_bin_collection/sensor.py", line 133, in _async_update_data
    data = await self.hass.async_add_executor_job(self.ukbcd.run)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/concurrent/futures/thread.py", line 58, in run
    result = self.fn(*self.args, **self.kwargs)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/uk_bin_collection/uk_bin_collection/collect_data.py", line 96, in run
    return self.client_code(
           ^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/uk_bin_collection/uk_bin_collection/collect_data.py", line 115, in client_code
    return get_bin_data_class.template_method(address_url, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/uk_bin_collection/uk_bin_collection/get_bin_data.py", line 78, in template_method
    bin_data_dict = self.parse_data(
                    ^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/uk_bin_collection/uk_bin_collection/councils/LeedsCityCouncil.py", line 40, in parse_data
    driver = create_webdriver(web_driver, headless)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
TypeError: create_webdriver() missing 1 required positional argument: 'user_agent'

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 360, in _async_setup_platform
    await asyncio.shield(task)
  File "/config/custom_components/uk_bin_collection/sensor.py", line 75, in async_setup_entry
    await coordinator.async_config_entry_first_refresh()
  File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 272, in async_config_entry_first_refresh
    raise ex
homeassistant.exceptions.ConfigEntryNotReady: create_webdriver() missing 1 required positional argument: 'user_agent'

Just merged the fix for this. Thanks to Ben.

As for the sensor @johnyb can you update and monitor?

I’ll also check

It should be there - can you provide more details on how you have added it ?

Thank you, mines back up.

Same issue here I’m afraid. Initially adding fine, but then losing it 12hrs later

Logger: custom_components.uk_bin_collection.sensor
Source: helpers/update_coordinator.py:306
Integration: UK Bin Collection Data (documentation, issues)
First occurred: January 15, 2024 at 8:30:44 PM (1 occurrences)
Last logged: January 15, 2024 at 8:30:44 PM
Timeout fetching H data
2024-01-15 08:22:23.850 WARNING (MainThread) [homeassistant.components.sensor] Setup of sensor platform uk_bin_collection is taking over 10 seconds.
2024-01-15 08:23:13.851 ERROR (MainThread) [homeassistant.components.sensor] Setup of platform uk_bin_collection is taking longer than 60 seconds. Startup will proceed without waiting any longer.
File "/config/custom_components/uk_bin_collection/sensor.py", line 133, in _async_update_data
File "/config/custom_components/uk_bin_collection/sensor.py", line 130, in _async_update_data
File "/config/custom_components/uk_bin_collection/sensor.py", line 75, in async_setup_entry
2024-01-15 20:30:44.142 ERROR (MainThread) [custom_components.uk_bin_collection.sensor] Timeout fetching H data

Think you may have cracked it (Chelmsford). Been working for over 24hrs. Much appreciated

I added the URL in HACS and downloaded it - restarted HA and tried adding the integration and then got the following error;

“Config flow could not be loaded: 500 Internal Server Error Server got itself in trouble”

I have the same issue today on both HA instances that I am running, I can’t seem to get it to work.

Hi and thanks for this integration which does indeed look very useful! However I am totally lost with how to integrate this into my HA instance.

I am running on a Raspberry Pi, I have installed the HACS repository, and I have the UPRN for my council (Haringey), but at the moment the add-on just shows ‘No devices or entities’:

This seems similar to the Selenium issue that was reported previously, but that doesn’t seem to be how Haringey provides its data.

1 Like

Just a quick update to say we are aware of issues with the latest update release (0.65.0), as the package hasn’t been published to PyPi. Therefore, please do not update the component via HACS for the time being (or until this issue is closed)

Should be fixed now 0.66.1

1 Like

did you find a fix ?

This integration is awesome, thank you for maintaining it.

I’ve got a question about the colour attribute. It’s currently set to red for all of my bins, I was expecting it to represent the colour of the bin itself.

I see here it seems to be hardcoded to red but I’m also very likely to be missing something when skim reading the code. UKBinCollectionData/custom_components/uk_bin_collection/sensor.py at 27f252cc51eacf8fdaa504b5210a9962e305f2c0 · robbrad/UKBinCollectionData · GitHub

Am I misunderstanding its purpose or is it not working for the council I’ve set this up for? (I’m interested in Wyre Council.)

Hi everyone - I have just released a new version where the attributes are now sensors

This should make it a lot easier to do automations etc

Please update and change your configurations

It’s complex to parse a colour from a council.

I have just released the ability to set colours for type when you setup the integration.

Check the readme.md for more details

Hi, can anyone point me in the direction of getting Selenium setup (I need that installed to access the information for my council).

I’ve got appdaemon running on HA and installed the following packages as per the code below.

But I’m not sure where to go next - do I need to add a .py file to /config/appdaemon/apps?

Sorry - still learning :slight_smile:
Thanks!

system_packages:
  - chromium-chromedriver
  - chromium
python_packages:
  - selenium
  - selenium==4.4.0
init_commands:
  - >-
    echo "http://dl-cdn.alpinelinux.org/alpine/edge/community" >
    /etc/apk/repositories
  - >-
    echo "http://dl-cdn.alpinelinux.org/alpine/edge/main" >>
    /etc/apk/repositories
  - apk update

You have a few options here

  1. Get docker installed and run Selenium standalone in a container
  2. Get Chromium installed on your HA server but when you setup the custom component don’t specify
wget https://chromedriver.storage.googleapis.com/<version>/chromedriver_linux64.zip
unzip chromedriver_linux64.zip
sudo mv chromedriver /usr/local/bin/
sudo chmod +x /usr/local/bin/chromedriver
1 Like

Got Carmarthenshire working, thankyou!

How do I get it to update/parse automatically, there doesn’t seem to be an option? Or does it do it automatically once/twice a day.

It hasn’t refreshed this morning for my 7am automations so they didn’t run as still on yesterday’s data.

Maybe forcing the integration to refresh via a script might be the way to go if needed by a set time?

Thanks in advance