Multi rest sensors not updating

Hello Everyone

I am currently stuck when trying to extract 3 values from the following API: https://aareguru.existenz.ch/v2018/current?city=bern

I am interested in the values “aare.temperature_prec”, “aare.flow” & “bueber.state”, which I would like to have as sensor and the sensors should be updated every 5 minutes.

My configuration looks like this:

sensor:
  - platform: rest
    name: aareguru
    resource: https://aareguru.existenz.ch/v2018/current?city=bern
    json_attributes:
      - aare
      - bueber
    value_template: 'OK'.
    scan_interval: 300


  - platform: template
    sensors:
      aare_temperature:
        friendly_name: Aare Temperature
        entity_id: aare.temp
        value_template: '{{ states.sensor.aareguru.attributes["aare"]["temperature_prec"] }'
        device_class: temperature
        unit_of_measurement: '°C
      aare_flow:
        friendly_name: Aare Flow
        entity_id: aare.flow
        value_template: '{{ states.sensor.aareguru.attributes["aare"]["flow"] }'
        unit_of_measurement: 'm³/s
      aare_bueber:
        friendly_name: Aare Bueber
        entity_id: aare.bueber
        value_template: '{{ states.sensor.aareguru.attributes["bueber"]["state"] }'

The sensors are displayed, but only updated when Home Assistant is started. Nothing happens after that.

Can anyone help me what the issue might be?

Does the rest sensor provide the configured attributes?
Check them in Dev Tools/states

Also you’re missing a curly bracket at the end of every value_template.

'{{ states.sensor.aareguru.attributes["bueber"]["state"] }'
                                                         ^

You can check the templates in Dev Tools/templates.

Thanks for the quick reply!

I’ve checked the entities under dev tools/states and they are all here. I also see the sensors under dev tools/templates. Everything seems right. It’s just not updating the newest value automatically. The missing curly brackets are in my configuration file. I think there was a problem while copying and formatting this post here. Any suggestions?

Template sensors only update if entities in the templates change the state.
They will not update with the rest sensor if no state changes.

Thank you for the hint. I was able to get it to work with the following automation.

automation:
- id: update_aare_sensors
  alias: "Update Aare Sensors"
  initial_state: 'on'
  trigger:
    - platform: time_pattern
      minutes: '/5'
  action:
    service: homeassistant.update_entity
    data:
      entity_id:
      - sensor.aare_temperature
      - sensor.aare_flow
      - sensor.aare_bueber
      - sensor.aareguru