Page 1 of 1

dzVents uses http instead of https and wrong port

Posted: Saturday 02 January 2021 19:34
by ugge
Hi

I ran into problem when trying to get setColor to work with my Philips Hue (idx = 767).
Everything works from GUI but when trying to set color temperature using dzVent I get an error in the log.
This is the script

Code: Select all

return {
	on = {
		devices = {
			'Testswitch'
		}
	},
	execute = function(domoticz, device)
		domoticz.log('Device ' .. device.name .. ' was changed', domoticz.LOG_INFO)
		domoticz.devices(767).setColor(0, 0, 0, domoticz.devices(767).level, 0, 0, 2, 4000)
	end
}
Event is triggered via a virtual switch of type dimmer. Later I will use the level to set actual color temperature.
When triggered this is the log.

Code: Select all

 2021-01-02 19:32:18.628 Status: User: Admin (IP: 192.168.0.221) initiated a switch command (318/Testswitch/Set Level)
2021-01-02 19:32:18.790 Status: dzVents: Info: Handling events for: "Testswitch", value: "On"
2021-01-02 19:32:18.790 Status: dzVents: Info: ------ Start internal script: Färgtemperatur: Device: "Testswitch (DummyInterface)", Index: 318
2021-01-02 19:32:18.790 Status: dzVents: Info: Device Testswitch was changed
2021-01-02 19:32:18.792 Status: dzVents: Info: ------ Finished Färgtemperatur
2021-01-02 19:32:18.794 Status: EventSystem: Script event triggered: /home/richard/domoticz/dzVents/runtime/dzVents.lua
2021-01-02 19:32:18.792 Error: dzVents: Error: (3.0.19) Error parsing json to LUA table: (invalid json string)
2021-01-02 19:32:18.837 Error: Error opening url: http://127.0.0.1:/json.htm?type=command&param=setcolbrightnessvalue&idx=767&brightness=99&color={"m":2,"t":4000,"cw":0,"ww":0,"r":0,"g":0,"b":0} 
The problem is that my system runs on https and port 8080
If I modify the URL and run it from my server it works fine.

Re: dzVent uses http instead of https and wrong port  [Solved]

Posted: Saturday 02 January 2021 20:44
by waaren
ugge wrote: Saturday 02 January 2021 19:34 I ran into problem when trying to get setColor to work with my Philips Hue (idx = 767).
The problem is that my system runs on https and port 8080
Thx for reporting.
Unfortunately I can only offer a workaround for now. dzVents depends on other parts of domoticz to supply a working port and for your system an empty string is supplied.
I will create a github issue to request a solution for this but it might take some time to get this fixed.

as a workaround you can change line 39 of <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 = 'https://127.0.0.1:8080'
but you have to repeat this step after every domoticz update until a fix will be merged.

Re: dzVent uses http instead of https and wrong port

Posted: Sunday 03 January 2021 11:01
by ugge
Thanks

Works like a charm.

Re: dzVents uses http instead of https and wrong port

Posted: Monday 04 January 2021 0:34
by waaren
ugge wrote: Sunday 03 January 2021 11:01 Thanks

Works like a charm.
Issue is fixed in dzVents 3.1.1 This will be available when Pull Request 4560 is merged into Beta