Switch on in condition

Hi guys, I need to pull up a switch after a branch of and conditions, else switch off. I couldn’t write it right.
could somebody help me with sintax?
I write it as:

binary_sensor:
  - platform: gpio
    pin:
     number: D1
     mode: INPUT_PULLUP
    name: "Porta Ingresso"
    id: porta_ingresso
    device_class: door
    
  
  - platform: gpio
    pin:
     number: D2
     mode: INPUT_PULLUP
    name: "Finestra Soggiorno"
    id: porta_soggiorno
    device_class: window
    
  - platform: gpio
    pin:
     number: D5
     mode: INPUT_PULLUP
    name: "Finestra Cucina"
    id: finestra_cucina
    device_class: window
    
  - platform: gpio
    pin: 
     number: D6
     mode: INPUT_PULLUP
    name: "Finestra Camera"
    id: finestra_camera
    device_class: window
    
  - platform: gpio
    pin: 
     number: D7
     mode: INPUT_PULLUP
    name: "Finestra Bagno"
    id: finestra_bagno
    device_class: window
    
 
 
output:
  - platform: gpio
    pin: D3
    inverted: True
    id: 'inserimento_parziale'

  - platform: gpio
    pin: D4
    inverted: True
    id: 'perimetrale_soggiorno'
      
  - platform: gpio
    pin: GPIO1
    inverted: True
    id: 'disinserimento_antifurto'
  
  
    
switch:
  - platform: output
    name: "Inserimento Parziale"
    output: 'inserimento_parziale'
   
  - platform: output
    name: "Perimetrale Soggiorno"
    output: 'perimetrale_soggiorno'
    
  - platform: output
    name: "Disinserimento Antifurto"
    output: 'disinserimento_antifurto'

  - platform: gpio
    pin: D4
    id: perimetrale_soggiorno_ok

#automazione perimetrale soggiorno#

esphome.on_loop:
  then:
    if:
      condition:
        and:
          - binary_sensor.is_on: porta_ingresso
          - binary_sensor.is_on: finestra_cucina
      then:
        - switch.turn_on: perimetrale_soggiorno_ok

but i get this on validate:

INFO Reading configuration /config/esphome/test.yaml...
ERROR Unexpected exception while reading configuration:
Traceback (most recent call last):
  File "/usr/local/bin/esphome", line 11, in <module>
    load_entry_point('esphome', 'console_scripts', 'esphome')()
  File "/opt/esphome/esphome/__main__.py", line 566, in main
    return run_esphome(sys.argv)
  File "/opt/esphome/esphome/__main__.py", line 544, in run_esphome
    config = read_config()
  File "/opt/esphome/esphome/config.py", line 808, in read_config
    res = load_config()
  File "/opt/esphome/esphome/config.py", line 668, in load_config
    return _load_config()
  File "/opt/esphome/esphome/config.py", line 656, in _load_config
    result = validate_config(config)
  File "/opt/esphome/esphome/config.py", line 440, in validate_config
    component = get_component(domain)
  File "/opt/esphome/esphome/config.py", line 171, in get_component
    assert '.' not in domain
AssertionError

please hep me…thanks a lot.

1 Like