Error in Automation

I keep getting the following error but can’t figure out what is wrong

2017-11-17 10:06:27 ERROR (Thread-2) [homeassistant.util.yaml] while parsing a block mapping
  in "/home/mgranger/.homeassistant/automation/december.yaml", line 20, column 3
expected <block end>, but found '<block mapping start>'
  in "/home/mgranger/.homeassistant/automation/december.yaml", line 28, column 4
2017-11-17 10:06:27 ERROR (MainThread) [homeassistant.bootstrap] Error loading /home/mgranger/.homeassistant/configuration.yaml: while parsing a block mapping
  in "/home/mgranger/.homeassistant/automation/december.yaml", line 20, column 3
expected <block end>, but found '<block mapping start>'
  in "/home/mgranger/.homeassistant/automation/december.yaml", line 28, column 4


- alias: "Turn December On"
  hide_entity: True
  trigger:
    platform: state
    entity_id: 'calendar.home_assistant'
    from: 'off'
    to: 'on'
    
  condition:
    condition: and
    conditions:
      - condition: template
        value_template: '{{ states.calendar.home_assistant.attributes.message == "December" }}'

  action:
    - service: input_boolean.turn_on
      data:
        entity_id: input_boolean.december
       
- alias: "Turn December Off"
  hide_entity: True
  trigger:
    platform: state
    entity_id: 'calendar.home_assistant'
    from: 'on'
    to: 'off'
    
  condition:
    condition: and
    conditions:
      - condition: template
        value_template: '{{ states.calendar.home_assistant.attributes.message == "January" }}'

  action:
    - service: input_boolean.turn_off
      data:
        entity_id: input_boolean.december

# - alias: "December LEDs Morning On"
#  hide_entity: True
#  trigger:
#    platform: sun
#    event: sunrise
#    offset: '-01:00:00'
    
#  condition:
#    condition: and
#    conditions:
#      - condition: state
#        entity_id: input_boolean.december
#        state: 'on'

#      - condition: template
#        value_template: '{{ states.calendar.home_assistant.attributes.message == "December" }}'

#  action:
#    - service: mqtt.publish
#      data:
#        topic: 'home/livingroom/tvleds/setpower'
#        payload: 'ON'

#    - service: mqtt.publish
#      data:
#        topic: 'home/livingroom/tvleds/seteffect'
#        payload: 'Solid'

#    - service: mqtt.publish
#      data:
#        topic: 'home/livingroom/tvleds/setcolor'
#        payload: '255,0,0'
        
#    - service: mqtt.publish
#      data:
#        topic: 'home/livingroom/tvleds/setbrightness'
#        payload: '120'
        
#    - service: mqtt.publish
#      data:
#        topic: 'home/livingroom/cabinetleds/setpower'
#        payload: 'ON'

#    - service: mqtt.publish
#      data:
#        topic: 'home/livingroom/cabinetleds/seteffect'
#        payload: 'Solid'
        
#    - service: mqtt.publish
#      data:
#        topic: 'home/livingroom/cabinetleds/setcolor'
#        payload: '255,0,0'
                
#    - service: mqtt.publish
#      data:
#        topic: 'home/livingroom/cabinetleds/setbrightness'
#        payload: '120'
        
#    - service: mqtt.publish
#      data:
#        topic: 'home/kitchen/ledstrip/setpower'
#        payload: 'ON'

#    - service: mqtt.publish
#      data:
#        topic: 'home/kitchen/ledstrip/seteffect'
#        payload: 'Solid'

#    - service: mqtt.publish
#      data:
#        topic: 'home/kitchen/ledstrip/setcolor'
#        payload: '255,0,0'
        
#    - service: mqtt.publish
#      data:
#        topic: 'home/kitchen/ledstrip/setbrightness'
#        payload: '120'


# - alias: "December LEDs Morning Off"
#  hide_entity: True
#  trigger:
#    platform: sun
#    event: sunrise
#    offset: '00:30:00'

#  condition:
#    condition: and
#    conditions:
#      - condition: state
#        entity_id: input_boolean.december
#        state: 'on'

#  action: 
#    - service: mqtt.publish
#      data:
#        topic: 'home/livingroom/cabinetleds/setpower'
#        payload: 'OFF'
    
#    - service: mqtt.publish
#      data:
#        topic: 'home/livingroom/tvleds/setpower'
#        payload: 'OFF'
        
#    - service: mqtt.publish
#      data:
#        topic: 'home/kitchen/ledstrip/setpower'
#        payload: 'OFF'
        

