Give rest component time-trigger support

I would like to be able to use time triggers in the rest platform.
Below I have a rest sensor where you can see that I pull every 2 minutes the current price of electricity in Sweden. However, this does not need to be run so often. If rest would support time trigger then I could make it once every hour (or maybe even once per day depending on the data), thus offloading the servers and minimizing the risk of them pulling free access to the api.

  - platform: rest
    name: NordPool prices
    resource_template: https://www.nordpoolgroup.com/api/marketdata/page/29?currency=SEK&endDate={{now().strftime("%d-%m-%Y")}}
    value_template: "{{ value_json.data.Rows[now().strftime('%H') | int].Columns[2].Value | replace(',', '.') | float / 1000 }}"
    unit_of_measurement: "SEK/kWh"
    scan_interval: 120

There is the homeassistant.update_entity service you can call.

It’s used by many people for exactly this - changing how often you update something.

1 Like

Thanks for the tip! :slight_smile:
It works, but it feels more like a hack than a solution…
It would feel more natural if the rest component supported a time trigger… Then you wouldn’t need automation more than necessary…