Hi, using the rest platform I’ve been able to GET from a device its program data into a sensor in JSON format, so now I have this new sensor:
sensor.program_osbee= {“tmz”:56,“progs”:[{“config”:65666,“sts”:[1260,-1,-1,-1,-1],“nt”:3,“pt”:[153601,184322,184324],“name”:“‘Atardecer’”}]}
Now using the shell command to and depending on the state of another sensor I want to run the equivalent to running this URL:
http://device_ip/cp?dkey=XXXX&pid=0&config=65538&sts=[1260,-1,-1,-1,-1]&nt=3&pt=[153601,184322,184324]&name=‘Atardecer’
As you can see, taking aside the first part:
… all the rest are the variables inside the JSON, how should I translate this into a CURL command in order to make it work. I have tried with:
curl --header "Content-Type: application/json" --data {"dkey":"XXXX","pid"=1,"pt": [76802, 76804], "sts": [660, -1, -1, -1, -1], "name": "Mediodia", "nt": 2, "config": 32512} http://device_ip/cp'
But it didn’t work. Moreover, if somehow with your help I get to make it work, how can I get the JSON part from the sensor.program_osbee directly?? I mean to write something like:
curl --header "Content-Type: application/json" --data {"dkey":"XXXX",{sensor.program_osbee}} http://device_ip/cp'
Thanks for your help!!