question on api call through domoticz itself

Topics (not sure which fora)
when not sure where to post, post here and mods will move it to right forum.

Moderators: leecollings, remb0

Post Reply
red59
Posts: 22
Joined: Wednesday 04 October 2017 13:29
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

question on api call through domoticz itself

Post 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 !
User avatar
kiddigital
Posts: 438
Joined: Thursday 10 August 2017 6:52
Target OS: Raspberry Pi / ODroid
Domoticz version: Beta
Location: Netherlands
Contact:

Re: question on api call through domoticz itself

Post 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)
One RPi with Domoticz, RFX433e, aeon labs z-wave plus stick GEN5, ha-bridge 5.4.0 for Alexa, Philips Hue Bridge, Pimoroni Automation Hat
One RPi with Pi foundation standard touch screen to display Dashticz
red59
Posts: 22
Joined: Wednesday 04 October 2017 13:29
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: question on api call through domoticz itself

Post 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....
User avatar
kiddigital
Posts: 438
Joined: Thursday 10 August 2017 6:52
Target OS: Raspberry Pi / ODroid
Domoticz version: Beta
Location: Netherlands
Contact:

question on api call through domoticz itself

Post 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.
One RPi with Domoticz, RFX433e, aeon labs z-wave plus stick GEN5, ha-bridge 5.4.0 for Alexa, Philips Hue Bridge, Pimoroni Automation Hat
One RPi with Pi foundation standard touch screen to display Dashticz
red59
Posts: 22
Joined: Wednesday 04 October 2017 13:29
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: question on api call through domoticz itself

Post by red59 »

see attachment, i have tested on level 20 and 50 without success.
but the same line in curl is working...
Attachments
domoticz.jpg
domoticz.jpg (167.94 KiB) Viewed 1355 times
red59
Posts: 22
Joined: Wednesday 04 October 2017 13:29
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: question on api call through domoticz itself

Post by red59 »

No Idea on how to make this working again ?
User avatar
kiddigital
Posts: 438
Joined: Thursday 10 August 2017 6:52
Target OS: Raspberry Pi / ODroid
Domoticz version: Beta
Location: Netherlands
Contact:

Re: question on api call through domoticz itself

Post 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.
One RPi with Domoticz, RFX433e, aeon labs z-wave plus stick GEN5, ha-bridge 5.4.0 for Alexa, Philips Hue Bridge, Pimoroni Automation Hat
One RPi with Pi foundation standard touch screen to display Dashticz
lost
Posts: 664
Joined: Thursday 10 November 2016 9:30
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: question on api call through domoticz itself

Post 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.
red59
Posts: 22
Joined: Wednesday 04 October 2017 13:29
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: question on api call through domoticz itself

Post by red59 »

Yes exactly, i use a virtual device which modify real device through api call. But it doesn not work anymore.
User avatar
waltervl
Posts: 5907
Joined: Monday 28 January 2019 18:48
Target OS: Linux
Domoticz version: 2024.7
Location: NL
Contact:

Re: question on api call through domoticz itself

Post 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.
Domoticz running on Udoo X86 (on Ubuntu)
Devices/plugins: ZigbeeforDomoticz (with Xiaomi, Ikea, Tuya devices), Nefit Easy, Midea Airco, Omnik Solar, Goodwe Solar
Kedi
Posts: 577
Joined: Monday 20 March 2023 14:41
Target OS: Raspberry Pi / ODroid
Domoticz version:
Location: Somewhere in NL
Contact:

Re: question on api call through domoticz itself

Post by Kedi »

Why not use dzVents?
Logic will get you from A to B. Imagination will take you everywhere.
User avatar
waltervl
Posts: 5907
Joined: Monday 28 January 2019 18:48
Target OS: Linux
Domoticz version: 2024.7
Location: NL
Contact:

Re: question on api call through domoticz itself

Post 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.
Domoticz running on Udoo X86 (on Ubuntu)
Devices/plugins: ZigbeeforDomoticz (with Xiaomi, Ikea, Tuya devices), Nefit Easy, Midea Airco, Omnik Solar, Goodwe Solar
User avatar
waltervl
Posts: 5907
Joined: Monday 28 January 2019 18:48
Target OS: Linux
Domoticz version: 2024.7
Location: NL
Contact:

Re: question on api call through domoticz itself

Post 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)?
Domoticz running on Udoo X86 (on Ubuntu)
Devices/plugins: ZigbeeforDomoticz (with Xiaomi, Ikea, Tuya devices), Nefit Easy, Midea Airco, Omnik Solar, Goodwe Solar
red59
Posts: 22
Joined: Wednesday 04 October 2017 13:29
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: question on api call through domoticz itself

Post 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....
red59
Posts: 22
Joined: Wednesday 04 October 2017 13:29
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: question on api call through domoticz itself

Post 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)
red59
Posts: 22
Joined: Wednesday 04 October 2017 13:29
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: question on api call through domoticz itself

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

Re: question on api call through domoticz itself

Post 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.
Domoticz running on Udoo X86 (on Ubuntu)
Devices/plugins: ZigbeeforDomoticz (with Xiaomi, Ikea, Tuya devices), Nefit Easy, Midea Airco, Omnik Solar, Goodwe Solar
red59
Posts: 22
Joined: Wednesday 04 October 2017 13:29
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: question on api call through domoticz itself

Post by red59 »

I will try using domoticz internal docker IP adress.
I keep you informed
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest