Page 1 of 1

question on api call through domoticz itself

Posted: Friday 10 March 2023 18:15
by red59
hello,
until now i was using a dummy selector to trigger a sepcific level on a dimmer , using api call :

for example on my dummy i have this level set :
10 with this action :
http://domoticz.redhome.local:8090/json ... l&level=12

so it sets level 12 on my dimmer.

everything was working until i update (from 2022.1 to 2023.1), i understand there has been modifications, soi i added authentication :
action : http://myuser:[email protected] ... l&level=12

but it is not working in domoticz (but working fine when doing a curl...) so what is wrong ? how can i get this working (without making a script call that do curl...) ?

thanks for your help !

Re: question on api call through domoticz itself

Posted: Friday 10 March 2023 19:11
by kiddigital
If doing API calls over (unsecured) HTTP, you now have to explicitly enable it via the Security settings (see the changelog).

Make sure the credentials are provided correctly (via a Basic Authentication header) or that the calling script is within the Trusted network (more secure to use proper credentials and access rights)

Re: question on api call through domoticz itself

Posted: Friday 10 March 2023 19:18
by red59
i think it is enabled, because doing it through curl is working, but i would like to make it working through domoticz interface directly, which was working before update....

question on api call through domoticz itself

Posted: Friday 10 March 2023 19:22
by kiddigital
What do you mean with ‘through Domoticz interface’? Through the Browser? Can you post a screenshot?

You can run Domoticz with additional debugging info by activating the debug loglevel and set debug loglevel flags (see wiki).

If you run with debugflags webserver, received and auth you get much more info on what is going on in Domoticz internals.

Re: question on api call through domoticz itself

Posted: Saturday 11 March 2023 9:20
by red59
see attachment, i have tested on level 20 and 50 without success.
but the same line in curl is working...

Re: question on api call through domoticz itself

Posted: Wednesday 29 March 2023 23:15
by red59
No Idea on how to make this working again ?

Re: question on api call through domoticz itself

Posted: Thursday 30 March 2023 6:40
by kiddigital
I do not understand what you are trying to do and what the screenshot should show?

Did you run Domoticz with the before mentioned debug flags? What was the debug output?

Make sure that you have set the correct security settings, see the changelog of 2023.1 and Wiki for more information.

Re: question on api call through domoticz itself

Posted: Thursday 30 March 2023 8:01
by lost
kiddigital wrote: Thursday 30 March 2023 6:40 I do not understand what you are trying to do and what the screenshot should show?
As many french users he use a qubino module to drive heaters ( pilot wire mode mandatory in France) that is controlled as a dimmer for compatibility purpose.
0 to 10% as off
11 to 20 as anti icing ( 7°)
Etc...
So using a virtual device to show real heater mode.

Re: question on api call through domoticz itself

Posted: Thursday 13 April 2023 21:45
by red59
Yes exactly, i use a virtual device which modify real device through api call. But it doesn not work anymore.

Re: question on api call through domoticz itself

Posted: Thursday 13 April 2023 21:53
by waltervl
What if you use localhost or local IP address instead of server name domoticz.redhome.local ? And put localhost or Iocal IP address in the trusted network setting.

As you are calling the api from the server itself, not from an external client, it is not needed to call it from outside. Perhaps that is blocking it now.

Re: question on api call through domoticz itself

Posted: Friday 14 April 2023 9:01
by Kedi
Why not use dzVents?

Re: question on api call through domoticz itself

Posted: Friday 14 April 2023 9:26
by waltervl
It should work with this option to use device actions too. It is now a kind of bug or misconfiguration due to security changes.

Re: question on api call through domoticz itself

Posted: Friday 14 April 2023 9:28
by waltervl
red59 wrote: Friday 10 March 2023 18:15 but it is not working in domoticz (but working fine when doing a curl...) so what is wrong ? how can i get this working (without making a script call that do curl...) ?
Is the curl also working when running on the domoticz server itself (as that is what happens using these device actions)?

Re: question on api call through domoticz itself

Posted: Tuesday 17 October 2023 21:23
by red59
sorry for delay, but i have switched on another subject and forget this, but, i am still trying how to mak it works.

to answer : yes the curl command (with http://myuser:[email protected] ... l&level=12) is working from domoticz itself.

but not from action ...

please help....

Re: question on api call through domoticz itself

Posted: Tuesday 17 October 2023 21:30
by red59
if no solution i will have to use dzevent, but it was much more easier to use api through action directly... (and was working)

Re: question on api call through domoticz itself

Posted: Thursday 19 October 2023 21:03
by red59
try dzevent with openURL, but it doesn t work also... i don't understand... please help.... same :

Error: Error opening url: http://<myip:port>/json.htm?type=command&param=setactivetimerplan&ActiveTimerPlan=2

Re: question on api call through domoticz itself

Posted: Thursday 19 October 2023 23:38
by waltervl
Also be aware that these urls are case sensitive so be sure you do type it correct!

And if you are running Domoticz in a docker container you have to use the IP address of the internal Domoticz docker container.

Re: question on api call through domoticz itself

Posted: Friday 20 October 2023 7:57
by red59
I will try using domoticz internal docker IP adress.
I keep you informed