Page 1 of 1

dzVents updateSetPoint errors out

Posted: Tuesday 18 July 2017 23:49
by heggink
the call to a setpoint device gives:

2017-07-18 23:41:40.605 Incoming connection from: 127.0.0.1
2017-07-18 23:41:40.610 Error: Error opening url: http://127.0.0.1:8080/json.htm?type=com ... etpoint=16

388 is indeed the id of the device I am trying to change. Thoughts?

Re: dzVents updateSetPoint errors out

Posted: Wednesday 19 July 2017 0:02
by heggink
browsing through the code, I noticed it uses a setsetpoint json call which I could not confirm through any docs. Mayve switch to a udevice call instead as follows:
current:
/json.htm?type=command&param=setsetpoint&idx=' .. device.id .. '&setpoint=' .. setPoint
suggested:
/json.htm?type=command&param=udevice&idx=' .. device.id .. '&nvalue=0&svalue=' .. setPoint

I know the last works as I already use it.

Re: dzVents updateSetPoint errors out

Posted: Wednesday 19 July 2017 7:15
by mivo
Hi,

there was a change in dzVents 2.1.0 regarding Thermostat Setpoint update command - beta v3.8088 and this commit onward:
https://github.com/domoticz/domoticz/co ... 05685036ba

What type of device is your thermostat ?

Re: dzVents updateSetPoint errors out

Posted: Wednesday 19 July 2017 8:58
by heggink
It's a nest with a basic thermostat/setpoint device

Re: dzVents updateSetPoint errors out

Posted: Wednesday 19 July 2017 11:23
by dannybloe
Mm. that's unfortunate indeed. I'll have to make a distinction in the adapter for dummy devices that can work with param=setsetpoint.
Can you both try this: find the adapter (path/to/dz/scripts/dzVents/runtime/adapters) thermostat_setpoint_device.lua and change the code with:

Code: Select all

return {

	baseType = 'device',

	name = 'Thermostat setpoint device adapter',

	matches = function (device, adapterManager)
		local res = device.deviceSubType == 'SetPoint' and device.hardwareTypeValue ~= 20 -- rule out opentherm
		if (not res) then
			adapterManager.addDummyMethod(device, 'updateSetPoint')
		end
		return res
	end,

	process = function (device, data, domoticz, utils, adapterManager)

		device['SetPoint'] = device.rawData[1] or 0

		function device.updateSetPoint(setPoint)
			local url

			-- send the command using openURL otherwise, due to a bug in Domoticz, you will get a timeout on the script

			if (device.hardwareTypeValue == 15) then -- dummy
				url = domoticz.settings['Domoticz url'] ..
					'/json.htm?type=command&param=setsetpoint&idx=' .. device.id .. '&setpoint=' .. setPoint
			else
				url = domoticz.settings['Domoticz url'] ..
					'/json.htm?type=command&param=udevice&idx=' .. device.id .. '&nvalue=0&svalue=' .. setPoint
			end

			utils.log('Setting setpoint using openURL ' .. url, utils.LOG_DEBUG)
			domoticz.openURL(url)
		end

	end

}
And see if that works for both of you?

Re: dzVents updateSetPoint errors out

Posted: Wednesday 19 July 2017 15:01
by mivo
Hi Danny,

works for me - dummy device and Z-wave thermostat both updated without errors.

Thank you

Re: dzVents updateSetPoint errors out

Posted: Wednesday 19 July 2017 15:31
by heggink
weird: whilst it now uses a udevice command, the command itself gets truncated??? instead of param=udevice, it shows:

2017-07-19 15:32:07.251 dzVents: Debug: Device-adapter found for Thermostat Schedule: Thermostat setpoint device adapter
2017-07-19 15:32:07.255 dzVents: Debug: Processing device-adapter for Thermostat Schedule: Thermostat setpoint device adapter
2017-07-19 15:32:07.256 dzVents: Debug: Device-event for: Thermostat Schedule value: 16.00
2017-07-19 15:32:07.256 dzVents: Debug: Searching for scripts for changed item: Thermostat Schedule
2017-07-19 15:32:07.256 dzVents: Info: Handling events for: "Thermostat Schedule", value: "16.00"
2017-07-19 15:32:07.256 dzVents: Info: ------ Start external script: Thermostat.lua: Device: "Thermostat Schedule (Thermostat schedule)", Index: 544
2017-07-19 15:32:07.257 dzVents: Debug: Device-adapter found for Home Temp: Thermostat setpoint device adapter
2017-07-19 15:32:07.257 dzVents: Debug: Processing device-adapter for Home Temp: Thermostat setpoint device adapter
2017-07-19 15:32:07.257 dzVents: Thermostat Schedule says: 16
2017-07-19 15:32:07.257 dzVents: Debug: Setting setpoint using openURL http://127.0.0.1:8080/json.htm?type=com ... &svalue=16
2017-07-19 15:32:07.257 dzVents: Info: ------ Finished Thermostat.lua
2017-07-19 15:32:07.258 dzVents: Debug: [1] = OpenURL: http://127.0.0.1:8080/json.htm?type=com ... &svalue=16
2017-07-19 15:32:07.258 dzVents: Debug: =====================================================
2017-07-19 15:32:07.258 EventSystem: Fetching url...
2017-07-19 15:32:07.258 EventSystem: Script event triggered: scripts/dzVents/runtime/dzVents.lua
2017-07-19 15:32:07.281 (Thermostat schedule) Thermostat (Thermostat Schedule)
2017-07-19 15:32:07.473 Error: Error opening url: http://127.0.0.1:8080/json.htm?type=com ... &svalue=16

Re: dzVents updateSetPoint errors out

Posted: Wednesday 19 July 2017 16:19
by mivo
Hi heggink,

I see chaotic URL in my debug log too. I think it is only problem of web gui - browser misunderstanding of & characters. Try to look to text log of Domoticz (if enabled -log... command line parameter) or syslog (systemd journalctl)

Re: dzVents updateSetPoint errors out

Posted: Wednesday 19 July 2017 16:42
by heggink
Hey mivo,

You are absolutely correct. The log shows that the url is not garbled. When issuing the command via curl, it says "unauthorised". Turned out I did not have localhost in my settings not requiring a password. Works fine now!

Thanks!

Re: dzVents updateSetPoint errors out

Posted: Wednesday 19 July 2017 16:52
by dannybloe
Ah, yeah, that's in the docs under getting started :-D
Add 127.0.0.1 to the addresses not requiring a password.

Re: dzVents updateSetPoint errors out

Posted: Wednesday 19 July 2017 17:00
by heggink
Thanks for making that blindly obvious ;-). I have a bunch of headless Pi's (with fixed IPs) around the house so never use localhost hence never adding it.

Good news: I have now converted all of my old luas to the new dzVents including my motherofallluasinonebigfilebecausetheperformancecrapsoutothwerwise which I had to create due to the blockly memory leak.

Me happy :-). Thx!!!

H

Re: dzVents updateSetPoint errors out

Posted: Wednesday 19 July 2017 17:08
by heggink
BTW: retested and the setsetpoint DOES work ie the issue was my localhost security to begin with.
Apologies for chasing a red herring!

Re: dzVents updateSetPoint errors out

Posted: Friday 04 August 2017 18:44
by freakshock
I have the same problem but cannot solve it by adding 127.0.0.1 to my domoticz setting.
If I take the JSON URL (the full one from the text log) that gives the error and open the url in my browser (substituting 127.0.0.1 with the direct IP of the Synology NAS Domoticz is running on) it does work. Why does the URL not work via Domoticz? :?

Code: Select all

2017-08-04 18:43:26.860 Error: Error opening url: http://127.0.0.1:8084/json.htm?type=command¶m=udevice&idx=79&nvalue=0&svalue=17

Re: dzVents updateSetPoint errors out

Posted: Friday 04 August 2017 19:18
by dannybloe
Is it possible that 127.0.0.1 isn't accessible somehow on the nas itself? You could perhaps ssh to your nas and try a curl or wget to that address.

Re: dzVents updateSetPoint errors out

Posted: Friday 04 August 2017 19:33
by freakshock
dannybloe wrote:Is it possible that 127.0.0.1 isn't accessible somehow on the nas itself? You could perhaps ssh to your nas and try a curl or wget to that address.
Updated my Synology and suddenly it works again! Thanks for the suggestion danny!