Is it possible for an automation to be triggered when a particular view in Lovelace is being displayed?
I thought it would be perfect for triggering an automation to update information only sensors on that page.
We have a new service home_assistant.update_entity to request the update of an entity, rather than waiting for the next scheduled update. This means you can set a really long scan_interval in the platform_options and then update on demand, ideal for those services where you have low API limit.`
You can make yourself an invisible card and then hand it all sensors you are using in that view.
Then you have your custom_card call the update service. It’s any async method though, so there might be some delay until they all update.
Sorry, my fault for not being clearer. I meant could an automation be triggered when a view is selected. I’m not yet up to writing a custom component/card. I’ll edit the OP.
Made it so it only triggers once you load the view.
At first I was confused, since the update service didn’t work.
Only then I found out that I needed to update ha
@perdemot
Hi,
I am trying to use the code you provided without any luck so far. I end up having:
Custom element doesn't exist: sensor-update-card.
in lovelace. I am running on hass.io with the latest version.
Apart for putting the js code in the sensor-update-card.js, adding that file to the resources, and adding the sensor-update-card in the view as shown is there something else I am missing. Is your code still working in the current ha version?