dzVents updateSetPoint errors out

Easy to use, 100% Lua-based event scripting framework.

Moderator: leecollings

Post Reply
User avatar
heggink
Posts: 989
Joined: Tuesday 08 September 2015 21:44
Target OS: Raspberry Pi / ODroid
Domoticz version: 12451
Location: NL
Contact:

dzVents updateSetPoint errors out

Post 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?
Docker in Truenas scale, close to latest beta
DASHTICZ 🙃
RFXCOM, zwavejs2mqtt, zigbee2mqtt,
P1 meter & solar panel
Google home, Wifi Cams motion detection
Geofence iCloud, Bluetooth & Wifi ping
Harmony hub, Nest, lots more :-)
User avatar
heggink
Posts: 989
Joined: Tuesday 08 September 2015 21:44
Target OS: Raspberry Pi / ODroid
Domoticz version: 12451
Location: NL
Contact:

Re: dzVents updateSetPoint errors out

Post 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.
Docker in Truenas scale, close to latest beta
DASHTICZ 🙃
RFXCOM, zwavejs2mqtt, zigbee2mqtt,
P1 meter & solar panel
Google home, Wifi Cams motion detection
Geofence iCloud, Bluetooth & Wifi ping
Harmony hub, Nest, lots more :-)
mivo
Posts: 80
Joined: Friday 21 April 2017 8:58
Target OS: Raspberry Pi / ODroid
Domoticz version: beta
Location: Czechia
Contact:

Re: dzVents updateSetPoint errors out

Post 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 ?
My toys:
Raspberry Pi 3 + UPS PIco HV3.0 A Stack
Minibian (Raspbian Jessie) + Domoticz beta
RFLink 433 Gateway, 1wire DS18B20 temp sensors (GPIO)
RaZberry module + 2x Comet Z-Wave + Z-wave socket
---
Plugins: WeMo Switch, UPS PIco HV3.0A on GitHub
User avatar
heggink
Posts: 989
Joined: Tuesday 08 September 2015 21:44
Target OS: Raspberry Pi / ODroid
Domoticz version: 12451
Location: NL
Contact:

Re: dzVents updateSetPoint errors out

Post by heggink »

It's a nest with a basic thermostat/setpoint device
Docker in Truenas scale, close to latest beta
DASHTICZ 🙃
RFXCOM, zwavejs2mqtt, zigbee2mqtt,
P1 meter & solar panel
Google home, Wifi Cams motion detection
Geofence iCloud, Bluetooth & Wifi ping
Harmony hub, Nest, lots more :-)
dannybloe
Posts: 1355
Joined: Friday 29 August 2014 11:26
Target OS: Raspberry Pi / ODroid
Domoticz version:
Location: Ermelo
Contact:

Re: dzVents updateSetPoint errors out

Post 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?
Creator dzVents - RPi3, loads of zwave devices, esp8266, evohome.
mivo
Posts: 80
Joined: Friday 21 April 2017 8:58
Target OS: Raspberry Pi / ODroid
Domoticz version: beta
Location: Czechia
Contact:

Re: dzVents updateSetPoint errors out

Post by mivo »

Hi Danny,

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

Thank you
My toys:
Raspberry Pi 3 + UPS PIco HV3.0 A Stack
Minibian (Raspbian Jessie) + Domoticz beta
RFLink 433 Gateway, 1wire DS18B20 temp sensors (GPIO)
RaZberry module + 2x Comet Z-Wave + Z-wave socket
---
Plugins: WeMo Switch, UPS PIco HV3.0A on GitHub
User avatar
heggink
Posts: 989
Joined: Tuesday 08 September 2015 21:44
Target OS: Raspberry Pi / ODroid
Domoticz version: 12451
Location: NL
Contact:

Re: dzVents updateSetPoint errors out

Post 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
Docker in Truenas scale, close to latest beta
DASHTICZ 🙃
RFXCOM, zwavejs2mqtt, zigbee2mqtt,
P1 meter & solar panel
Google home, Wifi Cams motion detection
Geofence iCloud, Bluetooth & Wifi ping
Harmony hub, Nest, lots more :-)
mivo
Posts: 80
Joined: Friday 21 April 2017 8:58
Target OS: Raspberry Pi / ODroid
Domoticz version: beta
Location: Czechia
Contact:

Re: dzVents updateSetPoint errors out

Post 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)
My toys:
Raspberry Pi 3 + UPS PIco HV3.0 A Stack
Minibian (Raspbian Jessie) + Domoticz beta
RFLink 433 Gateway, 1wire DS18B20 temp sensors (GPIO)
RaZberry module + 2x Comet Z-Wave + Z-wave socket
---
Plugins: WeMo Switch, UPS PIco HV3.0A on GitHub
User avatar
heggink
Posts: 989
Joined: Tuesday 08 September 2015 21:44
Target OS: Raspberry Pi / ODroid
Domoticz version: 12451
Location: NL
Contact:

Re: dzVents updateSetPoint errors out

Post 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!
Docker in Truenas scale, close to latest beta
DASHTICZ 🙃
RFXCOM, zwavejs2mqtt, zigbee2mqtt,
P1 meter & solar panel
Google home, Wifi Cams motion detection
Geofence iCloud, Bluetooth & Wifi ping
Harmony hub, Nest, lots more :-)
dannybloe
Posts: 1355
Joined: Friday 29 August 2014 11:26
Target OS: Raspberry Pi / ODroid
Domoticz version:
Location: Ermelo
Contact:

Re: dzVents updateSetPoint errors out

Post 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.
Creator dzVents - RPi3, loads of zwave devices, esp8266, evohome.
User avatar
heggink
Posts: 989
Joined: Tuesday 08 September 2015 21:44
Target OS: Raspberry Pi / ODroid
Domoticz version: 12451
Location: NL
Contact:

Re: dzVents updateSetPoint errors out

Post 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
Docker in Truenas scale, close to latest beta
DASHTICZ 🙃
RFXCOM, zwavejs2mqtt, zigbee2mqtt,
P1 meter & solar panel
Google home, Wifi Cams motion detection
Geofence iCloud, Bluetooth & Wifi ping
Harmony hub, Nest, lots more :-)
User avatar
heggink
Posts: 989
Joined: Tuesday 08 September 2015 21:44
Target OS: Raspberry Pi / ODroid
Domoticz version: 12451
Location: NL
Contact:

Re: dzVents updateSetPoint errors out

Post 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!
Docker in Truenas scale, close to latest beta
DASHTICZ 🙃
RFXCOM, zwavejs2mqtt, zigbee2mqtt,
P1 meter & solar panel
Google home, Wifi Cams motion detection
Geofence iCloud, Bluetooth & Wifi ping
Harmony hub, Nest, lots more :-)
freakshock
Posts: 64
Joined: Friday 14 April 2017 13:39
Target OS: NAS (Synology & others)
Domoticz version:
Location: The Netherlands
Contact:

Re: dzVents updateSetPoint errors out

Post 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
dannybloe
Posts: 1355
Joined: Friday 29 August 2014 11:26
Target OS: Raspberry Pi / ODroid
Domoticz version:
Location: Ermelo
Contact:

Re: dzVents updateSetPoint errors out

Post 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.
Creator dzVents - RPi3, loads of zwave devices, esp8266, evohome.
freakshock
Posts: 64
Joined: Friday 14 April 2017 13:39
Target OS: NAS (Synology & others)
Domoticz version:
Location: The Netherlands
Contact:

Re: dzVents updateSetPoint errors out

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

Who is online

Users browsing this forum: No registered users and 1 guest