Page 2 of 2

Re: error opening url but url is good

Posted: Saturday 08 November 2025 9:21
by Gravityz
i used a script waaren made to inspect html strings.
it looks like nothing is returned while with curl under linux 200 ok is returned

Code: Select all

2025-11-08 09:19:00.319 dzVents: http test: ------ Start internal script: url-test:, trigger: "every minute"
2025-11-08 09:19:00.320 dzVents: Debug: http test: OpenURL: url = http://192.168.1.160/light/testlamp/turn_on?brightness=255&b=255&g=255&effect=none
2025-11-08 09:19:00.320 dzVents: Debug: http test: OpenURL: method = GET
2025-11-08 09:19:00.320 dzVents: Debug: http test: OpenURL: post data = nil
2025-11-08 09:19:00.320 dzVents: Debug: http test: OpenURL: headers = nil
2025-11-08 09:19:00.321 dzVents: Debug: http test: OpenURL: callback = http test
2025-11-08 09:19:00.321 dzVents: http test: ------ Finished url-test
2025-11-08 09:19:00.322 Status: EventSystem: Script event triggered: /opt/domoticz/dzVents/runtime/dzVents.lua
2025-11-08 09:19:00.346 Error: Error opening url: http://192.168.1.160/light/testlamp/turn_on?brightness=255&b=255&g=255&effect=none
2025-11-08 09:19:00.373 dzVents: http test: ------ Start internal script: url-test: HTTPResponse: "http test"
2025-11-08 09:19:00.374 dzVents: Debug: http test: return from openURL :
2025-11-08 09:19:00.375 dzVents: http test: ------ Finished url-test

Re: error opening url but url is good

Posted: Saturday 08 November 2025 12:20
by FlyingDomotic
Gravityz wrote: Friday 07 November 2025 17:12 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"&')
It seems that os.execute don't return errors. Just try with :

Code: Select all

os.execute("thisisan illegalcommand")
So every command you'll give to it will "succeed", even if you ask to execute garbage...

Re: error opening url but url is good

Posted: Saturday 08 November 2025 14:40
by jannl
You have to code the error handling.....like

Code: Select all

local status = os.execute("mkdir testfolder")
print(status)  -- 0 at success, otherwise errorcode

Re: error opening url but url is good

Posted: Sunday 09 November 2025 9:20
by Gravityz
thanks. got it working.
i do not need the returncode.
if i execute the command and it works(the light goes on or off) i am fine.

still figuring out if i can avoid this from the esphome side.