Page 1 of 1

Error: Error opening url: http:

Posted: Tuesday 07 April 2020 9:49
by jojotjo
Hello,

I'll hope someone can help me. (sorry for my English)

There is a lot of information about the problem I have, but I can't find a solution.

The problem is that I want a switch from my fibaro HC2 system controlled by domoticz.

I'll tried a lot of different statements:
I have made a virtual switch and put there in the on-action the following line.
http://192.168.1.xx/api/callAction?devi ... ame=turnOn
when I used this line in a browser it works perfect.

The following error occurs:
2020-04-07 09:24:35.483 Status: User: Admin initiated a switch command (727/Lamp Test/On)
2020-04-07 09:24:35.694 Error: Error opening url: http://192.168.1.xx/api/callAction?devi ... ame=turnOn
I have tried it with several other commands such as:
http://User:[email protected]/api/c ... ame=turnOn
Also external with port forwarding to my fibaro HC2-system, in the browser they all worked.

I made also a script test.lua to test it.
commandArray = {}
os.execute ('curl -s "http://192.168.1.xx/api/callAction?devi ... ame=turnOn"')
return commandArray
With the following output.
2020-04-07 09:24:33.634 Status: Executing script: /home/pi/domoticz/scripts/test1.lua
2020-04-07 09:24:33.645 Error: Error executing script command (/home/pi/domoticz/scripts/test1.lua). returned: 32256

Please help!

Re: Error: Error opening url: http:

Posted: Tuesday 07 April 2020 10:27
by freijn
What is the network your Domoticz is in? ( what ip address ? )

looks to me your browser can reach the fibaro and your domoticz can't

Re: Error: Error opening url: http:

Posted: Tuesday 07 April 2020 12:20
by jojotjo
The ip adress starts also with 192.168.1.xx. It is in the same network. I have also a working connection to fibaro HC2 through the fibaro link. From HC2 I can reach domoticz also with a http-request.

Re: Error: Error opening url: http:

Posted: Tuesday 07 April 2020 12:25
by jojotjo
freijn wrote: Tuesday 07 April 2020 10:27 What is the network your Domoticz is in? ( what ip address ? )

looks to me your browser can reach the fibaro and your domoticz can't
The ip adress starts also with 192.168.1.xx. It is in the same network. I have also a working connection to fibaro HC2 through the fibaro link. From HC2 I can reach domoticz also with a http-request.

Re: Error: Error opening url: http:

Posted: Wednesday 08 April 2020 8:16
by freijn
instead of
os.execute ('curl -s "http://192.168.1.xx/api/callAction?devi ... ame=turnOn"')

can you try
os.execute ('curl -s \"http://192.168.1.xx/api/callAction?devi ... ame=turnOn\"')

I think its confused by the ' then " and then the "' again

Re: Error: Error opening url: http:

Posted: Wednesday 08 April 2020 11:47
by jojotjo
Thanks for your reply. I changed it, but I get the same error.

2020-04-08 11:43:31.904 Status: Executing script: /home/pi/domoticz/scripts/test1.lua
2020-04-08 11:43:31.915 Error: Error executing script command (/home/pi/domoticz/scripts/test1.lua). returned: 32256

Re: Error: Error opening url: http:

Posted: Monday 20 April 2020 13:38
by tahaahmed166
Facing the same error here, i also changed them but same issue persist, i guess it have something to do with website design.

Re: Error: Error opening url: http:

Posted: Monday 20 April 2020 14:15
by waaren
tahaahmed166 wrote: Monday 20 April 2020 13:38 Facing the same error here, i also changed them but same issue persist.
If you use this dzVents (100 % Lua) script, you might be able to identify what is causing your issue.

When not yet familiar with dzVents please start with reading Get started Before implementing (~ 5 minutes). Special attention please for "In Domoticz go to Setup > Settings > Other and in the section EventSystem make sure the checkbox 'dzVents enabled' is checked. Also make sure that in the Security section in the settings you allow 127.0.0.1 to not need a password. dzVents uses that port to send certain commands to Domoticz. Finally make sure you have set your current location in Setup > Settings > System > Location, otherwise there is no way to determine nighttime/daytime state."

Code: Select all

local testURL = 'http://192.168.1.xxx/api/callAction?deviceID=273&name=turnOn' -- change to the real http
local scriptVar = 'http test'

return 
{
    on = 
    {
        timer = 
        {
            'every minute', 
        },
        
        httpResponses = 
        {
            scriptVar,
        },
    },

    logging = 
    {
        level = domoticz.LOG_DEBUG,
        marker = scriptVar,
    },
    
    execute = function(dz, item)
        
        local lodash = dz.utils._
        
        local function sendURL()
            dz.openURL(
            {
                url = testURL,
                callback = scriptVar, 
            })
        end

        if item.isHTTPResponse then
            dz.log('return from openURL : ' .. lodash.str(item.data),dz.LOG_DEBUG)
        else
            sendURL()
        end
    end
}