robbrad / UKBinCollectionData

UK Council Bin Collection Data Parser Outputting Bin Data as a JSON
MIT License
159 stars 95 forks source link

Unexpected error: time data '' does not match format '%A %d/%m/%Y' #1055

Open ryaaanmorgan opened 2 days ago

ryaaanmorgan commented 2 days ago

Home Assistant Version

2024.11.3

Installation Method

Using HACS

Name of Council (if relevant)

Carmarthenshire County Council

Issue Information

Following a restart of Proxmox - this integration now shows an error for this integration.

Reinstalling, restarting and readding the council does not solve the issue.

Logger: custom_components.uk_bin_collection Source: custom_components/uk_bin_collection/init.py:250 integration: UK Bin Collection Data (documentation, issues) First occurred: 7:23:38 pm (9 occurrences) Last logged: 7:30:10 pm

[UKBinCollection] Unexpected error: time data '' does not match format '%A %d/%m/%Y' Traceback (most recent call last): File "/config/custom_components/uk_bin_collection/init.py", line 250, in _async_update_data data = await asyncio.wait_for( ^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.12/asyncio/tasks.py", line 520, in wait_for return await fut ^^^^^^^^^ File "/usr/local/lib/python3.12/concurrent/futures/thread.py", line 58, in run result = self.fn(*self.args, self.kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.12/site-packages/uk_bin_collection/uk_bin_collection/collect_data.py", line 101, in run return self.client_code( ^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.12/site-packages/uk_bin_collection/uk_bin_collection/collect_data.py", line 121, in client_code return get_bin_data_class.template_method(address_url, kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.12/site-packages/uk_bin_collection/uk_bin_collection/get_bin_data.py", line 61, in template_method bin_data_dict = self.get_and_parse_data(this_url, kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.12/site-packages/uk_bin_collection/uk_bin_collection/get_bin_data.py", line 82, in get_and_parse_data bin_data_dict = self.parse_data(page, url=address_url, kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.12/site-packages/uk_bin_collection/uk_bin_collection/councils/CarmarthenshireCountyCouncil.py", line 44, in parse_data "collectionDate": datetime.strptime( ^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.12/_strptime.py", line 554, in _strptime_datetime tt, fraction, gmtoff_fraction = _strptime(data_string, format) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.12/_strptime.py", line 333, in _strptime raise ValueError("time data %r does not match format %r" % ValueError: time data '' does not match format '%A %d/%m/%Y'

Verification

Codiwr commented 1 day ago

Screenshot_20241127_070247_Home Assistant Thanks - same issue here

ryaaanmorgan commented 1 day ago

I think it’s because the green waste has now finished for the year and has a blank entry for the date.

So perhaps a small fix needed to account for the fact date entries could be blank or not formatted as a date.