Error when making automation

Hello all new user of ha,all is up to date with running now on latest.
Everytime i want to make a automation it says that the automation timed out and i should repair or adjust it.
But i dont see where it goes wrong?
I tried to make a automation to switch on the ligths (hue) on sunset and when i am home but it still gives me the error.
Anyone able to help me please?
Beginner with ha and tried to read other topics with this issue but cant figure t out.Your new automatisering was saved, but waiting for it to set up has timed out. This could be due to errors parsing your configuration.yaml, please check the configuration in developer tools. Your automatisering will not be visible until this is corrected and automatiseringen are reloaded. Changes to area, category, or labels were not saved and must be reapplied

Please post your configuration.yaml.

here you go

type or palias: Temperatuur woonkamer
description: ""
triggers:
  - type: temperature
    device_id: 6081442c1355c36a8eb41e99e896774a
    entity_id: 127ed50fd60044e57b5aa1b2b07322ad
    domain: sensor
    trigger: device
    above: 0.5
    below: 2
    for:
      hours: 0
      minutes: 5
      seconds: 0
conditions:
  - condition: climate.is_off
    target:
      entity_id: climate.climacontrol_airco_woonkamer_climate
    options:
      behavior: all
actions:
  - action: climate.set_temperature
    metadata: {}
    target:
      entity_id: climate.climacontrol_airco_woonkamer_climate
    data:
      hvac_mode: heat
      temperature: 14
  - action: climate.turn_on
    metadata: {}
    data: {}
    target:
      entity_id: climate.climacontrol_airco_woonkamer_climate
mode: single
aste code here

Remove this from your code.

This is your automation. I was asking to post the configuration.yaml :slight_smile: :wink:

We’ll get to that once we have verified that your configuration.yaml is correctly referencing the files.

Yeah, I was wondring about that too but postponed my reply to check the config file first.

@terlouweric73 , the automation file has to start with

alias: Temperatuur woonkamer

thanks for youre reply,where can i find the conf yaml?

It’s configuration.yaml.

You will have to install a file editor app. Go to Settings|Apps|Install App and search for File Editor.

this is what i found but never made myself

default_config:

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

#automation: !include automations.yaml
#script: !include scripts.yaml
scene: !include scenes.yaml
#template: !include templates.yaml# Example configuration.yaml entry


logger:
  default: error
  
recorder:
  exclude:
    entities:
      - sensor.time
      - sensor.date

nordpool:
  sensor:
    - platform: nordpool
      region: 'NL'
      currency: 'EUR'
      price_in_cents: true
      price_type: kWh
      VAT: true


  panels_off:
    name: Panelen uitschakelen bij
    initial: -1
    min: -10
    max: 20 #tijdelijk voor test
    

light:
  - platform: template
    lights:
      dummy_light:
        friendly_name: "Dummy Light"
        turn_on:
          service: light.turn_on
          entity_id: light.dummy_light
        turn_off:
          service: light.turn_off
          entity_id: light.dummy_light
        set_level:
          service: light.turn_on
          data_template:
            brightness: "{{ brightness }}"
            entity_id: light.dummy_light
            
# This is the non-sequential version of cheapest hours automation using local calendar for time schedules
# Read more at https://www.creatingsmarthome.com/?p=2543
template:
  -  sensor:
      # The actual cheapest hour sensor. If multiple entries are required, copy, raname, set unique_id and configure attributes.
      - name: "Laagste tarief"
        unique_id: cheapest_hours_energy_non_sequential
        state: >
          {%- set sensor = (this.attributes.get('sensor', 'sensor.nordpool') | string) -%}
          {{ state_attr(sensor, 'tomorrow_valid') }}
        attributes:
          # CHANGE-ME: Set your personal configurations in here
          number_of_hours: 12 # Amount of cheapest hours in search
          first_hour: 17 # Search starting hour
          last_hour: 16 # Search ending hour
          starting_today: true # Is the first_hour today (true / false). If false, first_hour needs to be before last_hour.
          sensor: sensor.nordpool # Nord pool sensor id. Check it ouf from your integrations page!
          fail_safe_starting: '00:00' # If nordpool fetch fails, starting time to make the calendar entry
          list: >-
            {%- set sensor = (this.attributes.get('sensor', 'sensor.nordpool') | string) -%}
            {%- set numberOfHours = (this.attributes.get('number_of_hours',1) | int) -%}
            {%- set lastHour = (this.attributes.get('last_hour',23) | int) -%}
            {%- set firstHour = (this.attributes.get('first_hour', 0) | int) -%}
            {%- set startingToday = (this.attributes.get('starting_today', false) | bool) -%}
            {%- set ns = namespace(data=[], loopResult=[], res=[], loop=0) -%}
            {%- if state_attr(sensor, 'tomorrow_valid') == true -%}
              {%- if startingToday == true -%}{%- set ns.starting = firstHour -%}{%- else -%}{%- set ns.starting = firstHour + 24 -%}{%- endif -%}
              {%- set ns.ending = lastHour + 24 + 1 -%}

              {%- set arr = state_attr(sensor, 'today') + state_attr(sensor, 'tomorrow') -%}
              {%- for i in range(ns.starting, ns.ending) -%}
               {%- set start = (today_at("00:00") + timedelta( hours = i)) -%}
               {%- set end = (today_at("00:00") + timedelta( hours = i+1)) -%}
               {%- set ns.data = ns.data + [{
                 "start" : (start | as_timestamp | timestamp_local),
                 "end" : (end | as_timestamp | timestamp_local),
                 "price" : arr[i]}
               ] -%}
              {%- endfor -%}
              {%- set ns.data = (ns.data | sort(attribute='price'))[:numberOfHours] | sort(attribute='start') -%}
              {%- set ns.loopResult = ns.data -%}
              {% for i in range(0, 48) %}
                {%- set ns.loop = 0 -%}
                {%- for i in range(ns.loopResult| length) -%}
                  {% if i < ns.loop %}
                    {%- continue -%}
                  {% endif %}
                  {%- if ns.loop+1 < (ns.loopResult | length) -%}
                    {%- if ns.loopResult[ns.loop].end == ns.loopResult[ns.loop+1].start -%}
                      {%- set d = {'start': (ns.loopResult[ns.loop].start), 'end': (ns.loopResult[ns.loop+1].end) } -%}
                      {%- set ns.loop = ns.loop + 1 -%}
                      {%- set ns.res = ns.res + [d] -%}
                    {%- else -%}
                      {%- set d = {'start': (ns.loopResult[ns.loop].start), 'end': (ns.loopResult[ns.loop].end) } -%}
                      {%- set ns.res = ns.res + [d] -%}
                    {%- endif -%}
                  {%- else -%}
                    {%- set d = {'start': (ns.loopResult[ns.loop].start), 'end': (ns.loopResult[ns.loop].end) } -%}
                    {%- set ns.res = ns.res + [d] -%}
                  {%- endif -%}
                  {%- set ns.loop = ns.loop + 1 -%}
                {%- endfor -%}
                {%- if ns.loopResult | count == ns.res | count -%}
                  {%- break -%}
                {%- endif -%}
                {%- set ns.loopResult = ns.res -%}
                {%- set ns.res = [] -%}
                {%- set ns.loop = 0 -%}
              {% endfor %}
              {{ ns.loopResult }}
            {%- else -%}
              {{ [] }}
            {%- endif -%}
          failsafe: >-
            {%- set numberOfHours = (this.attributes.get('number_of_hours',1) | int) -%}
            {%- set start = (this.attributes.get('fail_safe_starting', '00:00') | string) -%}
            {%- set startTime = (today_at(start) + timedelta( hours = 24)) -%}
            {%- set endTime = (today_at(start) + timedelta( hours = 24 + numberOfHours)) -%}
            {%- set res =
              {'start': (startTime | as_timestamp | timestamp_local),
               'end': (endTime | as_timestamp | timestamp_local) }
            -%}
            [{{ res }}]



  - sensor:
      - name: "nordpool_avg_price_48h"
        state: >
          {% set data = state_attr('sensor.nordpool', 'raw_today') + state_attr('sensor.nordpool', 'raw_tomorrow') %}
          {% set values = data | map(attribute='value') | list %}
          {% if values | length > 0 %}
            {{ (values | sum / values | length ) | round(2) }}
          {% else %}
            unknown
          {% endif %}

      - name: "nordpool_min_price_48h"
        state: >
          {% set data = state_attr('sensor.nordpool', 'raw_today') + state_attr('sensor.nordpool', 'raw_tomorrow') %}
          {% set values = data | map(attribute='value') | list %}
          {% if values | length > 0 %}
            {{ values | min }}
          {% else %}
            unknown
          {% endif %}

      - name: "nordpool_max_price_48h"
        state: >
          {% set data = state_attr('sensor.nordpool', 'raw_today') + state_attr('sensor.nordpool', 'raw_tomorrow') %}
          {% set values = data | map(attribute='value') | list %}
          {% if values | length > 0 %}
            {{ values | max }}
          {% else %}
            unknown
          {% endif %}
          

      - name: "nordpool_avg_price_24h"
        state: >
          {% set data = state_attr('sensor.nordpool', 'raw_today') + state_attr('sensor.nordpool', 'raw_tomorrow') %}
          {% set now = now().astimezone() %}
          {% set start_time = now.replace(hour=17, minute=0, second=0, microsecond=0) %}
          {% if now.hour >= 17 %}
          {% set end_time = start_time + timedelta(days=1) %}
          {% else %}
            {% set start_time = start_time - timedelta(days=1) %}
            {% set end_time = start_time + timedelta(days=1) %}
          {% endif %}
          {% set filtered_data = data | selectattr('start', '>=', start_time) | selectattr('start', '<', end_time) | list %}
          {% set values = filtered_data | map(attribute='value') | list %}
          {% if values | length > 0 %}
            {{ (values | sum / values | length) | round(2) }}
          {% else %}
            unknown
          {% endif %}

      - name: "nordpool_min_price_24h"
        state: >
          {% set data = state_attr('sensor.nordpool', 'raw_today') + state_attr('sensor.nordpool', 'raw_tomorrow') %}
          {% set now = now().astimezone() %}
          {% set start_time = now.replace(hour=17, minute=0, second=0, microsecond=0) %}
          {% if now.hour >= 17 %}
            {% set end_time = start_time + timedelta(days=1) %}
          {% else %}
            {% set start_time = start_time - timedelta(days=1) %}
            {% set end_time = start_time + timedelta(days=1) %}
          {% endif %}
          {% set filtered_data = data | selectattr('start', '>=', start_time) | selectattr('start', '<', end_time) | list %}
          {% set values = filtered_data | map(attribute='value') | list %}
          {% if values | length > 0 %}
            {{ values | min }}
          {% else %}
            unknown
          {% endif %}

      - name: "nordpool_max_price_24h"
        state: >
          {% set data = state_attr('sensor.nordpool', 'raw_today') + state_attr('sensor.nordpool', 'raw_tomorrow') %}
          {% set now = now().astimezone() %}
          {% set start_time = now.replace(hour=17, minute=0, second=0, microsecond=0) %}
          {% if now.hour >= 17 %}
            {% set end_time = start_time + timedelta(days=1) %}
          {% else %}
            {% set start_time = start_time - timedelta(days=1) %}
            {% set end_time = start_time + timedelta(days=1) %}
          {% endif %}
          {% set filtered_data = data | selectattr('start', '>=', start_time) | selectattr('start', '<', end_time) | list %}
          {% set values = filtered_data | map(attribute='value') | list %}
          {% if values | length > 0 %}
            {{ values | max }}
          {% else %}
            unknown
          {% endif %}
 
 
      - name: "nordpool_current_price"
        state: "{{ states('sensor.nordpool') }}"
        unit_of_measurement: "ct/kWh"

