problem with json sgetting settings

Please use template to report bugs and problems. Post here your questions when not sure where else to post
Only for bugs in the Domoticz application! other problems go in different subforums!

Moderators: leecollings, remb0

Forum rules
Before posting here, make sure you are on the latest Beta or Stable version.
If you have problems related to the web gui, clear your browser cache + appcache first.

Use the following template when posting here:

Version: xxxx
Platform: xxxx
Plugin/Hardware: xxxx
Description:
.....

If you are having problems with scripts/blockly, always post the script (in a spoiler or code tag) or screenshots of your blockly

If you are replying, please do not quote images/code from the first post

Please mark your topic as Solved when the problem is solved.
Post Reply
manjh
Posts: 859
Joined: Saturday 27 February 2016 12:49
Target OS: Raspberry Pi / ODroid
Domoticz version: 2020.2
Location: NL
Contact:

problem with json sgetting settings

Post 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&param=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&param=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?
Hans
User avatar
waltervl
Posts: 6689
Joined: Monday 28 January 2019 18:48
Target OS: Linux
Domoticz version: 2025.1
Location: NL
Contact:

Re: problem with json sgetting settings

Post 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&param=getsettings

on the server running domoticz do you get a valid result?
Domoticz running on Udoo X86 (on Ubuntu)
Devices/plugins: ZigbeeforDomoticz (with Xiaomi, Ikea, Tuya devices), Nefit Easy, Midea Airco, Omnik Solar, Goodwe Solar
manjh
Posts: 859
Joined: Saturday 27 February 2016 12:49
Target OS: Raspberry Pi / ODroid
Domoticz version: 2020.2
Location: NL
Contact:

Re: problem with json sgetting settings

Post by manjh »

No, not running in a Docker...
Hans
User avatar
waltervl
Posts: 6689
Joined: Monday 28 January 2019 18:48
Target OS: Linux
Domoticz version: 2025.1
Location: NL
Contact:

Re: problem with json sgetting settings

Post by waltervl »

So what about running the curl command on Domoticz server?
Domoticz running on Udoo X86 (on Ubuntu)
Devices/plugins: ZigbeeforDomoticz (with Xiaomi, Ikea, Tuya devices), Nefit Easy, Midea Airco, Omnik Solar, Goodwe Solar
manjh
Posts: 859
Joined: Saturday 27 February 2016 12:49
Target OS: Raspberry Pi / ODroid
Domoticz version: 2020.2
Location: NL
Contact:

Re: problem with json sgetting settings

Post 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...
Hans
User avatar
waltervl
Posts: 6689
Joined: Monday 28 January 2019 18:48
Target OS: Linux
Domoticz version: 2025.1
Location: NL
Contact:

Re: problem with json sgetting settings

Post 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?
Domoticz running on Udoo X86 (on Ubuntu)
Devices/plugins: ZigbeeforDomoticz (with Xiaomi, Ikea, Tuya devices), Nefit Easy, Midea Airco, Omnik Solar, Goodwe Solar
jannl
Posts: 825
Joined: Thursday 02 October 2014 6:36
Target OS: Raspberry Pi / ODroid
Domoticz version: 2025.5.x
Location: Geleen
Contact:

Re: problem with json sgetting settings

Post by jannl »

You have to put quotes around the url.

Code: Select all

curl -s "http://...."
So basically do what Walter suggests and you will see the error.
manjh
Posts: 859
Joined: Saturday 27 February 2016 12:49
Target OS: Raspberry Pi / ODroid
Domoticz version: 2020.2
Location: NL
Contact:

Re: problem with json sgetting settings

Post by manjh »

jannl wrote: Wednesday 05 November 2025 8:11 You have to put quotes around the url.

Code: Select all

curl -s "http://...."
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!
Hans
jannl
Posts: 825
Joined: Thursday 02 October 2014 6:36
Target OS: Raspberry Pi / ODroid
Domoticz version: 2025.5.x
Location: Geleen
Contact:

Re: problem with json sgetting settings

Post by jannl »

Strange, didn't work on bulleye either. And looking at my code, the same counts for buster and earlier releases.
manjh
Posts: 859
Joined: Saturday 27 February 2016 12:49
Target OS: Raspberry Pi / ODroid
Domoticz version: 2020.2
Location: NL
Contact:

Re: problem with json sgetting settings

Post 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...
Hans
jannl
Posts: 825
Joined: Thursday 02 October 2014 6:36
Target OS: Raspberry Pi / ODroid
Domoticz version: 2025.5.x
Location: Geleen
Contact:

Re: problem with json sgetting settings

Post 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.
manjh
Posts: 859
Joined: Saturday 27 February 2016 12:49
Target OS: Raspberry Pi / ODroid
Domoticz version: 2020.2
Location: NL
Contact:

Re: problem with json sgetting settings

Post 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! :)
Hans
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest