Autentication problem dzVents

Topics (not sure which fora)
when not sure where to post, post here and mods will move it to right forum.

Moderators: leecollings, remb0

Post Reply
janpeetoom
Posts: 12
Joined: Sunday 29 December 2019 12:07
Target OS: Linux
Domoticz version:
Contact:

Autentication problem dzVents

Post by janpeetoom »

Hello.

I have a problem running some scripts in dzVents.
for instance this test script:

Code: Select all

return {
	on = {
		timer = {'every minute'},
		httpResponses = { 'testUrl*' },
	},
	execute = function(dz, item)
		if item.isHTTPResponse then
			dz.utils.dumpTable(item)
			dz.log('Domoticz and dzVents version: ' .. dz.settings.domoticzVersion .. ', ' .. dz.settings.dzVentsVersion,dz.LOG_FORCE)
			dz.log('Domoticz url: ' .. dz.settings['Domoticz url'],dz.LOG_FORCE)
		else
		    urls =
			{ 	
				-- ["testUrl1"] = 'http://192.168.1.231:8080//json.htm?type=command&param=udevice&idx=109&nvalue=0&svalue=12',
				-- ["testUrl2"] = 'http://192.168.1.231:8080/json.htm?type=command&param=udevice&idx=109&nvalue=0&svalue=12', 
				-- ["testUrl3"] = dz.settings['Domoticz url'] .. '//json.htm?type=command&param=udevice&idx=109&nvalue=0&svalue=12' ,
				["testUrl4"] = dz.settings['Domoticz url'] .. '/json.htm?type=command&param=udevice&idx=109&nvalue=0&svalue=12' ,
			}

			for callback, url in pairs(urls) do 
				dz.openURL({ url = url , callback = callback })
			end
		end
	end
}
It gives the following error message:
  • 2022-10-08 23:10:00.275 Status: EventSystem: Script event triggered: /home/pi/domoticz/dzVents/runtime/dzVents.lua
    2022-10-08 23:10:00.359 Status: dzVents: > data: <html><head><title>Unauthorized</title></head><body><h1>401 Unauthorized</h1></body></html>
    2022-10-08 23:10:00.359 Status: dzVents: > statusCode: 401
    2022-10-08 23:10:00.359 Status: dzVents: > _contentType: text/html;charset=UTF-8
    2022-10-08 23:10:00.359 Status: dzVents: > isShellCommandResponse: false
    2022-10-08 23:10:00.359 Status: dzVents: > isTimer: false
    2022-10-08 23:10:00.359 Status: dzVents: > isScene: false
    2022-10-08 23:10:00.360 Status: dzVents: > isSecurity: false
    2022-10-08 23:10:00.360 Status: dzVents: > isGroup: false
    2022-10-08 23:10:00.360 Status: dzVents: > statusText: Unauthorized
    2022-10-08 23:10:00.360 Status: dzVents: > xml:
    2022-10-08 23:10:00.360 Status: dzVents: > html:
    2022-10-08 23:10:00.360 Status: dzVents: > head:
    2022-10-08 23:10:00.360 Status: dzVents: > title: Unauthorized
    2022-10-08 23:10:00.360 Status: dzVents: > body:
    2022-10-08 23:10:00.360 Status: dzVents: > h1: 401 Unauthorized
    2022-10-08 23:10:00.360 Status: dzVents: > trigger: testUrl4
    2022-10-08 23:10:00.360 Status: dzVents: > isSystem: false
    2022-10-08 23:10:00.360 Status: dzVents: > ok: false
    2022-10-08 23:10:00.360 Status: dzVents: > isCustomEvent: false
    2022-10-08 23:10:00.360 Status: dzVents: > headers:
    2022-10-08 23:10:00.360 Status: dzVents: > Set-Cookie: DMZSID=none; HttpOnly; Expires=Thu, 01 Jan 1970 00:00:00 GMT
    2022-10-08 23:10:00.360 Status: dzVents: > Content-Type: text/html;charset=UTF-8
    2022-10-08 23:10:00.360 Status: dzVents: > Content-Length: 91
    2022-10-08 23:10:00.360 Status: dzVents: > isVariable: false
    2022-10-08 23:10:00.360 Status: dzVents: > baseType: httpResponse
    2022-10-08 23:10:00.360 Status: dzVents: > isHardware: false
    2022-10-08 23:10:00.360 Status: dzVents: > isJSON: false
    2022-10-08 23:10:00.360 Status: dzVents: > isHTTPResponse: true
    2022-10-08 23:10:00.360 Status: dzVents: > isDevice: false
    2022-10-08 23:10:00.360 Status: dzVents: > protocol: HTTP/1.1
    2022-10-08 23:10:00.360 Status: dzVents: > dump()
    2022-10-08 23:10:00.360 Status: dzVents: > isXML: true
    2022-10-08 23:10:00.360 Status: dzVents: > callback: testUrl4
    2022-10-08 23:10:00.360 Status: dzVents: !Info: Domoticz and dzVents version: 2022.1 (build 14537), 3.1.8
    2022-10-08 23:10:00.360 Status: dzVents: !Info: Domoticz url: http://127.0.0.1:8080
    2022-10-08 23:10:00.282 Error: Error opening url: http://127.0.0.1:8080/json.htm?type=com ... &svalue=12
    2022-10-08 23:10:00.355 Error: dzVents: Error: (3.1.8) HTTP/1.1 response: 401 ==>> Unauthorized
I have the following local network settings: 127.0.0.1,192.168.178.*
Does anyone have any idea?
Greetings Jan
willemd
Posts: 631
Joined: Saturday 21 September 2019 17:55
Target OS: Raspberry Pi / ODroid
Domoticz version: 2024.1
Location: The Netherlands
Contact:

Re: Autentication problem dzVents

Post by willemd »

What happens if you copy and paste the exact same url into a browser? IS the page shown or do you get an error message as well?
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest