Conditions in automation!

Hi all i’d like my light turn on when i enter home and is after a specific time on a specific season, i can’t reach it i think because of condition error. This is my code:

- id: '1562678873887'
  alias: Accensione luce corridoio
  trigger:
    platform: state
    entity_id: binary_sensor.door_window_sensor_xxxxx
    from: 'off'
    to: 'on'
  condition:
    condition: or
    conditions:
        - condition: state
          entity_id: sensor.season
          state: 'Summer'
        - condition: time
          after: '20:00:00'
      - condition: and
        conditions:
        - condition: state
          entity_id: sensor.season
          state: 'Winter'
        - condition: time
          after: '17:00:00'
  action:
  - alias: 'Accensione luce corridoio'
    service: scene.turn_on
    entity_id : scene.xxxx

Thanks

Can you explain in words what logic you want the seasons and time to follow?

(summer AND after 20:00:00) OR (Winter AND after 17:00:00)
  condition:
    condition: or
    conditions:
      - condition: and
        conditions:
        - condition: state
          entity_id: sensor.season
          state: 'summer'
        - condition: time
          after: '20:00:00'
      - condition: and
        conditions:
        - condition: state
          entity_id: sensor.season
          state: 'winter'
        - condition: time
          after: '17:00:00'

EDIT
Correction: The Season component’s state is in lower case text (summer), not propercase (Summer).

When is summer and time is after 20:00:00
or when i Winter and time is after 17:00:100:
Thanks

Then 123 has your solution. See above.

Thanks I’ll check…
Another thing.
This automation will turn on the light also if i’m exiting from home, how can i do that only entering?
May i use some device traking?
Thanks

Find a way to determine where you are. Device tracking won’t probably help because you wont be far enough away.

Sorry but the conditions don’t work…

We have exactly this type of setup, but I’m using NodeRED to create the flow, since it’s a hell of a lot easier to understand than nested conditions. Our trigger currently is Life360 with presence detection.

For your particular need, you would be better off figuring out what the sun angle needs to be in order for that light to turn on, and then you’ll have 365 days of accuracy instead of 2 seasons. Plus, you’ll be able to accommodate shade trees or mountains that block the sun earlier than a static time.

When I come home, if the sun is below X angle, turn whatever on.

Double check your indentation. The conditions 123 provided are correct.

Is there is a indentation problem the check should tell me or not?

I just checked what is reported by the Season Sensor. It reports its state with lowercase text (summer) not propercase (Summer).

Screenshot%20from%202019-07-18%2006-42-38

I’ve corrected the code in my previous post.