Using a Raspberry pi. I want to turn on a LED ,when motion detected with PIR sensor ,PIR is connected as binary sensor in config.yaml
the automation code I used is
binary_sensor:
- platform: rpi_gpio
ports:
4: PIR Office
1: Garage Door
automation:
- alias: Turn on hall light when there is movement
trigger:
platform: state
entity_id: binary_sensor.PIR_Office
to: 'on'
action:
service: light.turn_on
entity_id: light.lightstrip_cupboard
- alias: Turn off hall light when there is no movement
trigger:
platform: state
entity_id: binary_sensor.PIR_Office
to: 'off'
for:
seconds: 5
action:
service: light.turn_off
entity_id: light.lightstrip_cupboard
the PIR is working as binary sensor ,in the UI get on when motion detected and off if else.
But it doesn’t control the light
so what is the wrong ?
What happens when you execute the automation manually from the GUI? That way it will skip the trigger part and skip straight to the action. If you nothing happens the problem is in your action. Else it’s the trigger.
Your automatons looking fine, so you’ll need to check it the entities you are naming.
What happens when you execute the automation manually from the GUI? That way it will skip the trigger part and skip straight to the action. If nothing happens the problem is in your action. Else it’s the trigger.