Invalid config for rest sensor

Hi,

Yesterday I upgraded to the latest HA version from 2023.9.0. So far the Rest sensors were working correctly, now they are not working and in the log it appears:

Invalid config for [rest]: [name] is an invalid option for [rest]. Check: rest->rest->0->name (See /config/configuration.yaml, line 56). Please check the docs at RESTful - Home Assistant

The URL works correctly, I don’t know if there have been any changes in these new versions.

I have the rest sensors in a rest.yaml file that is inside a directory called sensors and declared in the configuration.yaml file.

# Kore
  - authentication: basic
    username: !secret kore_user
    password: !secret kore_pass
    scan_interval: 900
    timeout: 60
    resource: !secret kore_url
    sensor:
      - name: "todo"
        json_attributes_path: "data"
        value_template: "{{ value_json.data.value }}" 
        json_attributes:
          - "kh"
          - "ph1"

      - name: "kh-kore"
        value_template: "{{ (float (state_attr('sensor.todo', 'kh')['value'] )) /100 }}"
        unit_of_measurement: KH
      - name: "ph1-kore"
        value_template: "{{ (float (state_attr('sensor.todo', 'ph1')['value'] )) /100 }}"  
        unit_of_measurement: pH


Any suggestions?

Thanks

Is it possible you had edited the configuration.yaml and introduced a syntax error that was not discovered until HA was restarted after the upgrade?

Post the rest of the file.

I have not modified any configuration file.

This is configuration.yaml

# Loads default set of integrations. Do not remove.
default_config:

# Load frontend themes from the themes folder
frontend:
  themes: !include_dir_merge_named themes

# Text to speech
tts:
  - platform: google_translate
  
telegram_bot:
  - platform: polling
    api_key: xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
    allowed_chat_ids:
      - xxxxxxxxxxxxx


    
# CPU Raspberry

command_line:
    - sensor:
        name: Temperatura CPU
        command: "cat /sys/class/thermal/thermal_zone0/temp"
        unit_of_measurement: "°C"
        value_template: '{{ value | multiply(0.001) | round(0) }}'    
        
#IMAP
template:
  - trigger:
      - platform: event
        event_type: "imap_content"
        id: "profilux_mail_eventid"
    sensor:
      - name: "profilux_mail_sensor"
        state: "{{ trigger.event.data['subject'] }}"
        attributes:
          Message: "{{ trigger.event.data['text'] }}"
          Date: "{{ trigger.event.data['date'] }}"
          

automation: !include automations.yaml
script: !include scripts.yaml
scene: !include scenes.yaml
sensor: !include_dir_merge_list sensores
rest: !include rest.yaml
notify: !include notify.yaml

I have already solved it, I have removed the lines:

unit_of_measurement: KH 
unit_of_measurement: Ph

I don’t understand why this happened

1 Like