Help with rest.yaml file

I am looking for some help/guidance on my issue below. I have a rest.yaml file with the code below (I have removed the API Keys in the code). All the weather related sensors worked great but once I added the JSON soil snippet, it all stopped working. I get a green check in the file editor that all is good but then once I restart, I get this error message: Setup failed for ‘rest’: Invalid config.

8:59:25 AM – (ERROR) setup.py

Invalid config for ‘rest’ at configuration.yaml, line 24: ‘resource’ is an invalid option for ‘rest’, check: rest->0->sensor->5->resource, please check the docs at RESTful - Home Assistant Invalid config for ‘rest’ at configuration.yaml, line 24: ‘scan_interval’ is an invalid option for ‘rest’, check: rest->0->sensor->5->scan_interval, please check the docs at RESTful - Home Assistant

8:59:25 AM – (ERROR) config.py

resource: "https://api.weather.com/v2/pws/observations/current?stationId=StationID&format=json&units=e&apiKey=APIKEY"
method: GET
scan_interval: 75
sensor:
  - name: "Temperature.Weather_Station"
    unique_id: temp.weather_station
    value_template: '{{(value_json ["observations"][0] .imperial.temp | int) }}'
    unit_of_measurement: "°F"
  - name: "Heat Index.Weather_Station"
    unique_id: heat_index.weather_station
    value_template: '{{(value_json ["observations"][0] .imperial.heatIndex | int) }}'
    unit_of_measurement: "°F"
  - name: "Wind Chill.Weather_Station"
    unique_id: wind_chill.weather_station
    value_template: '{{(value_json ["observations"][0] .imperial.windChill | int) }}'
    unit_of_measurement: "°F"
  - name: "Rain Total.Weather_Station"
    unique_id: rain_total.weather_station
    value_template: '{{(value_json ["observations"][0] .imperial.precipTotal | round(2)) }}'
    unit_of_measurement: "in"
  - name: "Humidity.Weather_Station"
    unique_id: humidity.weather_station
    value_template: '{{(value_json ["observations"][0] .humidity | int) }}'
    unit_of_measurement: "%"
    device_class: humidity

  - name: JSON soil
    json_attributes:
       - dt
       - t10
       - moisture
       - t0
    scan_interval: 50000
    resource: “http://api.agromonitoring.com/agro/1.0/soil?polyid=Location_IDc&appid=API_Key”
    value_template: "{{ value_json.soildata }}"

Thanks for any help you all can provide.

Indentation wise, this should be a belonging to the first rest call. But it has attributes for a rest sensor. For a rest sensor the indentation is wrong.

Thank you, @Edwin_D !! That helped point me in the right direction and it is working now.

1 Like