I m new hassio stucked in my first code and stucked for 3 hours...need guidance

from/to are not valid state conditions. State condition should be like:

- alias: "Security Arm/Disarm"
  initial_state: 'on'
  trigger:
    platform: state
    entity_id: input_boolean.security_status
  condition:
    condition: state
    entity_id: input_boolean.security_automation
    state: 'on'

See more examples at https://www.home-assistant.io/docs/scripts/conditions/ about how to use “for” with conditions.

condition:
  condition: state
  entity_id: device_tracker.paulus
  state: 'not_home'
  # optional: trigger only if state was this for last X time.
  for:
    hours: 1
    minutes: 10
    seconds: 5

It continues to say the issue is on line 13 - I have seen your previous post on this issue where you were getting help.

Looking at the automation documents, it looks like you still have indentation problems (I know you fixed some already).

This:

  condition:
    condition: or
    conditions:
    - condition: state
      entity_id: binary_sensor.motion_sensor_158d0003d19463
      to: 'on'
    - condition: state
      entity_id: binary_sensor.motion_sensor_158d00039571f9
      to: 'on'

Should be this (if I am reading the documents correctly):

  condition:
    condition: or
    conditions:
      - condition: state
        entity_id: binary_sensor.motion_sensor_158d0003d19463
        to: 'on'
      - condition: state
        entity_id: binary_sensor.motion_sensor_158d00039571f9
        to: 'on'

The actual condition list was not indented enough.

Let us know if that fixes this issue.

Cheers!
DeadEnd

Change your automation to make the conditions " state: ‘on’ " rather than " to: ‘on’ ". The condition is about the sensors BEING IN THAT STATE, not MOVING to that state.

Here you go, this passes the configuration check:

- alias: If the Door opens and motion detected on motion sensor"1" or "2"  turn On the lights
  trigger:
    platform: state
    entity_id: binary_sensor.door_window_sensor_158d000396a32c
    to: 'on'    
  condition:
    condition: or
    conditions:
    - condition: state
      entity_id: binary_sensor.motion_sensor_158d0003d19463
      state: 'on'
    - condition: state
      entity_id: binary_sensor.motion_sensor_158d00039571f9
      state: 'on'     
  action:
    service: light.turn_on
    entity_id: light.ceiling_light_1

You also don’t need the " from: ‘off’ " in the trigger, because a binary sensor can only have two states, if it’s already ‘on’ it won’t trigger, so the only way it can trigger is to be coming from ‘off’.

hi…im new hassio just writen some basic code for my door sernsors and light bulb and its giving me this error can ayone please guide me whats the issue…?

Invalid config for [automation]: [condition] is an invalid option for [automation]. Check: automation->trigger->0->condition. (See /config/configuration.yaml, line 13). Please check the docs at https://home-assistant.io/components/automation/
Invalid config for [automation]: extra keys not allowed @ data[‘condition’][0][‘conditions’][0][‘for’]. Got None
extra keys not allowed @ data[‘condition’][0][‘conditions’][0][‘from’]. Got None
extra keys not allowed @ data[‘condition’][0][‘conditions’][0][‘to’]. Got None
not a valid value for dictionary value @ data[‘condition’][0][‘conditions’][0][‘condition’]. Got None. (See /config/configuration.yaml, line 13). Please check the docs at
Invalid config for [automation]: extra keys not allowed @ data[‘condition’][0][‘conditions’][0][‘for’]. Got None
extra keys not allowed @ data[‘condition’][0][‘conditions’][0][‘from’]. Got None
extra keys not allowed @ data[‘condition’][0][‘conditions’][0][‘to’]. Got None
not a valid value for dictionary value @ data[‘condition’][0][‘conditions’][0][‘condition’]. Got None. (See /config/configuration.yaml, line 13). Please check the docs at


- alias: If the Door opens and motion detected on motion sensor"1" or "2"  turn On the lights
  trigger:
    platform: state
    entity_id: binary_sensor.door_window_sensor_158d000396a32c
    from: 'off'
    to: 'on'
    
    condition:
      condition: or
      conditions:
      - condition: state
        entity_id: binary_sensor.motion_sensor_158d0003d19463
        to: 'on'
      - condition: state
        entity_id: binary_sensor.motion_sensor_158d00039571f9
        to: 'on'
      
  action:
    service: light.turn_on
    entity_id: light.ceiling_light_1

- alias: If the Door is Closed and no motion detected turn Off the lights
  trigger:
    platform: state
    entity_id: binary_sensor.door_window_sensor_158d000396a32c
    from: 'on'
    to: 'off'
    
  condition:
    condition: or
    conditions:
    - condition: state
      entity_id: binary_sensor.motion_sensor_158d0003d19463
      from: 'on'
      to: 'off'
      for: '00:02:00'
    - condition: state
      entity_id: binary_sensor.motion_sensor_158d00039571f9
      from: on
      to: 'off'
      for: '00:02:00'
      
  action:
    service: light.turn_off
    entity_id: light.ceiling_light_1

- alias: If the bathroom Door opens turn On the bathroom lights
  trigger:
    platform: state
    entity_id: binary_sensor.door_window_sensor_158d000396bbb9
    from: 'off'
    to: 'on'
    
  action:
    service: light.turn_on
    entity_id: light.xiaomi_philips_smart_led_ball_2

- alias: If the bathroom Door closes and motion detected on sensor 2 for 05 minute turn off the bathroom lights
  trigger:
    platform: state
    entity_id: binary_sensor.door_window_sensor_158d000396bbb9
    from: 'on'
    to: 'off'
    
  condition:
    condition: or
    conditions:
    - condition: state
      entity_id: binary_sensor.motion_sensor_158d0003d19463
      from: 'off'
      to: 'on'
      for: '00:05:00'
      
  action:
    service: light.turn_off
    entity_id: light.xiaomi_philips_smart_led_ball_2

In the first automation, its condition section is indented incorrectly. Move this entire section (9 lines) to the left by two spaces.

In the last condition, you indicate:

    condition: or

but there is only one condition available.

1 Like

did the corrections but its still giving the same error…

Invalid config for [automation]: extra keys not allowed @ data[‘condition’][0][‘conditions’][0][‘to’]. Got None
not a valid value for dictionary value @ data[‘condition’][0][‘conditions’][0][‘condition’]. Got None. (See /config/configuration.yaml, line 13). Please check the docs at https://home-assistant.io/components/automation/
Invalid config for [automation]: extra keys not allowed @ data[‘condition’][0][‘conditions’][0][‘for’]. Got None
extra keys not allowed @ data[‘condition’][0][‘conditions’][0][‘from’]. Got None
extra keys not allowed @ data[‘condition’][0][‘conditions’][0][‘to’]. Got None
not a valid value for dictionary value @ data[‘condition’][0][‘conditions’][0][‘condition’]. Got None. (See /config/configuration.yaml, line 13). Please check the docs at https://home-assistant.io/components/automation/
Invalid config for [automation]: [conditions] is an invalid option for [automation]. Check: automation->trigger->0->conditions. (See /config/configuration.yaml, line 13)

anyone please…

Exactly what @123 said… post the code with the changes you made… that error is basically still telling us the condition is indented farther than it should be most likely.

after correction

Invalid config for [automation]: extra keys not allowed @ data[‘condition’][0][‘conditions’][0][‘to’]. Got None not a valid value for dictionary value @ data[‘condition’][0][‘conditions’][0][‘condition’]. Got None. (See /config/configuration.yaml, line 13). Please check the docs atInvalid config for [automation]: extra keys not allowed @ data[‘condition’][0][‘conditions’][0][‘for’]. Got None extra keys not allowed @ data[‘condition’][0][‘conditions’][0][‘from’]. Got None extra keys not allowed @ data[‘condition’][0][‘conditions’][0][‘to’]. Got None not a valid value for dictionary value @ data[‘condition’][0][‘conditions’][0][‘condition’]. Got None. (See /config/configuration.yaml, line 13). Please check the docs at https://home-assistant.io/components/automation/ Invalid config for [automation]: [conditions] is an invalid option for [automation]. Check: automation->trigger->0->conditions. (See /config/configuration.yaml, line 13).

- alias: If the Door opens and motion detected on motion sensor"1" or "2"  turn On the lights
  trigger:
    platform: state
    entity_id: binary_sensor.door_window_sensor_158d000396a32c
    from: 'off'
    to: 'on'
    
  condition:
    condition: or
    conditions:
    - condition: state
      entity_id: binary_sensor.motion_sensor_158d0003d19463
      to: 'on'
    - condition: state
      entity_id: binary_sensor.motion_sensor_158d00039571f9
      to: 'on'
      
  action:
    service: light.turn_on
    entity_id: light.ceiling_light_1

- alias: If the Door is Closed and no motion detected turn Off the lights
  trigger:
    platform: state
    entity_id: binary_sensor.door_window_sensor_158d000396a32c
    from: 'on'
    to: 'off'
    
  condition:
    condition: or
    conditions:
    - condition: state
      entity_id: binary_sensor.motion_sensor_158d0003d19463
      from: 'on'
      to: 'off'
      for: '00:02:00'
    - condition: state
      entity_id: binary_sensor.motion_sensor_158d00039571f9
      from: on
      to: 'off'
      for: '00:02:00'
      
  action:
    service: light.turn_off
    entity_id: light.ceiling_light_1

- alias: If the bathroom Door opens turn On the bathroom lights
  trigger:
    platform: state
    entity_id: binary_sensor.door_window_sensor_158d000396bbb9
    from: 'off'
    to: 'on'
    
  action:
    service: light.turn_on
    entity_id: light.xiaomi_philips_smart_led_ball_2

- alias: If the bathroom Door closes and motion detected on sensor 2 for 05 minute turn off the bathroom lights
  trigger:
    platform: state
    entity_id: binary_sensor.door_window_sensor_158d000396bbb9
    from: 'on'
    to: 'off'
    
    conditions:
    - condition: state
      entity_id: binary_sensor.motion_sensor_158d0003d19463
      from: 'off'
      to: 'on'
      for: '00:05:00'
      
  action:
    service: light.turn_off
    entity_id: light.xiaomi_philips_smart_led_ball_2

check it please replied

Please try to keep to a single topic - starting another with this same issue leads to tracking issues for resolution… I have replied back with what I believe is the error in line 13 of your automation in the other post you started.

Line 13 indentation is wrong - indent 2 more spaces for the actual conditions.

  condition:
    condition: or
    conditions:
      - condition: state
        entity_id: binary_sensor.motion_sensor_158d0003d19463
        to: 'on'
      - condition: state
        entity_id: binary_sensor.motion_sensor_158d00039571f9
        to: 'on'

DeadEnd

Your last automation… if bathroom door closes… the condition is indented too far…

The issue isn’t indentation.
The issue is that while triggers are about state CHANGES, conditions are about CURRENT STATE.

Change your automation to make the conditions " state: ‘on’ " rather than " to: ‘on’ ". The condition is about the sensors BEING IN THAT STATE, not MOVING to that state.

Here you go, this passes the configuration check:

- alias: If the Door opens and motion detected on motion sensor"1" or "2"  turn On the lights
  trigger:
    platform: state
    entity_id: binary_sensor.door_window_sensor_158d000396a32c
    to: 'on'    
  condition:
    condition: or
    conditions:
    - condition: state
      entity_id: binary_sensor.motion_sensor_158d0003d19463
      state: 'on'
    - condition: state
      entity_id: binary_sensor.motion_sensor_158d00039571f9
      state: 'on'     
  action:
    service: light.turn_on
    entity_id: light.ceiling_light_1

You also don’t need the " from: ‘off’ " in the trigger, because a binary sensor can only have two states, if it’s already ‘on’ it won’t trigger, so the only way it can trigger is to be coming from ‘off’.

1 Like

You already have one thread started on this exact same issue, don’t start another one. It’s unnecessary and only clogs up the forums.

Delete one of the threads.

Sure it was. It said so in the very first error message. It was unable to recognize the condition as a valid option. That one definitely needed to be cleared by correcting the indentation.

But, as we all know, that wasn’t the only error message. There were many others including, as you pointed out, the use of invalid options within the condition. That error was also spelled out in the first post (extra keys not allowed).

I opted out after 3 strikes:

  1. not seeing any updated code, just error messages and pleading for help
  2. creation of a parallel topic
  3. receiving an odd Private Message

The author of this topic ought to read the following:

That was useful.

Know when to hold 'em, know when to fold 'em.

yes bro you are very right, i must have violated some terms and conditions of the forum and i regret that, one thing i get that have to improve my basics of coding in order to get any technical help from here.

Creation of parallel topics: it was because i didn’t knew how this forum works, seen people are asking for help every second the i thought my topic must have fallen under and no one will be able to scroll down to that to get replies to solve my issue.

In private message i just tried to get to you to bring into your knowledge that i corrected the code you suggested but it didn’t work, and i was not aware that i have to post updated code every time so just shared the logs until someone asked for code. Anything odd in the private message i didn’t think so.
Although i have violated terms & conditions of forum and for that i regret again.

Please accept my apology for today, next time i’ll be very careful while asking here and please don’t judge me for today’s discussion. I’m just a newbie knows nothing about coding.

Thank you all for helping me today.

ALashari

For future reference, virtually all forums follow the same etiquette: don’t create multiple identical topics (also called ‘threads’). It’s called ‘spamming the forum’ and it is undesirable for many reasons including inefficiency: the answers to your question will be spread out over multiple threads. As you’ve seen, one of the forum moderators has consolidated your two threads by closing one and moving its contents to this one.

I am confident that the people who regularly answer questions know how to scroll a list.

People volunteer their time and expertise to answer questions. You may have noticed that you received responses (in both of your threads) fairly promptly. That’s impressive considering this is a free service done entirely on a voluntary basis. However, there’s no implied guarantee that the responses are correct, comprehensive, clear, or complete. It may take more than one person to respond to completely solve a problem.

Your part in this arrangement is to simply provide detailed information and … wait. Imagine if everyone here (there are over 45000 members) asked questions in multiple threads, repeatedly pleaded for help (every few minutes), and sent Private Messages (PM) to anyone who had responded as a way to draw them back to the discussion. I can’t speak for others but, if it worked like that, I wouldn’t be as active on this forum as I currently am.

It was a partial message; it contained nothing other than the answer I offered you. However, I understood its intent. It was meant to remind prod me to return to the discussion and continue to solve your problem. I’ve been a member here for almost a year now, and have helped hundreds of people, and that’s the first time anyone has ever done that.

To be clear, no one is under any obligation to provide assistance (let alone continual assistance per the questioner’s schedule), it’s all done on a voluntary basis and ‘at their pleasure’. On a personal note, there are some threads that, due to various reasons (my lack of interest or time or expertise), I choose not to participate in or to simply limit my participation. I imagine others may work the same way.

Everything I said, and much more, is described in the link I provided earlier: How to help us help you - or How to ask a good question

The combination of all the answers you’ve received should have cleared up most, if not all, of your error messages. Welcome to the community and good luck with your automation.

2 Likes