diff --git a/custom_components/waste_collection_schedule/waste_collection_schedule/source/bcp_gov_uk.py b/custom_components/waste_collection_schedule/waste_collection_schedule/source/bcp_gov_uk.py index e0de5acf9..edec1f959 100644 --- a/custom_components/waste_collection_schedule/waste_collection_schedule/source/bcp_gov_uk.py +++ b/custom_components/waste_collection_schedule/waste_collection_schedule/source/bcp_gov_uk.py @@ -33,7 +33,11 @@ def fetch(self): for bin in json_data: bin_type = bin["BinType"] - for date_str in [bin["Next"], bin["Subsequent"]]: + date_strs = [bin["Next"]] + if bin["Subsequent"] and bin["Subsequent"] != bin["Next"]: + date_strs.append(bin["Subsequent"]) + + for date_str in date_strs: date = ( datetime.strptime(date_str, "%m/%d/%Y %I:%M:%S %p") + timedelta(hours=1)