Bluetooth presence detector: state ON, light off

I have a set of Hue light and I would like them to turn on whenever my phone is in Bluetooth range.
I have been using the following python script :
and in theory, it works the switch associated with the light turns on.

Console outputs: “Blabla state updated to ON”.

However, the light itself does not turn on, the console doesn’t show anything like “Blabla received command ON”

Note that when I trigger the switch manually it does work.

Any tips ?

Show your rules, items and sitemaps otherwaise we only could state that there is an error. Is ist possible to switch the hue with openhab?


Thanks for your reply, it’s very simple really:


rule "Home"
Item LSwitch changed from OFF to ON
sendCommand(Lights, ON)

rule "Away"
Item LSwitch changed from ON to OFF
sendCommand(Lights, OFF)


Group Lights
Group Bedroom

Color Bedroom_Hue “Bedroom Hue” (Bedroom, Lights) {hue=“1”}
Switch LSwitch “Light Switch” (Lights) {hue=“2”}


sitemap home label=“Test”
Frame {
Group item=Lights label=“All lighting” icon="hue"
Group item=Bedroom label=“Bedroom” icon=“bedroom”



And yes it’s possible. It works well when trigger the switch from my sitemap. The script seems fine as well. I do see the updated state here on http://x.x.x.x:8080/rest/items/LSwitch/state. But sendCommand does not react to it.

Maybe i found something. In your Lights group is one Switch and one Color thias maybe crashes your send command to this group. Did you found any hintes in the openhab logfile?


Yes, actually I have realized that the rule file simply doesn’t load… unfortunately I have no idea why.

Where is your bluetooth part of your rule?

Normally you do something like:

rule "Home Bluetooth"
Item BluetoothSwitch changed from OFF to ON 
sendCommand(Lights, ON)

Actually I fixed it, the problem was that the rules was not loading…
The reason ? A missing “s” in the rules file extension… beginner mistake I guess :joy:

:slight_smile: thats why we are here. And dies the rule now work?