Configuration error "required key not provided"

Hi all,

a fairly new, newbie here, looking at coding via templates to update calculations for weather conditions, and hitting the following problem:

Failed to restart Home Assistant

The system cannot restart because the configuration is not valid: Invalid config for [weather]: required key not provided @ data[‘platform’]. Got None. (See /config/configuration.yaml, line 13).

Please don’t say this is an obvious error, otherwise I believe I would have sorted it before now.

Configuration.yaml has the following include:

weather: !include weather_details.yaml

weather_details.yaml is defined as:

  alias: "update_statistics"
  trigger:
    - platform: state
      entity_id: sensor.netatmo_thermostat_indoor_rain_rain
#  action:
#    - service: input_number.set_value
#      value_template:
## rainfall today      
#      entity_id: input_number.daily_rain_total_today
#      value: >
#        {% sensor.netatmo_thermostat_indoor_rain_rain_today|float %}
# weekly rainfall total          
#    - service: input_number.set_value
#      value_template:
#      entity_id: input_number.weekly_rain_total_today
#      value: >
#        {% sensor.netatmo_thermostat_indoor_rain_rain_today|float + input_number.weekly_rain_total %}
## monthly rainfall total          
#    - service: input_number.set_value
#      value_template:
#      entity_id: input_number.monthly_rain_total_today
#      value: >
#        {% sensor.netatmo_thermostat_indoor_rain_rain_today|float + input_number.monthly_rain_total %}
## yearly rainfall total          
#    - service: input_number.set_value
#      value_template:
#      entity_id: input_number.yearly_rain_total_today
#      value: >
#        {% sensor.netatmo_thermostat_indoor_rain_rain_today|float + input_number.yearly_rain_total %}

I’ve commented out the lines, to try and determine where the problem lies, but even with these lines commented, the error is persisting.

Would anyone have any thoughts on how to resolve?

Thanks
Tony

Ok, I think I’ve found the solution. No change required for the weather_details.yaml file.

configuration.yaml needed to be changed from:

weather: !include weather_details.yaml

to

weather: !include_dir_merge_list weather_details.yaml

Hopefully that’s the solution, I’ll update if its not.
Thanks
Tony

This does not belong under weather: either

  alias: "update_statistics"
  trigger:
    - platform: state
      entity_id: sensor.netatmo_thermostat_indoor_rain_rain
#  action:
#    - service: input_number.set_value
#      value_template:
## rainfall today      
#      entity_id: input_number.daily_rain_total_today
#      value: >
#        {% sensor.netatmo_thermostat_indoor_rain_rain_today|float %}

Thanks for the feedback @tom_l , could you elaborate on where the trigger code etc should be held? With the change I made to configuration.yaml (see above), I’ve uncommented all the remaining code, and its not causing any problems, however I’m trying to learn about these automations, and how they should be written, so if you could provide more details, that would be really appreciated.

Thanks

If it is an automation it goes in automations. yaml.

If it is a triggered template sensor it goes under template: in your configuration.yaml file.

The format is not correct for either of these options though.