- alias: "December LEDs Evening On"
  hide_entity: True
  trigger:
    platform: sun
    event: sunset
    offset: '00:05:00'
    
  condition:
    condition: and
    conditions:
      - condition: state
        entity_id: input_boolean.december
        state: 'on'

      - condition: template
        value_template: '{{ states.calendar.home_assistant.attributes.message == "December" }}'

  action:
    - service: mqtt.publish
      data:
        topic: 'home/livingroom/tvleds/setpower'
        payload: 'ON'

    - service: mqtt.publish
      data:
        topic: 'home/livingroom/tvleds/seteffect'
        payload: 'Solid'
        
    - service: mqtt.publish
      data:
        topic: 'home/livingroom/tvleds/setcolor'
        payload: '255,0,0'

    - service: mqtt.publish
      data:
        topic: 'home/livingroom/tvleds/setbrightness'
        payload: '120'
        
#    # - service: mqtt.publish
#      # data:
#        # topic: 'home/livingroom/cabinetleds/setpower'
#        # payload: 'ON'

#    # - service: mqtt.publish
#      # data:
#        # topic: 'home/livingroom/cabinetleds/seteffect'
#        # payload: 'Solid'
    
#    # - service: mqtt.publish
#      # data:
#        # topic: 'home/livingroom/cabinetleds/setcolor'
#        # payload: '255,0,0'
                
#    # - service: mqtt.publish
#      # data:
#        # topic: 'home/livingroom/cabinetleds/setbrightness'
#        # payload: '120'
        
#    # - service: mqtt.publish
#      # data:
#        # topic: 'home/kitchen/ledstrip/setpower'
#        # payload: 'ON'

#    # - service: mqtt.publish
#      # data:
#        # topic: 'home/kitchen/ledstrip/seteffect'
#        # payload: 'Solid'

#    # - service: mqtt.publish
#      # data:
#        # topic: 'home/kitchen/ledstrip/setcolor'
#        # payload: '255,0,0'
        
#    # - service: mqtt.publish
#      # data:
#        # topic: 'home/kitchen/ledstrip/setbrightness'
#        # payload: '120'
  
- alias: "December LEDs Evening Off"
  hide_entity: True
  trigger:
    platform: time
    at: '23:05:00'

  condition:
    condition: state
    entity_id: input_boolean.december
    state: 'on'
    
  action: 
    - service: mqtt.publish
      data:
        topic: 'home/livingroom/cabinetleds/setpower'
        payload: 'OFF'
    
    - service: mqtt.publish
      data:
        topic: 'home/livingroom/tvleds/setpower'
        payload: 'OFF'
        
    - service: mqtt.publish
      data:
        topic: 'home/kitchen/ledstrip/setpower'
        payload: 'OFF'
        
- alias: "Christmas Lights On"
  hide_entity: True
  trigger:
    platform: time
    at: '8:00:00'
  
  condition:
    condition: and
    conditions:
      - condition: state
        entity_id: input_boolean.december
        state: 'on'

      - condition: state
        entity_id: input_boolean.home
        state: 'on'
        
  action:
    - service: switch.turn_on
      entity_id: group.outlets
      
- alias: "Christmas Lights Off"
  hide_entity: True
  trigger:
    platform: time
    at: '23:05:00'
  
  action:
    - service: switch.turn_off
      entity_id: group.outlets
      
- alias: "Christmas Lights Arrival On"
  hide_entity: True
  trigger:
    platform: state
    entity_id: input_boolean.home
    to: 'on'
  
  condition:
    condition: and
    conditions:
      - condition: state
        entity_id: input_boolean.december
        state: 'on'

      - condition: time
        after: '8:01:00'
        before: '23:00:00'
        
  action:
    - service: switch.turn_on
      entity_id: group.outlets
      
- alias: "Christmas Lights Departure Off"
  hide_entity: True
  trigger:
    platform: state
    entity_id: input_boolean.home
    to: 'off'
  
  condition:
    condition: and
    conditions:
      - condition: state
        entity_id: input_boolean.december
        state: 'on'

      - condition: time
        after: '8:01:00'
        before: '23:00:00'
        
  action:
    - service: switch.turn_off
      entity_id: group.outlets

Any reason you’ve got condition: and for a single condition?

I usually do that so in case I add another condition I don’t have to reformat it.

The automation file you posted does not generate any errors on my test system. The error might be elsewhere.

I’m almost sure its an issue with your indentations. The linenumbers should point you to the right line. It’s hard to see it in the post…

The error says line 20 and 28. Line 20 is

- alias: "Turn December Off"

Line 28 is

condition:

There is something weird going on here because i can comment out the automation that is giving me trouble and it is still giving me error. Also I deleted the log file and it does not generate a new one.

1 Like

You have to restart HA for a new log file to be generated, as treno said it’s probably something above this automation that’s causing the error. Can you post the automations above this one?