Right, finally got it working! It is not clean as I have no idea about LUA or similar and I'm making it as I go along...
1st I create a LUA script that triggers on event only (not idea how to do it directly inside the file system yet):
Code: Select all
local val_shades = otherdevices_svalues['Shades']
commandArray = {}
if val_shades ~= nil then
cmd = "/usr/bin/python /home/pi/domoticz/scripts/python/control.py -t [your BT mac without the brackets] -c move_target -a "..val_shades
os.execute(cmd)
end
return commandArray
Then on the virtual dummy switch I add the following for OFF:
Code: Select all
http://YourDomoticzIP:Port/json.htm?type=command¶m=udevice&idx=deviceID&svalue=100
and similar for ON:
Code: Select all
http://YourDomoticzIP:Port/json.htm?type=command¶m=udevice&idx=deviceID&svalue=0
or viceversa...
Now this creates an infinite loop that keep sending commands as my LUA script is triggering continuously... no idea how to fix that yet. But since it is a more common thing, maybe someone more experience with LUA and dummy devices can help me making it a bit more stable?
I thought about updating a user variable to check before triggering but didn't manage to write to the variable inside Domoticz. Any lights would be welcome
The sliders and everything works.