Page 1 of 1
problem with json sgetting settings
Posted: Tuesday 04 November 2025 10:58
by manjh
I am in the process of migrating to Bookworm with the latest Domoticz version.
Most functions work, but I am struggling with a few last problems.
One of them is in a LUA script, where I need the latitude/longitude settings from Domoticz.
I changed the syntax (type-=command¶m=getsettings).
Here's a snippet of my code:
Code: Select all
JSON = require('JSON')
local url = "http://10.0.0.199:8080/json.htm?type=command¶m=getsettings"
local handle=assert(io.popen('curl -s ' .. url))
local Dom_Data = handle:read('*all')
handle:close()
local decoded_response = JSON:decode(Dom_Data)
When I run this in a LUA script, it throws "ERR".
But when I copy the json command into a browser tab, it comes back with a complete list of settings!
Why? Any ideas?
Re: problem with json sgetting settings
Posted: Tuesday 04 November 2025 13:35
by waltervl
Domoticz is running in a docker? Check the security settings as it uses a different IP within the docker.
When you do
Code: Select all
curl http://10.0.0.199:8080/json.htm?type=command¶m=getsettings
on the server running domoticz do you get a valid result?
Re: problem with json sgetting settings
Posted: Tuesday 04 November 2025 22:28
by manjh
No, not running in a Docker...
Re: problem with json sgetting settings
Posted: Tuesday 04 November 2025 23:12
by waltervl
So what about running the curl command on Domoticz server?
Re: problem with json sgetting settings
Posted: Tuesday 04 November 2025 23:28
by manjh
Not sure how you see that. I think the curl statement is on the server...
Meanwhile, I tried adding a valid userid/pw to the statement.
With a valid pw, it comes back with "ERR".
When I use an invalid pw, it comes back with "unauthorized".
Weird...
Re: problem with json sgetting settings
Posted: Tuesday 04 November 2025 23:40
by waltervl
If you do the curl command in a terminal session on the server as used in the lua script (so without user/password) you should get a a valid result back with the settings, an ERR or an unauthorized.
Depending on the result you can continue debugging what can be wrong.
Also check the Domoticz log when you do the curl command if it logs something about refused access.
Is the IP of the server mentioned in the trusted network security setting?
Re: problem with json sgetting settings
Posted: Wednesday 05 November 2025 8:11
by jannl
You have to put quotes around the url.
So basically do what Walter suggests and you will see the error.
Re: problem with json sgetting settings
Posted: Wednesday 05 November 2025 10:50
by manjh
jannl wrote: Wednesday 05 November 2025 8:11
You have to put quotes around the url.
So basically do what Walter suggests and you will see the error.
That did it... thanks! I never expected it to be so basic, especially since this code has been running for a long time without a problem. Migrating to Bookworm (with the newest Domoticz) broke the code...
Thanks for all the help!
Re: problem with json sgetting settings
Posted: Wednesday 05 November 2025 13:02
by jannl
Strange, didn't work on bulleye either. And looking at my code, the same counts for buster and earlier releases.
Re: problem with json sgetting settings
Posted: Wednesday 05 November 2025 16:04
by manjh
jannl wrote: Wednesday 05 November 2025 13:02
Strange, didn't work on bulleye either. And looking at my code, the same counts for buster and earlier releases.
I ran Buster, and migrated to Bookworm, so I skipped Bullseye.. It ran fine on Buster...
Re: problem with json sgetting settings
Posted: Wednesday 05 November 2025 16:53
by jannl
For curl it is recommended to use quotes when using an url with special characters like '?'
Some OS-ses however will handle the url correctly, but no garanty. I always had urls between quotes, staring with Jessie in 2014.
That being said, I see my Hue urls not all have quotes, but only the ones with no special chars.
Re: problem with json sgetting settings
Posted: Wednesday 05 November 2025 23:09
by manjh
OK, so the fact that it ran fine in Buster is just a "lucky flaw"...

Oh well. problem solved.
After migrating from Buster to Bookworm, I am more than ever convinced that the bulk of the time involved is in the small details.
Setting up a new system and installing the big blocks of software is not the issue.
What really took a lot of time is finding out the hard way that Domoticz changed some security settings. I knew about them, but it was a real pain finding all of them spread across my system components (Node Red, Traccar, P1 interface, Omnik inverter, etcetera). I'm sure I forgot a few.
And then it took a lot of time to find the issue mentioned in this thread.
But the good news is that I've learned a lot while working on this. And I learned the great value of this forum. A lot of people read it, and there's always someone with the right knowledge, willing to help.
Thank you all for this!
