GPIO trigger, switch light

Hello everyone, hass.io give me a strange problem in the automation.
My goal is to switch status of my switch named “Luce” when my GPIO port (the n: 20) change state to 1
configuration:
switch:

  • platform: rpi_gpio
    ports:
    2: Luce
    3: Prese
    #invert_logic: true

  • platform: wake_on_lan
    name: “PC”
    mac_address: “44-8a-5b-64-ca-67”
    host: “192.168.1.3”
    turn_off:
    service: shell_command.turn_off_PC
    shell_command:
    turn_off_PC: ‘ssh -p60115 [email protected] poweroff’

    binary_sensor:
    platform: rpi_gpio
    ports:
    20: pibutton
    value_high: “on”
    value_low: “off”

this is the automation file
automation:

  • alias: ‘Pi Button Light’
    trigger:
    platform: state
    entity_id: binary_sensor.pibutton
    state: ‘on’
    action:
    service: switch.toggle
    entity_id:
    - switch.Luce

the error in the main page was: the following components and platforms could not be set up: automation

What’s the problem?

Hi @Race, Welcome to HA.
You have to use to: 'on' in your trigger.
The state alias for to is deprecated since version 0.46.

1 Like