In Domoticz, I have the Windows and Blinds set up as dimmers, dummy HW. (I did try the "Blinds percentage", but then the sliders did not work.)
When changing dimmer value -> dzvents-script is triggered and calls setposition.js and position is set to desired value. This works perfectly.
When changing blinds or windows using the velux remotes (not integrated into Domoticz), I want to update the values in Domoticz without triggering the aforementioned dzvents script. How can this be done?
Currently, I have a bash-script that runs on a timer (independant of Domoticz). But every time it updates the values in Domoticz, the dzvents-script is triggered, and the windows and blinds move slightly (rounding errors will inevitably make this happen).
Code for updating the values in Domoticz (reduced to one device for readability):
Code: Select all
#!/bin/bash
# Script that updates the devices in Domoticz
data=$(node /home/user/velux/getAllPositions.js)
# Sort it
bulPos=$(echo "$data" | grep -P -o '(?<=Blind up left:\s)[0-9.]*')
# Pipe through calculator and awk to transform to integer 0-16 instead of float 0-1:
bulPos=$(echo "scale=4; $bulPos*16" | bc)
bulPos=$(echo $bulPos | awk '{print int($1+0.5)}')
curl -s "http://127.0.0.1:<portnr>/json.htm?type=command¶m=switchlight&idx=478&switchcmd=Set%20Level&level=${bulPos}"
Code: Select all
curl -s "http://127.0.0.1:<portnr>/json.htm?type=command¶m=udevice&idx=478&switchcmd=Set%20Level&level=${bulPos}"
but that gives an error.
So how can I update the device values without triggering the dzvents-script? Can I do something from within the dzvents script? Maybe find out the source of the value change?
dzvents-script that sets levels:
Code: Select all
return {
on = {
devices = {
'Blind up left',
'Blind up center',
'Blind up right',
'Blind down left',
'Blind down center',
'Blind down right',
'Window left',
'Window right'
}
},
execute = function(domoticz, device)
if (device.changed) then
-- Here, I would like to check if value change came from GUI or from curl/json
os.execute('node /home/user/velux/setPosition.js "' .. device.name .. '" ' .. device.level*0.01);
end
end
}