Restful Sensors won't update unless UI is open—am I missing Something?

Hi all,

I’m hoping that I’ve missed something simple with this but the sensors I’ve created will only update when the UI is open (either web-based or mobile).

I have web-server running on a pi zero, using the envirophat as a sensor for temperature, pressure & light level. Everything works fine and the sensors update—but only when the UI is open.

I’ve tried specifying a scan-interval and enabling the force_update config variable but neither of those seems to make a difference.

Any ideas?

My alternative is to redefine the sensors as http sensors and have something like cron periodically send over the values. I thought that would be more cumbersome though.

# SENSORS
sensor:
    - platform: rest
      resource: http://XXX.XXX.XX.XX:XXXX
      name: Thermostat Sensor
      #scan_interval: 120
      #force_update: true
      json_attributes:
        - temperature
        - air_pressure
        - light_level
        - heating_status
      value_template: 'OK'
      
    - platform: template
      sensors:
        thermostat_temperature:
            friendly_name: Temperature
            value_template: '{{ states.sensor.thermostat_sensor.attributes["temperature"] }}'
            device_class: temperature
            unit_of_measurement: '°C'
        thermostat_air_pressure:
            friendly_name: Pressure
            value_template: '{{ states.sensor.thermostat_sensor.attributes["air_pressure"] }}'
            device_class: pressure
            unit_of_measurement: 'hPa'
        thermostat_light_level:
            friendly_name: Light Level
            value_template: '{{ states.sensor.thermostat_sensor.attributes["light_level"] }}'
            device_class: illuminance
            unit_of_measurement: 'lx'