Help with trigger template weather entity

Hi, I need some help with the new way of dealing with weather forecast entities.
I am trying to configure a custom weather entity, combining forecast from an online source with my own sensors.
I read that we have have to use a trigger template, calling weather.get_forecasts service.
Here is my code (which seems to work)

- trigger:
    - platform: state
      entity_id:
        - weather.casa
        - sensor.th_esterno_temperature
        - sensor.th_esterno_humidity
        - sensor.meteonetwork
    - platform: homeassistant
      event: start
  action:
    - service: weather.get_forecasts
      data:
        type: daily
      target:
        entity_id: weather.casa
      response_variable: daily_forecast
  weather:
    - name: Forecast Casa
      unique_id: forecast_casa
      condition_template: "{{ states('weather.casa') }}"
      temperature_template: "{{ states('sensor.th_esterno_temperature')|float(0) }}"
      temperature_unit: "°C"
      humidity_template: "{{ states('sensor.th_esterno_humidity')|float(0) }}"
      pressure_template: "{{ state_attr('sensor.meteonetwork', 'smlp')|float(0) }}"
      wind_bearing_template: "{{ state_attr('weather.casa', 'wind_bearing')|float(0) }}"
      wind_speed_template: "{{ state_attr('weather.casa', 'wind_speed')|float(0) }}"
      forecast_daily_template: "{{ daily_forecast['weather.casa'].forecast }}"

I want to trigger updates when any of the sources state changes, as opposed to fixed time pattern, but here is the problem: the code looks inefficient to me, as it calls weather.get_forecasts unnecessarily, in case of any change of my local sensors.
How can I update each part of the weather entity only when needed? Maybe using trigger IDs ?
Thanks in advance
Marco

What’s the problem with using the service call? It won’t use the API, it will use the data already available in HA. You will need to use the service call in any case, otherwise you don’t have the daily_forecast variable available.

The only thing you can do if you only want to use the weather.casa entity in case that caused the trigger is use the template weather itself in the service call in case it was not triggered by the weather entity.

BTW the homeassistant start trigger is not needed

  1. it will restore it’s state
  2. the other entities will change state (they will go from unavailable to a valid state, so it will be triggered anyway)

Ok, this eliminates my concern. I guess the integration providing weather.casa
is responsible to poll the API and update some cache, while weather.get_forecasts only polls the cache. Good to know

This is a clever idea, but not really needed if the above is true.

Noted.
Thanks a lot