Page 1 of 1

setColor

Posted: Tuesday 26 May 2020 7:15
by m147
Hello,

After few upgrades ago, error with setColor started occurs...

script:

Code: Select all

return {
	on = {
		devices = {
			'chodba-switch2-new'
		}
	},
	execute = function(domoticz, device, roomSwitch)

            if domoticz.devices'chodba-switch2-new'.level == 30  then
  	    domoticz.devices'chodba-switch2-new'.switchOff().silent()
            domoticz.devices'chodba-zarovka'.setColor(0,0,0, 25, 0, 0, 2, 50)
            domoticz.devices'chodba-zarovka'.setColor(0,0,0, 50, 0, 0, 2, 100).afterSec(2)
            domoticz.devices'chodba-zarovka'.setColor(0,0,0, 100, 0, 0, 2, 150).afterSec(4)
    	    domoticz.devices'chodba-zarovka'.switchOff().afterSec(40)
        end
end
}
log:
2020-05-26 07:01:21.784 Error: Error opening url: http://127.0.0.1:8080/json.htm?type=com ... g":0,"b":0}
2020-05-26 07:01:23.775 Error: Error opening url: http://127.0.0.1:8080/json.htm?type=com ... g":0,"b":0}
2020-05-26 07:01:25.783 Error: Error opening url: http://127.0.0.1:8080/json.htm?type=com ... g":0,"b":0}
Local access is enabled in settings.
If I open url, device is updated correctly.
Version: 2020.2 (build 12071)

Re: setColor

Posted: Tuesday 26 May 2020 9:46
by waaren
m147 wrote: Tuesday 26 May 2020 7:15 Local access is enabled in settings.
If I open url, device is updated correctly.
Can you show the line you used in that setting?

Mine is 127.0.0.1;192.168.192.*

Re: setColor

Posted: Tuesday 26 May 2020 9:53
by m147
Of course:
Image

Re: setColor

Posted: Tuesday 26 May 2020 9:56
by m147
If I try:

Code: Select all

return {
	on = {
    customEvents = { 'zkouska' },
    },	
   	execute = function(domoticz, dz, device, triggeredItem)
   	    local URL = 'http://127.0.0.1:8080/json.htm?type=command&param=setcolbrightnessvalue&idx=233&brightness=25&color={"m":2,"t":50,"cw":0,"ww":0,"r":0,"g":0,"b":0}'
   	    domoticz.openURL(URL)
end
}
Result is the same.

Re: setColor

Posted: Tuesday 26 May 2020 10:54
by waaren
m147 wrote: Tuesday 26 May 2020 9:56 ...
Result is the same.
What do you see when you give that command from the commandline of the domoticz system (using curl)?

Code: Select all

curl  -s 'http://127.0.0.1:8080/json.htm?type=command&param=setcolbrightnessvalue&idx=233&brightness=25&color={"m":2,"t":50,"cw":0,"ww":0,"r":0,"g":0,"b":0}'

Re: setColor

Posted: Tuesday 26 May 2020 11:03
by m147
waaren wrote: Tuesday 26 May 2020 10:54
m147 wrote: Tuesday 26 May 2020 9:56 ...
Result is the same.
What do you see when you give that command from the commandline of the domoticz system (using curl)?

Code: Select all

curl  -s 'http://127.0.0.1:8080/json.htm?type=command&param=setcolbrightnessvalue&idx=233&brightness=25&color={"m":2,"t":50,"cw":0,"ww":0,"r":0,"g":0,"b":0}'
401 Unauthorized

Re: setColor

Posted: Tuesday 26 May 2020 11:50
by m147
Couldn't be problem that the domoticz runs on IPv6?
Status: WebServer(HTTP) started on address: :: with port 8080
edit:
If I update thru IPv6 it is OK:
curl -s 'http://:::8080/json.htm?type=command&param=setcolbrightnessvalue&idx=233&brightness=100&color={"m":2,"t":150,"cw":0,"ww":0,"r":0,"g":0,"b":0}'

Re: setColor

Posted: Tuesday 26 May 2020 15:07
by waaren
m147 wrote: Tuesday 26 May 2020 11:50 Couldn't be problem that the domoticz runs on IPv6?
If I update thru IPv6 it is OK:
OK. We might need to change something in dzVents for this.
How do you start domoticz to have it run on IPv6 ?

Re: setColor

Posted: Tuesday 26 May 2020 16:46
by m147
Domoticz runs on Debian Buster and it is installed by

Code: Select all

curl -L https://install.domoticz.com | bash
No special configuration...

Re: setColor

Posted: Tuesday 26 May 2020 17:53
by waaren
m147 wrote: Tuesday 26 May 2020 16:46 No special configuration...
OK Clear.

can you try again after changing line 38 in <domoticz dir>/dzVents/runtime/EventHelpers.lua
from

Code: Select all

	local _url = 'http://127.0.0.1:' .. (tostring(globalvariables['domoticz_listening_port']) or "8080")
to

Code: Select all

	local _url = 'http://localhost:' .. (tostring(globalvariables['domoticz_listening_port']) or "8080")

Re: setColor

Posted: Wednesday 27 May 2020 8:20
by m147
it doesn't works:

Re: setColor

Posted: Wednesday 27 May 2020 10:32
by waaren
m147 wrote: Wednesday 27 May 2020 8:20 it doesn't work:
Can you try again after changing the Local access in settings to
127.0.0.*;192.168.0.*;10.8.0.*;::1

(without spaces before or after the ; )

Please also post a screenshot of the [setup][settings][system] page

Re: setColor  [SOLVED]

Posted: Wednesday 27 May 2020 12:06
by m147
Now it works even without changes in EventHelpers.lua!

Image

It looks like the spaces caused the error. But on previous machine with Debian Jessie and ipv4 it worked OK.