Wrong automation

What is wrong in this automation as i always get this error when checking the config:

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 35). Please check the docs at https://home-assistant.io/integrations/automation/

This is the automation:

- alias: 'Accendi luci Salotto'
  trigger:
    platform: state
    entity_id: binary_sensor.motion_sensor_158d0001a98a62
    to: 'on'
  condition:
    condition: and
    conditions:  
      - condition: state
        entity_id: group.presenze
        to: 'not_home'
      - condition: template
        value_template: '{{ state_attr("sun.sun", "elevation") < 0.5}}'
      - condition: state
        entity_id: group.all_lights
        state: 'off'
      - condition: template
        value_template: '{{ (as_timestamp(now())-as_timestamp(states.input_boolean.mauhome.last_updated)) < 360 }}'
  action:  
    - service: light.turn_on
      entity_id:
        - light.yeelight_1
      data_template:
        brightness: 255
        rgb_color: ['{{ (range(0, 255)|random) }}','{{ (range(0, 255)|random) }}','{{ (range(0, 255)|random) }}']  
        transition: 10

The state condition has no ‘to’ parameter.

to isn’t a valid option for a state condition. You must have copied this from a trigger. It should be ‘state’

      - condition: state
        entity_id: group.presenze
        state: 'not_home'

Thanks to both @VDRainer and @petro for your help…
Do you think the condition regarding the sun elevation is enough for running this automation only at that value?

It’ll pass whenever it’s below that value, not exactly at that value.

And if i want to run only between two values? For example between +0.5 and -6 ?

{{ -6 < state_attr("sun.sun", "elevation") < 0.5}}