Hi, noob here. First time trying to consolidate my various widgets around HA running on RPi with Sonoff zigbee dongle. Thought I would start small and get a light to switch on when walk into a room. Using an Aqara motion/illuminance sensor and either Tradfri outlet with lamp or Tradfri gu10 bulb. Cannot get either option to light the lamp/switch on the outlet. I can run the automation from the gui and the lights will switch off/on, and I can see the log registering motion detected and motion stopped, but I cannot get my automation to work when triggering the sensor. Baffled. Any pointers much appreciated. Will hopefully paste the yaml below
I tried trashing and rebuilding, rebooting RPi but with no joy. Feel a bit foolish reaching out. Not really got a programming mind. Any help much appreciated.
Run the actions to make sure they are correct. Go to Settings → Automations, click on the three dot icon to the right of your automation. Select RUN. This skips the triggers and conditions and just checks the actions.
Check the automation trace to see what is happening with the conditions. Troubleshooting Automations - Home Assistant this will only be available if the trigger has occurred (the manual run wont help here).
Check for relevant errors in Settings → logs
Not using device automations. Use state triggers, conditions and service calls (in the actions). e.g.
alias: Turn on office light
description: when aqara/lumi motion detector activated
trigger:
- platform: state
entity_id: binary_sensor.lumi_lumi_sensor_motion_aq2_iaszone
from: 'off'
to: 'on'
condition:
- condition: state
entity_id: switch.ikea_of_sweden_tradfri_control_outlet_switch
state: 'off'
action:
- service: light.turn_on
target:
entity_id: light.ikea_of_sweden_tradfribulbgu10ws345lm_light_2
data:
effect: flash_long ### check this is correct in your light more-info pop-up when the light is on
mode: single
alias: Turn off office light
description: when motion stops
trigger:
- platform: state
entity_id: binary_sensor.lumi_lumi_sensor_motion_aq2_iaszone
from: 'on'
to: 'off'
for:
hours: 0
minutes: 1
seconds: 0
condition: []
action:
- service: light.turn_off
target:
entity_id: light.ikea_of_sweden_tradfribulbgu10ws345lm_light_2
mode: single
Regarding the light effect, check it is in the list of available effects by clicking on your light, turn it on and look in the effect dropdown list:
Thank you so much for that Tom. Woke up this morning, walked into the pit and the light came on. And then off when no motion. I have no idea why. Is it possible there is some sort of delay in HASS adopting a new automation? I seriously thought I was going mad, when maybe I just neded to go to bed!
Your code seems much more elegant. I copied it and now have two successful automations going. Thank you so much. Is there a different “entry point” to start using this approach? Other than “Settings =>Automations & Scenes”?
Thanks again