JSON API setting using http:// does not work in new version Topic is solved

On various Hardware and OS systems: pi / windows / routers / nas, etc

Moderator: leecollings

Post Reply
Lemme
Posts: 45
Joined: Sunday 31 January 2016 13:50
Target OS: Windows
Domoticz version: Dev
Location: DK
Contact:

JSON API setting using http:// does not work in new version

Post by Lemme »

Version: 2023.1
Platform: Windows

My system crashed and I had to reinstall everything. So I updated from 2021.1 to latest version 2023.1 and restored my settings from my Backup.
Everything seem to work now, except one thing. I have a switch (IDX:99) that toggels another switch (IDX:53) using the JSON API script:
___http://127.0.0.1:83/json.htm?type=command&dparam=switchlight&idx=53&switchcmd=Toggle___
Image
http://80.197.110.104:82/deling/Switch.jpg

The switch (IDX:99) changes state as it should, but it seems that it does not trigger the script.

This is my security setting:
Image
http://80.197.110.104:82/deling/Security.jpg


Does anyone have a clue what could cause this? Is there a new security setting that I missed?
User avatar
waltervl
Posts: 6002
Joined: Monday 28 January 2019 18:48
Target OS: Linux
Domoticz version: 2025.1
Location: NL
Contact:

Re: JSON API setting using http:// does not work in new version

Post by waltervl »

What if you use the api call in a browser? Will it also not trigger a script?
And is that the on/off action script on the device or a lua/dzvents script that gets triggered on device changes that not receives the trigger?
Domoticz running on Udoo X86 (on Ubuntu)
Devices/plugins: ZigbeeforDomoticz (with Xiaomi, Ikea, Tuya devices), Nefit Easy, Midea Airco, Omnik Solar, Goodwe Solar
Lemme
Posts: 45
Joined: Sunday 31 January 2016 13:50
Target OS: Windows
Domoticz version: Dev
Location: DK
Contact:

Re: JSON API setting using http:// does not work in new version

Post by Lemme »

Good point - I forgot to test that. Here is the reply when calling the script directly in the browser:
{
"status" : "ERR"
}

Trying to answer your last question...the switch (IDX:99) do get triggered, but do not execute the script (at least it seems that way). The switch (IDX:53) that are supposed to be triggered by the script will trigger OK if I do it directly in Domoticz's Web interface. So the switches work independently, but the script itself fails.

I wonder what is causing the error in the new Domoticz version.
Lemme
Posts: 45
Joined: Sunday 31 January 2016 13:50
Target OS: Windows
Domoticz version: Dev
Location: DK
Contact:

Re: JSON API setting using http:// does not work in new version

Post by Lemme »

I got it figured out - looking closely at the code again!

A long time ago when I first tried this command, there were some things that did not work, and I found an odd solution elsewhere. It was changing part of the parameter from 'param=switchlight' to 'dparam=switchlight'.

So this cosde does not work anymore:
___http://127.0.0.1:83/json.htm?type=command&dparam=switchlight&idx=53&switchcmd=Toggle___

But this does:
___http://127.0.0.1:83/json.htm?type=command&param=switchlight&idx=53&switchcmd=Toggle___

Thanks for pointing me in the right direction with the browser check :D
User avatar
waltervl
Posts: 6002
Joined: Monday 28 January 2019 18:48
Target OS: Linux
Domoticz version: 2025.1
Location: NL
Contact:

Re: JSON API setting using http:// does not work in new version

Post by waltervl »

Good, it is solved. Indeed dparam is not supoorted anymore in 2023.1
Domoticz running on Udoo X86 (on Ubuntu)
Devices/plugins: ZigbeeforDomoticz (with Xiaomi, Ikea, Tuya devices), Nefit Easy, Midea Airco, Omnik Solar, Goodwe Solar
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest