Page 1 of 2
error opening url but url is good
Posted: Wednesday 05 November 2025 19:02
by Gravityz
hello,
really simple question.
i am opening an url in dzvents with following command.
the command executes fine but there is an error in the log
domoticz.openURL('
http://192.168.1.165/light/douchelamp/t ... ffect=none')
works, light changes color
error in the log
2025-11-05 18:53:03.420 Error: Error opening url:
http://192.168.1.165/light/douchelamp/t ... ffect=none
so why is this error showing while the html executes fine both from dzvents as well as google chrome
Re: error opening url but url is good
Posted: Wednesday 05 November 2025 19:25
by jannl
What kind of switch are you operating? Nothing in Domoticz I presume?
Re: error opening url but url is good
Posted: Wednesday 05 November 2025 19:28
by Gravityz
no this is an esphome module(lightbulb)
when inspecting it in chrome it is complaining about a resource not loaded favicon.ico.
could it be that this file is not in the root of the lightbulb os of esphome
Re: error opening url but url is good
Posted: Wednesday 05 November 2025 19:33
by waltervl
So it seems the url does not give a proper response back. Normally this should be 200.
What do you see as response if you run to following command in a terminal window
Code: Select all
curl http://192.168.1.165/light/douchelamp/turn_on?brightness=255&b=255&g=255&effect=none
Re: error opening url but url is good
Posted: Wednesday 05 November 2025 19:45
by Gravityz
that does not seem to work
it is either firing up multiple sessions or i do not see it at all. format is incorrect
i am using a terminal inside synology(linux)
Re: error opening url but url is good
Posted: Wednesday 05 November 2025 19:49
by Gravityz
HTTP/1.1 404 Not Found
Re: error opening url but url is good
Posted: Wednesday 05 November 2025 19:49
by waltervl
Perhaps put quotes around the url.
Re: error opening url but url is good
Posted: Wednesday 05 November 2025 19:50
by Gravityz
Re: error opening url but url is good
Posted: Wednesday 05 November 2025 19:52
by waltervl
Gravityz wrote: Wednesday 05 November 2025 19:49
HTTP/1.1 404 Not Found
Could be because you need quotes around the url as you have special characters in the url. Then it cannot find it.
But if you get that response but the light is switched then something is very wrong on the other side...
Re: error opening url but url is good
Posted: Wednesday 05 November 2025 20:04
by Gravityz
finally
curl -v -d -urlencode
http://192.168.1.165/light/douchelamp/t ... ffect=none
root@DISKSTATION:~# > POST /light/douchelamp/turn_on?brightness=255 HTTP/1.1
> Host: 192.168.1.165
> User-Agent: curl/7.86.0
> Accept: */*
> Content-Length: 10
> Content-Type: application/x-www-form-urlencoded
>
< HTTP/1.1 200 OK
< Access-Control-Allow-Origin: *
< connection: close
< accept-ranges: none
< content-length: 0
Re: error opening url but url is good
Posted: Wednesday 05 November 2025 20:13
by waltervl
So the response is OK, then dzvents would not complain on it too. Perhaps some urlencoding needed to get it running in dzvents?
Re: error opening url but url is good
Posted: Wednesday 05 November 2025 20:19
by Gravityz
yes this is really strange.
even with a simple string(without ?) it generates an error
Error: Error opening url:
http://192.168.1.165/light/douchelamp/turn_on
the problem is this light is an RGBWWZ light.
i can not control it with the gui.
with domoticz commands like .setcolor i can change the light but i can not access special effects inside the light.
with the html code i can access the special effect but the call generate an error
maybe i can test it with os.execute and then curl but have to see what the format is
Re: error opening url but url is good
Posted: Wednesday 05 November 2025 21:03
by waltervl
You probably have to use the urlencode function as described in the wiki:
urlEncode(s, [strSub]): Function. Simple url encoder for string so you can use them in openURL(). strSub is optional and defaults to + but you can also pass %20 if you like/need.
Re: error opening url but url is good
Posted: Friday 07 November 2025 17:12
by Gravityz
tried it, does not work.
the problem is not that the command is not working, it is working fine but generates an error in the log
got it working with os.execute, also with -urlencode
Code: Select all
os.execute ('curl --data -urlencode "http://192.168.1.165/light/douchelamp/turn_on?brightness=255&b=255&g=255&effect=Fast%20Pulse"&')
Re: error opening url but url is good
Posted: Friday 07 November 2025 19:09
by FlyingDomotic
What's response returned by this request. Is this a 200 code, or something else ?
Re: error opening url but url is good
Posted: Friday 07 November 2025 23:08
by Gravityz
i tested the response and it is a normal 200 like in the post i mentioned before.
i think this is a bug in domoticz.
solved it by using os.execute
Re: error opening url but url is good
Posted: Saturday 08 November 2025 0:41
by waltervl
I think it is a encode issue.
If it is a bug, I dont think so. Did you try to escape the special characters with a /
Re: error opening url but url is good
Posted: Saturday 08 November 2025 8:20
by Gravityz
i tried it with \
even with a really simple command linked to the on or of action on a switch i get this error in the log
ESPHOME device
http://192.168.1.160/light/testlamp/turn_on
http://192.168.1.160/light/testlamp/turn_off
this switches the light on and off like it should but generates an error in the log
2025-11-08 08:13:36.817 Error: Error opening url:
http://192.168.1.160/light/testlamp/turn_off
ESPEASY device
i use thise commands on other devices also without any errors
http://192.168.1.150/control?cmd=GPIO,5,1
please note this
dzVents: domoticz.urlEncode deprecated. Please use domoticz.utils.urlEncode.
tried it with same result
i think it is device related, really strange because it returns a 200 ok statement
maybe the responsetime from the esphome device is different and domoticz thinks it can not open the url while it actually does open
Re: error opening url but url is good
Posted: Saturday 08 November 2025 8:42
by habahabahaba
May be double quotes needed?
Re: error opening url but url is good
Posted: Saturday 08 November 2025 8:52
by Gravityz
tried it. both ' and " work but generates error
since these commands work fine on espeasy it must be something webserver related in esphome(but only domoticz complains, nothing else
i know domoticz and espeasy is working way better together i am starting to use esphome for projects which support other platforms BK72xx chips, modbus etc)
esphome has a step learningcurve but once you get the hang of it it gets easier.
also esphome has better mqtt support and works with domoticz mqtt AD.
a light which i could not get to work with openbk(which supports HA and should support MQTT AD) worked instantly once i flashed esphome