@dooz127 wrote:
There are some integrations I’m only interested in updating while I’m actually accessing hass from the web or the mobile app. Is this something I can do within the hass automation framework or is it only possible via a python script, appdaemon, custom integration, etc.?
I was thinking something along the lines of:
automations.yaml
- id: <automation_id> alias: Update entity when a user is connected to the front end trigger: - platform: numeric_state entity_id: sensor.websocket_api above: 0 - platform: time_pattern minutes: 1 condition: platform: template value_template: '{{ states('sensor.websocket_api') > 0 }}' action: service: homeassistant.update_entity data: entity_id: sensor.pi_hole_ads_blocked_today entity_id: sensor.allergy_index_forecasted_average entity_id: sensor.u_s_air_pollution_level
Then, I would have to configure the above sensors with a really long scan interval:
configuration.yaml
pi_hole: host: !secret pi_hole_ip_address scan_interval: 86400 iqvia: zip: !secret zip_code monitored_conditions: - allergy_index_forecasted_average scan_interval: 86400 sensor: - platform: air_visual api_key: !secret air_visual_api_key scan_interval: 86400
Has anyone tried something similar? Or is this even a good idea? I’m mostly interested in doing this to reduce hass server load but this might be more useful for rate limited platforms/apis like google ones that might cost you money if you exceed their quotas or to limit data usage if you’ve got a limited mobile data plan.
Posts: 3
Participants: 2