I have a lamp that is controlled via MQTT and works perfectly fine.
Also I have a motion sensor that is working fine.
But when I create an automation to turn on that lamp at motion the lamp does not light up while it does in frontend.
Als when I run TEST AUTOMATION it works fine and the lamp lights up. Just at motion it only shows lamp is on at frontend.
I tried with calling service “turn_light_on” as well the service “MQTT:Publish” but both doing the same.
Any ideas?
My current automation is like this:
alias: Hall Lamp
description: Turn lamp on at motion
trigger:
- platform: state
entity_id: binary_sensor.hall_upstairs_motion_sensor
to: 'on'
condition: []
action:
- service: mqtt.publish
data:
payload: S0_ON
topic: hb/from_HA/NewKaku_40812
mode: single
If you have the light configured as a light in HA i would not use MQTT publish but use the light.turn_on service. Can you post the code for that? I assume you make it in the UI, otherwise, don’t forget to reload the automation after changing it.
And, after trying to trigger it with motion, can you check if you see that the automation is triggered? You can use the new debug function for that as well
Thanks for your reply. I also used the light.turn_on service in first place but that did the same.
That’s why I tried with MQTT.
This is what I first tried:
alias: Hall Lamp
description: Turn lamp on at motion
trigger:
- platform: state
entity_id: binary_sensor.hall_upstairs_motion_sensor
to: 'on'
condition: []
action:
- service: light.turn_on
target:
entity_id: light.hall_light_upstairs
mode: single
The automation is being called because I see the action happening on the frontend, so the light becomes yellow but the lamp is not lighting up while it does when testing automation.
Where to find that new debug function? Is that already in stable release?
Yes, the light in Lovelace is turning on but the real light not.
The light is normal lamp controlled via 433Mhz with a MQTT command to a RFbridge. All that is working without a problem. The strange things is that testing the automation does do it right, the automation is triggered when I’m making motion and the LoveLace lamp goes to on at LL but the actual lamp not.
Yes the automation is fine, but also the sensor and the lamp is fine because I can switch it on and off in LoveLace without a problem. And the sensor is perfectly triggered at motion (also 433)
Anyway, I change the setup and moved it to rfxtrx integration and now it seems to work.
Think that is the problem. The signal to the light didn’t came trough because the sensor was also sending. That’s one of the downsides of 433MHz devices as the protocol is very very stupid.