Page 1 of 1

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

Posted: Saturday 04 March 2023 17:36
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?

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

Posted: Saturday 04 March 2023 21:08
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?

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

Posted: Saturday 04 March 2023 23:33
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.

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

Posted: Sunday 05 March 2023 0:11
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

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

Posted: Sunday 05 March 2023 9:42
by waltervl
Good, it is solved. Indeed dparam is not supoorted anymore in 2023.1