Best way to prevent a configuration.yaml sensor from updating on startup?

I have an endpoint like this:

command_line:
- sensor:
    command: "curl -s -X GET 'http://example.com/api' -H 'Authorization: Bearer {{ state_attr(\"sensor.access_token\", \"access\") }}'"
    value_template: "{{ value_json.amount }}"
    scan_interval: 31536000

I set the scan interval to a year because I want to control when it updates using actions (homeassistant.update_entity)

My problem is this updates every time home-assistant restarts. This endpoint has a really aggressive rate limit (4/day). This breaks the sensors every time I want to make changes to config and need to restart/reload home assistant. I can’t do anything about the endpoint. Is it possible to disable this behavior? Or circumvent it?

A restful sensor won’t work because headers can’t be templated and I can’t add the auth token (which only lasts 24h. I need it automated)

Unfortunately no it is not.

Not that it solves this problem directly, but oh yes they can:

image

You could potentially also template the URL of the resource as something invalid on startup, correcting it to the real resource once the system is up and running. Here, with the uptime integration installed:

resource_template: >
  {% if now()|as_timestamp - states('sensor.uptime')|as_timestamp(0) > 60 %}
    http://example.com/api
  {% else %}
    http://example.com/invalid_url
  {% endif %}