Page 1 of 1

dzvents and docker icm xx

Posted: Tuesday 15 June 2021 8:29
by pvklink
Problem: when execute an url with dz.openURL it works, but i get an error afterwards
What i did:
-- stripped the script to the essential problem
-- also installed curl within the default docker container (domoticz/domoticz) in bridge mode,
-- no solution, error stays
-- think that it has something to do with the callback ?

RPI 4b4gb, buster latest beta
Domoticz docker domoticz/domoticz
error

Code: Select all

2021-06-15 08:23:05.123 Status: User: Admin (IP: 192.168.1.10) initiated a switch command (1483/testxx/Off)
2021-06-15 08:23:05.268 Status: dzVents: Info: ------ Start internal script: testdenon: Device: "testxx (dummydevices)", Index: 1483
2021-06-15 08:23:05.269 Status: dzVents: Debug: OpenURL: url = http://192.168.20.26/MainZone/index.put.asp?cmd0=PutZone_OnOff/OFF
2021-06-15 08:23:05.269 Status: dzVents: Debug: OpenURL: method = GET
2021-06-15 08:23:05.269 Status: dzVents: Debug: OpenURL: post data = nil
2021-06-15 08:23:05.269 Status: dzVents: Debug: OpenURL: headers = nil
2021-06-15 08:23:05.269 Status: dzVents: Debug: OpenURL: callback = testxx
2021-06-15 08:23:05.270 Status: dzVents: Info: ------ Finished testdenon
2021-06-15 08:23:05.492 Status: dzVents: Info: ------ Start internal script: testdenon: HTTPResponse: "testxx"
2021-06-15 08:23:05.493 Status: dzVents: Debug: Denon successfully send
2021-06-15 08:23:05.494 Status: dzVents: Info: ------ Finished testdenon
2021-06-15 08:23:05.293 Error: Error opening url: http://192.168.20.26/MainZone/index.put.asp?cmd0=PutZone_OnOff/OFF

Code: Select all

return {
	on = {
		devices = {'testxx'},
        httpResponses = {'testxx'}
	},
	logging = 
	{
	    level = domoticz.LOG_DEBUG,
	    marker = testxx,
	},

    execute = function(dz, item,info)

    if item.isDevice then
        if item.state == 'Off' then                                        

            dz.openURL({url='http://192.168.20.26/MainZone/index.put.asp?cmd0=PutZone_OnOff/OFF',method = 'GET',callback = 'testxx'})
            
        else

            dz.openURL({url='http://192.168.20.26/MainZone/index.put.asp?cmd0=PutZone_OnOff/ON',method = 'GET',callback = 'testxx'})

        end
    elseif (item.isHTTPResponse) then
        if (item.ok) then
            dz.log('Denon successfully send', dz.LOG_DEBUG)
        else
            dz.log('No valid response from Denon command: ' .. item.statusCode, dz.LOG_ERROR)
            dz.log(item, dz.LOG_DEBUG)
        end
    end

end
}

Re: dzvents and docker icm xx

Posted: Tuesday 15 June 2021 12:20
by waaren
pvklink wrote: Tuesday 15 June 2021 8:29 Problem: when execute an url with dz.openURL it works, but i get an error afterwards
Below version will show some extra information of the return (item)

Code: Select all

return {
    on = {
        devices = {'testxx'},
        httpResponses = {'testxx'}
    },
    logging = 
    {
        level = domoticz.LOG_DEBUG,
        marker = testxx,
    },

    execute = function(dz, item,info)

    if item.isDevice then
        if item.state == 'Off' then                                        

            dz.openURL({url='http://192.168.20.26/MainZone/index.put.asp?cmd0=PutZone_OnOff/OFF',method = 'GET',callback = 'testxx'})
            
        else

            dz.openURL({url='http://192.168.20.26/MainZone/index.put.asp?cmd0=PutZone_OnOff/ON',method = 'GET',callback = 'testxx'})

        end
    elseif (item.isHTTPResponse) then
        if (item.ok) then
            dz.log('Denon successfully send', dz.LOG_DEBUG)
        else
            dz.log('No valid response from Denon command: ' .. item.statusCode, dz.LOG_ERROR)
        end
        dz.log(item, dz.LOG_DEBUG)
    end

end
}

Re: dzvents and docker icm xx

Posted: Tuesday 15 June 2021 12:22
by pvklink
Great!, missing info to solve this issue...
Gonna execuite your script, to see whats going wrong

Re: dzvents and docker icm xx

Posted: Tuesday 15 June 2021 12:24
by waaren
pvklink wrote: Tuesday 15 June 2021 12:22 that would be great, missing info to solve this issue...
included the missing code in my previous post now

Re: dzvents and docker icm xx

Posted: Tuesday 15 June 2021 12:28
by pvklink
I get this info back, is statusCode=200 the thing to look for?

2021-06-15 12:25:50.952 Status: User: Admin (IP: 192.168.1.10) initiated a switch command (1483/testxx/On)
2021-06-15 12:25:51.066 Status: dzVents: Info: ------ Start internal script: testdenon: Device: "testxx (dummydevices)", Index: 1483
2021-06-15 12:25:51.066 Status: dzVents: Debug: OpenURL: url = http://192.168.20.26/MainZone/index.put ... e_OnOff/ON
2021-06-15 12:25:51.066 Status: dzVents: Debug: OpenURL: method = GET
2021-06-15 12:25:51.066 Status: dzVents: Debug: OpenURL: post data = nil
2021-06-15 12:25:51.067 Status: dzVents: Debug: OpenURL: headers = nil
2021-06-15 12:25:51.067 Status: dzVents: Debug: OpenURL: callback = testxx
2021-06-15 12:25:51.067 Status: dzVents: Info: ------ Finished testdenon
2021-06-15 12:25:52.245 Status: dzVents: Info: ------ Start internal script: testdenon: HTTPResponse: "testxx"
2021-06-15 12:25:52.246 Status: dzVents: Debug: Denon successfully send
2021-06-15 12:25:52.246 Status: dzVents: Debug: {["isTimer"]=false, ["protocol"]="HTTP/1.0", ["callback"]="testxx", ["ok"]=true, ["dump"]=function, ["data"]="", ["baseType"]="httpResponse", ["_contentType"]="text/html", ["isShellCommandResponse"]=false, ["isHardware"]=false, ["isCustomEvent"]=false, ["isVariable"]=false, ["headers"]={["Pragma"]="no-cache", ["Server"]="GoAhead-Webs", ["Content-type"]="text/html", ["CONTENT-LANGUAGE"]="en", ["Date"]="Sat Jan 1 00:00:00 2000", ["Cache-Control"]="no-cache"}, ["isHTTPResponse"]=true, ["statusCode"]=200, ["isSystem"]=false, ["isSecurity"]=false, ["trigger"]="testxx", ["isXML"]=false, ["statusText"]="OK", ["isDevice"]=false, ["isJSON"]=false, ["isGroup"]=false, ["isScene"]=false}
2021-06-15 12:25:52.247 Status: dzVents: Info: ------ Finished testdenon
2021-06-15 12:25:52.108 Error: Error opening url: http://192.168.20.26/MainZone/index.put ... e_OnOff/ON

Re: dzvents and docker icm xx

Posted: Tuesday 15 June 2021 12:34
by pvklink
there is another line after the error
2021-06-15 12:26:48.899 Proxy: Error, reconnecting (Connection timed out)

Re: dzvents and docker icm xx

Posted: Tuesday 15 June 2021 14:42
by waaren
pvklink wrote: Tuesday 15 June 2021 12:28 I get this info back, is statusCode=200 the thing to look for?
statusCode = 200 is something dzVents looks for so this part is OK. Don't see why domoticz generates the error.

Re: dzvents and docker icm xx

Posted: Tuesday 15 June 2021 19:24
by pvklink
i also dont see it, must be something with docker, maybe bridgemodus ?
This is above my very poor skills :-)

Re: dzvents and docker icm xx

Posted: Tuesday 15 June 2021 19:30
by pvklink
is it an option to execute this url from the os in the domoticz docker ?
time problem ?
(the url is a call to my denon receiver...)

docker domoticz/domoticz

curl -I 'http://192.168.20.26/MainZone/index.put ... _OnOff/OFF'

HTTP/1.0 200 OK
Date: Sat Jan 1 00:00:00 2000
Server: GoAhead-Webs
Pragma: no-cache
Cache-Control: no-cache
CONTENT-LANGUAGE: en
Content-type: text/html

Re: dzvents and docker icm xx

Posted: Wednesday 16 June 2021 8:10
by waltervl
Proxy error I think is related tot MyDomoticz. That server seems to be offline for some time now. I have the same error every couple of minutes.

Re: dzvents and docker icm xx

Posted: Wednesday 16 June 2021 17:49
by pvklink
okay, but i dont use a proxy, perhaps old settings to mydomoticz...I wil check and remove...

Re: dzvents and docker icm xx

Posted: Wednesday 16 June 2021 17:54
by pvklink
ok, remove my setting from mydomoticz... still the same "error"..
Perhaps something to do with docker/bridgemodus