Page 1 of 1

[Solved] Difficulties with Curl in a script

Posted: Saturday 24 October 2020 15:13
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

Re: Difficulties with Curl in a script

Posted: Saturday 24 October 2020 16:00
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

Re: Difficulties with Curl in a script  [Solved]

Posted: Tuesday 27 October 2020 21:07
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