setColor  [SOLVED]

Moderator: leecollings

Post Reply
m147
Posts: 27
Joined: Saturday 04 August 2018 14:51
Target OS: Linux
Domoticz version:
Contact:

setColor

Post 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)
User avatar
waaren
Posts: 6028
Joined: Tuesday 03 January 2017 14:18
Target OS: Linux
Domoticz version: Beta
Location: Netherlands
Contact:

Re: setColor

Post 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.*
Debian buster, bullseye on RPI-4, Intel NUC.
dz Beta, Z-Wave, RFLink, RFXtrx433e, P1, Youless, Hue, Yeelight, Xiaomi, MQTT
==>> dzVents wiki
m147
Posts: 27
Joined: Saturday 04 August 2018 14:51
Target OS: Linux
Domoticz version:
Contact:

Re: setColor

Post by m147 »

Of course:
Image
m147
Posts: 27
Joined: Saturday 04 August 2018 14:51
Target OS: Linux
Domoticz version:
Contact:

Re: setColor

Post 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.
User avatar
waaren
Posts: 6028
Joined: Tuesday 03 January 2017 14:18
Target OS: Linux
Domoticz version: Beta
Location: Netherlands
Contact:

Re: setColor

Post 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}'
Debian buster, bullseye on RPI-4, Intel NUC.
dz Beta, Z-Wave, RFLink, RFXtrx433e, P1, Youless, Hue, Yeelight, Xiaomi, MQTT
==>> dzVents wiki
m147
Posts: 27
Joined: Saturday 04 August 2018 14:51
Target OS: Linux
Domoticz version:
Contact:

Re: setColor

Post 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
m147
Posts: 27
Joined: Saturday 04 August 2018 14:51
Target OS: Linux
Domoticz version:
Contact:

Re: setColor

Post 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}'
User avatar
waaren
Posts: 6028
Joined: Tuesday 03 January 2017 14:18
Target OS: Linux
Domoticz version: Beta
Location: Netherlands
Contact:

Re: setColor

Post 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 ?
Debian buster, bullseye on RPI-4, Intel NUC.
dz Beta, Z-Wave, RFLink, RFXtrx433e, P1, Youless, Hue, Yeelight, Xiaomi, MQTT
==>> dzVents wiki
m147
Posts: 27
Joined: Saturday 04 August 2018 14:51
Target OS: Linux
Domoticz version:
Contact:

Re: setColor

Post 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...
User avatar
waaren
Posts: 6028
Joined: Tuesday 03 January 2017 14:18
Target OS: Linux
Domoticz version: Beta
Location: Netherlands
Contact:

Re: setColor

Post 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")
Debian buster, bullseye on RPI-4, Intel NUC.
dz Beta, Z-Wave, RFLink, RFXtrx433e, P1, Youless, Hue, Yeelight, Xiaomi, MQTT
==>> dzVents wiki
m147
Posts: 27
Joined: Saturday 04 August 2018 14:51
Target OS: Linux
Domoticz version:
Contact:

Re: setColor

Post by m147 »

it doesn't works:
User avatar
waaren
Posts: 6028
Joined: Tuesday 03 January 2017 14:18
Target OS: Linux
Domoticz version: Beta
Location: Netherlands
Contact:

Re: setColor

Post 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
Debian buster, bullseye on RPI-4, Intel NUC.
dz Beta, Z-Wave, RFLink, RFXtrx433e, P1, Youless, Hue, Yeelight, Xiaomi, MQTT
==>> dzVents wiki
m147
Posts: 27
Joined: Saturday 04 August 2018 14:51
Target OS: Linux
Domoticz version:
Contact:

Re: setColor  [SOLVED]

Post 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.
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest