[Solved] Difficulties with Curl in a script  [Solved]

Easy to use, 100% Lua-based event scripting framework.

Moderator: leecollings

Post Reply
Diplo95
Posts: 15
Joined: Friday 26 July 2019 10:21
Target OS: Raspberry Pi / ODroid
Domoticz version: 2021.1
Location: Melun France
Contact:

[Solved] Difficulties with Curl in a script

Post by Diplo95 »

Hello,

I try to send a curl message to change a parameter to a device Xiaomi via a Conbee 2.

I've found the correct command :

Code: Select all

curl -H 'Content-Type: application/json' -X PUT -d '{"duration": 500}' http://192.168.1.1:80/api/A********/sensors/20/config
I know it's ok because I tested it on a command line directly on my Pi

So I tired to integrate it in a script :

Code: Select all

os.execute('curl -H \'Content-Type: application/json\' -X PUT -d \'{"duration": 500}\' http://192.168.1.1:80/api/A********/sensors/20/config ')
And then, no effect and I've got an error in my logs :

Code: Select all

Error: (CONBEE II) This device don't support action
Anyone can help me ? I'm stuck on this without any idea where to look at.
Thanks
Last edited by Diplo95 on Tuesday 27 October 2020 21:12, edited 1 time in total.
Domoticz v2021.1 on Raspberry Pi 3B+
Raspbian Buster
ConBee II + Xiaomi devices
Zwave
User avatar
waaren
Posts: 6028
Joined: Tuesday 03 January 2017 14:18
Target OS: Linux
Domoticz version: Beta
Location: Netherlands
Contact:

Re: Difficulties with Curl in a script

Post by waaren »

Diplo95 wrote: Saturday 24 October 2020 15:13 Anyone can help me ? I'm stuck on this without any idea where to look at.
Thanks
If you update to latest stable or latest beta you could use dzVents native openURL. In these versions PUT is supported.
Check this wiki chapter to see how
Debian buster, bullseye on RPI-4, Intel NUC.
dz Beta, Z-Wave, RFLink, RFXtrx433e, P1, Youless, Hue, Yeelight, Xiaomi, MQTT
==>> dzVents wiki
Diplo95
Posts: 15
Joined: Friday 26 July 2019 10:21
Target OS: Raspberry Pi / ODroid
Domoticz version: 2021.1
Location: Melun France
Contact:

Re: Difficulties with Curl in a script  [Solved]

Post by Diplo95 »

Thanks for the help.

I finally did it with this command :

Code: Select all

dz.openURL({
                url = 'http://192.168.1.**:80/api/Axxxxxxxxx/sensors/20/config',
                method = 'PUT',
                headers = { ['Content-Type']= 'application/json' },
		postData = { ['duration'] = '500'},
            })
If it can help
Domoticz v2021.1 on Raspberry Pi 3B+
Raspbian Buster
ConBee II + Xiaomi devices
Zwave
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest