Control lights via HTTP API on a Dali IOT Gateway

Hi
i am new on node red, absloute beginner, node red is set up on raspberry,
i have an iot gateway to control lights, so i wan´t to control it over node red
over the api commands i can controll it, who could this work in node red?
what i get from the api controll is:

curl -X 'POST' \
  'http://192.168.1.1/broadcast/control' \
  -H 'accept: */*' \
  -H 'Content-Type: application/json' \
  -d '{
 "switchable": false

}
'

does this help to create an flow, please help

Yes.

You should read the docs - the "node-red cookbook HTTP request" has examples you can work through to get a better understanding

Also, be sure to read the built in help (on the RH sidebar) for the HTTP Request node (it will explain much of what is inside the function I wrote for you)


Here is a demo to get you started....

image

The flow (use CTRL+I to import)...

[{"id":"2a513db0f9657f02","type":"inject","z":"cf45249a93d7b57a","name":"Click me","props":[],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","x":600,"y":260,"wires":[["2a513db0f9657f03"]]},{"id":"2a513db0f9657f03","type":"function","z":"cf45249a93d7b57a","name":"Prep headers, method, url","func":"//original curl:  \n//\n//curl -X 'POST'   'http://192.168.1.1/broadcast/control'   -H 'accept: */*'   -H 'Content-Type: application/json'   -d '{\"switchable\": false}'\n\nmsg.method = \"post\";\nmsg.url = \"http://192.168.1.1/broadcast/control\";\nmsg.payload = {\n    \"switchable\": false\n};\nmsg.headers = {\n    \"accept\": \"*/*\",\n    \"Content-Type\": \"application/json\"\n};\nmsg.cookies = null;\n\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":830,"y":260,"wires":[["2a513db0f9657f04"]]},{"id":"2a513db0f9657f04","type":"http request","z":"cf45249a93d7b57a","name":"","method":"use","ret":"txt","paytoqs":"ignore","url":"","tls":"","persist":false,"proxy":"","authType":"","x":710,"y":320,"wires":[["2a513db0f9657f05"]]},{"id":"2a513db0f9657f05","type":"debug","z":"cf45249a93d7b57a","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":930,"y":320,"wires":[]}]

NOTE: :point_up_2: untested (i dont have your device)

thank you very much, it works!!!!!

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.