sendCommand returns instantly and then processes in the background. It is highly unlikely that your script will have even started executing let alone finished executing and put the result in the yeelightwz_out Item (which you didn’t not post the definition for.
So, have you defined yeelightwz_out?
You should create another rule that triggers when yeelightwz_out changes and put the logInfo log statement there.
Can you run the script from the command line as the openHAB user? I ask becasue the command in your Thing looks incorrect. You usually provide a user name when prioviding the -u option.
sudo -u openhab sudo -u /home/pi/yeelight.sh
This will attempt to run the script you have in your Thing as the openhab user, which is the user openHAB runs under.
I have solved it with the yeelight binding, i dont know why, but this openhab2 drives me crazy!
first time test the yeelight wasnt working, and after the exec was not working i tried to go back to yeelight binding and it works now. I HATE IT
I have now installed the yeelight addon manually and here are my items and rules and things:
[ITEMS]
Switch yeelightwz "Switch" <switch> {channel="yeelight:Wonder:0x0000000004546:Brightness"}
Switch yeelightoben "Switch" <switch> {channel="yeelight:Wonder:0x000000000253654:Brightness"}
[RULES]
rule "Yeelight_Living"
when
Channel "amazondashbutton:dashbutton:xxxxxxxxxxx:press" triggered
then
if (yeelightwz.state.toString == "ON") {
yeelightwz.sendCommand(OFF)
} else {
yeelightwz.sendCommand(ON)
}
end
rule "Yeelight_Oben"
when
Channel "amazondashbutton:dashbutton:xxxxxxxxx:press" triggered
then
if (yeelightoben.state.toString == "ON") {
yeelightoben.sendCommand(OFF)
} else {
yeelightoben.sendCommand(ON)
}
end
[Sitemap]
sitemap Hause label="Hause" {
Frame label="Kalender" {
Text item=CurrentDate
}
Frame label="Erdgeschoss" icon="groundfloor" {
Group item=GF_Terrace
Switch item=yeelightwz
Switch item=yeelightoben
}
[Things]
ntp:ntp:local [hostname="0.pool.ntp.org", refreshInterval=60, refreshNtp=30, locale="", timeZone="Europe/Vienna" ]
Switch item=yeelightwz_switch
Switch item=yeelightoben_switch