I'm trying to set a user variable from a dzVents script (so that another script can trigger on it). I think it is failing because I start domoticz with the -webroot option:
Code: Select all
-daemon -www 8081 -sslwww 0 -log /var/log/domoticz/log.txt -webroot domoticz -verbose 2 -pidfile $PIDFILE -userdata /var/lib/domoticz/ -dbase /var/lib/domoticz/domoticz.db -loglevel 3
Code: Select all
domoticz.variables('AlarmDetected').set(1)
Code: Select all
Error opening url: http://127.0.0.1:8081/json.htm?type=command¶m=updateuservariable&vname=AlarmDetected&vtype=0&vvalue=1&idx=1
It seems to me two things should be done to fix this. First, in main/EventSystem.cpp, in EventSystem::EvaluateLua(), the Lua global variable 'globalvariables' is set, including the domoticz_listening_port. Here domoticz_webroot should be added with code like this:
Code: Select all
lua_pushstring(lua_state, "domoticz_webroot");
lua_pushstring(lua_state, <SOMETHING>);
lua_rawset(lua_state, -3);
Second, in dzVents/runtime/EventHelpers.lua the line
Code: Select all
['Domoticz url'] = 'http://127.0.0.1:' .. (tostring(globalvariables['domoticz_listening_port']) or "8080")
Code: Select all
['Domoticz url'] = 'http://127.0.0.1:' .. (tostring(globalvariables['domoticz_listening_port']) or "8080") .. '/' ..(tostring(globalvariables['domoticz_webroot']) or ''')
Am I thinking in the right direction? BTW, running Domoticz 3.8153 with the included dzVents 2.2.0.
Thanks for any help,
Jan-Pascal