# Helpers to see if we've already created next day entries
input_boolean:
  cheapest_hours_non_sequential_set:
    name: Non-sequential cheapest hours set for the next day
    icon: mdi:clock

  was_above_threshold:
    name: Was Above Threshold
    initial: false

    
script:
# Script that creates the calendar entries from sensor
  cheapest_hours_create_multi_calendar:
    mode: parallel
    sequence:
      - repeat:
          count: "{{ state_attr(sensorId, attribute) | count }}"
          sequence:
            - service: calendar.create_event
              data:
                start_date_time: >
                  {{ state_attr(sensorId, attribute)[repeat.index-1].start | as_timestamp | timestamp_local }}
                end_date_time: >
                  {{ state_attr(sensorId, attribute)[repeat.index-1].end | as_timestamp | timestamp_local }}
                summary: >-
                  {{ summary }}
              target:
                entity_id: calendar.electricity


type or paste code here

Hhm, I wonder where all the entries are coming from then. Your configuration contains sensor defintions for an energy provider nordpool and some other stuff.

Do two things:

  • Add a new line
    homeassistant:
    at the begininning of the file above default_config:
  • Remove the # in
    #automation: !include automations.yaml

Currently your automations are not loaded and the system doesn’t know where to store new ones.

Reload all YAML (developer tools) or restart HA to be sure.

If you don’t need the nordpool stuff (probably something with dynamic electricity pricing), you may copy everything starting from “logger:” to the end of the file, save this to a text file on your computer and delete it. Then remove the # in #script: !include scripts.yaml.

If you do require the nordpool functionality, I advise to move these definitions out of configuration.yaml and place them in individual files.

that did it,retsarted HA and now i can store automations et.
Thanks a lot for youre help

Please mark my answer as solution for others to be able to find when they are searching.

Out of curiosity: where did this electricity things come from?

I really dont know,took over the thin client for near to nothing so i guess fromer owner didnt reset it ,
But now it even saves a automation so i am happy now
now figuring out how to work with my airco unit and tado how to make it working together
Thank you a lot for help

OK, then also remove the # in front of script: to avoid problems in the future.

will do ,again thanks a lot for your help