Developer Tools Check and restart stuck in a loop

FWIW, I am not a programmer. In respect of HA, I stand on the shoulders of giants.

I set out to follow this guide.
☔ DIY Zigbee rain gauge

Was trying to work through implementing the following to my existing sensors.yaml

There were many fits and starts, modifying the file and then checking on the Developer YAML tab. Have not yet managed to get it right but finally, on my latest effort, I think that I bumped the laptop touchpad on the developer page at the same time I selected Check and restart. Now the function is apparently stuck in a loop with a mostly completed blue circle spinning in the center. Nothing I have tried has made it stop. Re-loading sensors.yaml with a modification, closing the app, etc.

Here is my sensors.yaml

  • platform: rest
    name: JSON soil
    json_attributes:

  • platform: template
    sensors:
    soil_10cm:
    friendly_name: “Soil at 10cm”
    value_template: “{{ (state_attr(‘sensor.json_soil’, ‘t10’) | float * 9/5 - 459.67) | round(2) }}”
    entity_id: sensor.soil_10cm_f
    unit_of_measurement: “F”

    soil_moisture:
    friendly_name: “Soil moisture”
    value_template: “{{ state_attr(‘sensor.json_soil’, ‘moisture’) }}”
    entity_id: sensor.soil_moisture
    unit_of_measurement: “VWC”

    soil_surface:
    friendly_name: “Soil Surface”
    value_template: “{{ (state_attr(‘sensor.json_soil’, ‘t0’) | float * 9/5 - 459.67) | round(2) }}”
    entity_id: sensor.soil_surface_f
    unit_of_measurement: “F”

  • platform: history_stats
    name: Rain sensor flips
    entity_id: binary_sensor.rain_sensor_on_off
    state: ‘off’
    type: count
    start: ‘{{ now().replace(hour=0, minute=0, second=0) }}’
    end: ‘{{ now() }}’

  • platform: template
    sensors:
    rainfall_today:
    friendly_name: “Rainfall today”
    unit_of_measurement: “inches”
    state_class: total_increasing
    state: >-
    {% set count = states(‘sensor.rainsensor_flips’) | int(0) %}
    {% set inch = count * 0.01193 %}
    {% if count >= 0 %}
    {{ inch|round(1, ‘floor’) }}
    {% endif %}
    # If you have issues with the history sensor doubling after restarting HA, add the line below (@BigG)
    availability: “{{ (states(‘sensor.rainsensor_flips’) not in (‘unknown’, ‘unavailable’)) }}”

  • You have defined four Template Sensors.
  • Three are configured using legacy format (a deprecated but still supported style of defining a Template Sensor).
  • The fourth one, sensor.rainfall_today, is configured using modern format.

The Template Sensor defined using modern format should not be placed in your sensors.yaml file. It belongs in configuration.yaml under the template: key or in a separate file, such as templates.yaml if your configuration.yaml file contains something like this:

template: !include templates.yaml

In other words, you probably already have the following in your configuration.yaml so that’s why you are putting sensor configurations in sensors.yaml.

sensor: !include sensors.yaml

The same thinking applies to template entities configured in modern format; they go wherever the template: key says they should (directly under the key or in the file it points to).

Hi, Thank you very much for responding.
I created a templates.yaml file and cut/pasted it’s contents from the sensors.file. I spent a lot of time yesterday playing with syntax, spacing, etc to find success. I’ll review the contents of the file and compare it to the original model I’m following.

I also added templates to configuration.yaml.

group: !include groups.yaml
automation: !include automations.yaml
script: !include scripts.yaml
scene: !include scenes.yaml
sensor: !include sensors.yaml
template: !include templates.yaml

Here is templates.yaml

- platform: template
  sensors:
      rainfall_today:
      friendly_name: "Rainfall today"
      unit_of_measurement: "inches"
      state_class: total_increasing
      state: >-
          {% set count = states('sensor.rainsensor_flips') | int(0) %}
          {% set inch = count * 0.01193 %}
          {% if count >= 0 %}
            {{ inch|round(1, 'floor') }}
          {% endif %}
          # If you have issues with the history sensor doubling after restarting HA, add the line below (@BigG)
          availability: "{{ (states('sensor.rainsensor_flips') not in ('unknown', 'unavailable')) }}"

Here is the latest output when I ran Check Configuration on the Yaml Developer page.

Configuration errors
Unexpected error calling config validator: argument of type 'NoneType' is not iterable

Its contents are incorrect. You created a Template Sensor that combines legacy and modern styles resulting in an invalid hybrid. It should be in modern style exclusively (refer to the documentation).

  - sensor:
      - name: "Rainfall today"
        unit_of_measurement: "inches"
        state_class: total_increasing
        state: >-
          {% set count = states('sensor.rainsensor_flips') | int(0) %}
          {% set inch = count * 0.01193 %}
          {% if count >= 0 %}
            {{ inch|round(1, 'floor') }}
          {% else %}
            {{ this.state | default (0) }}
          {% endif %}
        availability: "{{ states('sensor.rainsensor_flips') not in ('unknown', 'unavailable') }}"

Thank you.
I corrected it and got no objections upon Check Configuration.
Here’s the current templates.yaml

template:
   - sensor:
       - name: Rainfall_today
         unit_of_measurement: inch
         state_class: total_increasing
         unique_id: rainfall_today
         state: >-
          {% set count = states('sensor.rainsensor_flips') | int(0) %}
          {% set inch = count * 0.01193 %}
          {% if count >= 0 %}
            {{ inch|round(1, 'floor') }}
          {% endif %}
          # If you have issues with the history sensor doubling after restarting HA, add the line below (@BigG)
          #availability: "{{ (states('sensor.rainsensor_flips') not in ('unknown', 'unavailable')) }}"

I did however have a log notification.

Logger: homeassistant.config
Source: config.py:623
First occurred: 4:26:29 PM (4 occurrences)
Last logged: 4:35:32 PM

Invalid config for 'template' at templates.yaml, line 1: 'template' is an invalid option for 'template', check: template

Pondering that one now.

I moved the template.yaml code to configuration.yaml and things are much improved.
No notifications, etc.

Thanks for the help!