Hi I’m new to Home Assistant, there for might miss something. I have switches, motion sensors, which works on fixed RF codes so I’m controlling lights (switches) using this type of config and that works flowless:
Now to get (RF) motion sensors to work (detected) I only found this combination, which is kind a working, using rflink integration and another device (arduino MEGA + transeiver with rflink firmware):
Now I want to use automations and after searching and using official documentation I came up with this simple one for test purpose:
- alias: Turn on stairs light 2nd floor
trigger:
platform: state
entity_id: binary_sensor.sensor_motion_garageon
to: "on"
action:
service: switch.turn_on
data:
entity_id:
- switch.2nd_floor_stairs_light01
- switch.2nd_floor_stairs_light02
This automation is working, but HASSIO not sending actual RF codes. Switches shows that they switch in WEB interface, but nothing happens. But if I switch them manually they functions properly, WHY? What I’m missing?
Thank you for prompt reply! That worked one time and again nothing (( ve aleikuma Salam.
Strange after HA restart it is working 1 time and no more? HA shows change of the state, but actual RF code not being generated again, very strange…After manual trigger it works one time, but after that no more…
that is because when the first automation is triggered, the the switch is turned on and it continues to be in on state when you try the automation next time , the switch is still on, you have to turn the switch off again and turn on. try like that
Yes…that is correct. When we build automations from UI, HA assigns IDs to it . And we can only edit those automations which have such an id. If we remove the id , we have to edit if from automations.yaml. Did you check the automation problem?
Same same, UI shows that automation works fine, switch state changes, switch physically changes state, I see it in developer tools, but RF signal is not transmitted. Only if I manually toggle switch from UI it works, not through automation… why?
Its strange. This must be how you have tested. First execute the automation and since it is the first try, the switch should work. Then you have to go to UI and turn off the switch. Then try the automation again.
Yes it does, everything works in UI, switches change their states, motion sensor changes state and shows that detected either clear, but RF signal is not transmitted…very strange Only if I hit switch in HA UI it transmits RF signal and switches light on and off…
Also another strange behavour is when I delete entries from UI which are removed from automation.yaml thay appear again after restart…
Rebooting HOST now.
Nothing, not working, just like before. This is HA bug!
This cant be a bug, we are just missing something. So the automation works perfectly when you hit execute button in automation editor. But it is not triggering in automatic mode. This means the trigger is not working.
I think the problem could be with the binary sensor. Can you see the state of it changing to on when there is some motion?
Yes state is changing otherwise it woun’t trigger event, I have checked it it is changing in developer tools.
What I’m thinking maybe that is signal interference as motion sensor works on the same frequencies. How I can delay event trigger, say for 1-2 seconds?
Thanks, checking this. I have assembled separate RF receiver to see if signal is transmitted by HA. I can see motion sensor sending signal, but can’t see it from HA transmitter, just sometime it sends off signal
full code:
- id: '1611304514042'
alias: New Automation Light ON
description: ''
trigger:
- platform: state
entity_id: binary_sensor.sensor_motion_garageon
to: 'on'
condition: []
action:
- delay: '00:00:02'
- service: switch.turn_on
data: {}
entity_id: switch.my_lab_light
mode: single
- id: '1611304642082'
alias: New Automation Light OFF
description: ''
trigger:
- platform: state
entity_id: binary_sensor.sensor_motion_garageon
to: 'off'
for: 00:00:05
condition: []
action:
- delay: '00:00:02'
- service: switch.turn_off
data: {}
entity_id: switch.my_lab_light
mode: single
Well not sure the problem might also be with signal repetition and delay. Because signal is transmitted only 1 time (I see it in serial monitor) I think it is getting lost between motion sensor signals (interference) After implementing delay automation works better but time to time, still the problem might be with automation.
Do you know how I can implement signal repetition?
TO diagnose this first we can try increasing the delay to 5 or 10s and see if the signal goes through.
And for repeating the signal we can try repeating the action to switch on the light again once or twice in the automation. It would literarily mean that the signal would be send again but dont know if the service will repeat with the switch turned on again.