Configuration warning from a problem in package

Can someone help me figure out how to write the below in a way that satisfies home assistant? I am getting all of the warning/ errors shown in the second code post below when checking the config in developer tools.

Thank you all.

It should be worth noting that I have other platforms in the same yaml file.

Also, how do you know when to use “sensor” or “sensors” as a key. I am seeing both through the reviewing of other code blocks.

  - platform: template
    trigger:
      - platform: time_pattern
        hours: /1
    action:
      - service: weather.get_forecasts
        data:
          type: twice_daily
        target:
          entity_id: weather.home_accuweather
        response_variable: x
    sensors:
      name: Current Forecast
      state: "{{ now().isoformat() }}"
      attributes:
        forecast: >-
          {{ x['weather.home_accuweather'].forecast[0] }}
        temperature: >-
          {{ x['weather.home_accuweather'].forecast[0].temperature }}
        templow: >-
          {{ x['weather.home_accuweather'].forecast[0].templow }}
        wind_bearing: >-
          {{ x['weather.home_accuweather'].forecast[0].wind_bearing }}
        wind_speed: >-
          {{ x['weather.home_accuweather'].forecast[0].wind_speed }}
        precipitation: >-
          {{ x['weather.home_accuweather'].forecast[0].precipitation }}  
Configuration warnings
Invalid config for 'template' from integration 'sensor' at packages/weather.yaml, line 102: 'action' is an invalid option for 'sensor.template', check: action
Invalid config for 'template' from integration 'sensor' at packages/weather.yaml, line 110: expected dictionary for dictionary value 'sensors->name', got 'Current Forecast'
Invalid config for 'template' from integration 'sensor' at packages/weather.yaml, line 111: expected dictionary for dictionary value 'sensors->state', got '{{ now().isoformat() }}'
Invalid config for 'template' from integration 'sensor' at packages/weather.yaml, line 112: required key 'value_template' not provided
Invalid config for 'template' from integration 'sensor' at packages/weather.yaml, line 113: 'forecast' is an invalid option for 'sensor.template', check: sensors->attributes->forecast
Invalid config for 'template' from integration 'sensor' at packages/weather.yaml, line 115: 'temperature' is an invalid option for 'sensor.template', check: sensors->attributes->temperature
Invalid config for 'template' from integration 'sensor' at packages/weather.yaml, line 117: 'templow' is an invalid option for 'sensor.template', check: sensors->attributes->templow
Invalid config for 'template' from integration 'sensor' at packages/weather.yaml, line 119: 'wind_bearing' is an invalid option for 'sensor.template', check: sensors->attributes->wind_bearing
Invalid config for 'template' from integration 'sensor' at packages/weather.yaml, line 121: 'wind_speed' is an invalid option for 'sensor.template', check: sensors->attributes->wind_speed
Invalid config for 'template' from integration 'sensor' at packages/weather.yaml, line 123: 'precipitation' is an invalid option for 'sensor.template', check: sensors->attributes->precipitation

First that’s not a warning that’s an error. That template is invalid.

Its barfing on Action and Sensor (not sensors) because your indentation is wrong

Authoritative doc. If it conflicts with this go back to this:

You’re probably mixing old and new formats it’s looking for value_template instead of state. Why it’s barfing on that entry

Everything else should resolve once you fix those. I think the attrubutes are blowing up because of sensor(s)

@NathanCu
Thank you for your reply and that link. Here is what I have now:

template:
  - trigger:
    - platform: time_pattern
      hours: /1
    action:
      - service: weather.get_forecasts
        data:
          type: hourly
        target:
          entity_id: weather.turner_house
        response_variable: x
    sensor:
      - name: Current Forecast
        state: "{{ now().isoformat() }}"
        attributes:
          forecast: >-
            {{ x['weather.turner_house'].forecast[0] }}
          temperature: >-
            {{ x['weather.turner_house'].forecast[0].temperature }}
          templow: >-
            {{ x['weather.turner_house'].forecast[0].templow }}
          wind_bearing: >-
            {{ x['weather.turner_house'].forecast[0].wind_bearing }}
          wind_speed: >-
            {{ x['weather.turner_house'].forecast[0].wind_speed }}
          precipitation: >-
            {{ x['weather.turner_house'].forecast[0].precipitation }} 

No config errors now but for some reason when I go into developer tools, it’s still now showing any state at all when using the states lookup.

Any thoughts? I’m sorry, I’m far from an expert with HA and def not a programmer.

you have this:

which means it will trigger the action and fill the data every hour on the hour. so it may need to wait till top of the hour before it has data???

maybe change hours there to minutes just for testing to make sure it work (wait till top of minute then). if that doesn’t work check the logs after a minute and see if there was an error outputted when it tried.

1 Like

I was wandering about that when I went to sleep last night.

Thank you for replying here. I will give it a look this morning when I get to my pc.

Thank you again @armedad