Open raldred opened 1 month ago
Please post the logs
So turns out that it was just timing out due to some images that timed out on the target council website. I have just blocked the offending URLs on my selenium runner host. Very strange that it seemed to work after a reload. Sorry for wasting your time.
I'm reopening this as there's definitely something not right... There isn't a huge amount of logs generated when enabling debug for this component but it seems like it just doesn't attempt to fetch updated data unless the integration is reloaded.
home-assistant_uk_bin_collection.log
Multiple similar blocks of logs where nothing changes apart from the _days
attribute
Only after a reload of the service on the integrations screen does it actually go and pull the latest data.
@raldred - if you look in your custom_components folder can you find this line
does it say 15m ?
@robbrad It does
async def async_added_to_hass(self):
"""When entity is added to hass."""
# Schedule periodic updates
self._unsub_update_interval = async_track_time_interval(
self.hass, self._update_state_based_on_time, timedelta(minutes=15)
)
I thought the call outs to the councils would be handled by the HouseholdBinCoordinator
?
Which seems like it's scheduled to run every 12h
def __init__(self, hass, ukbcd, name):
"""Initialize my coordinator."""
super().__init__(
hass,
_LOGGER,
name="UK Bin Collection Data",
update_interval=timedelta(hours=12),
)
_LOGGER.info(f"{LOG_PREFIX} UKBinCollectionApp Init")
self.ukbcd = ukbcd
self.name = name
Sorry yes the 15m is for the senors update the scrape is from HouseholdBinCoordinator
as you say
But what your observing is its not every 12 hours?
@robbrad not seeing it update at all unless I reload the integration or restart home assistant, then it updates the one time then never again until I do the same.
In the log file i included above covers 5 days I think, and there's only logging of updating today when i reloaded the integration, the same dates still showing days after collection.
Thanks @raldred im away this weekend but it looks like I need to restructure the sensor. Hopefully get to this early next week
No rush at all @robbrad, appreciate the quick back and forth.
I was trying to figure it out myself but honestly from my limited experience building custom components, the HouseholdBinCoordinator
looks to be pretty standard.
My understanding is that the HouseholdBinCoordinator should run every 12 hours to grab the latest data.
Mine isn't.
It only seems to run on the initial load of the integration. Either by restarting HA or by reloading the service from the device screen.
Any ideas? I can't see anything in the logs.