-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathnode-red_direct-method_SetTargetTemperature_sample WO credentials.txt
1 lines (1 loc) · 2.86 KB
/
node-red_direct-method_SetTargetTemperature_sample WO credentials.txt
1
[{"id":"ab909cde.7dbe5","type":"tab","label":"Direct Method Demo","disabled":false,"info":""},{"id":"99948c9f.5081e","type":"mqtt in","z":"ab909cde.7dbe5","name":"","topic":"processdata","qos":"2","datatype":"auto","broker":"5fecdbc0.30b6b4","x":90,"y":100,"wires":[["f393ddc1.e8b0d"]]},{"id":"f393ddc1.e8b0d","type":"debug","z":"ab909cde.7dbe5","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","x":280,"y":100,"wires":[]},{"id":"39c0aea8.55d4d2","type":"http request","z":"ab909cde.7dbe5","name":"","method":"use","ret":"txt","paytoqs":false,"url":"","tls":"","persist":false,"proxy":"","authType":"","x":570,"y":180,"wires":[["d19cffb3.6bc85"]]},{"id":"79c4bb67.b59584","type":"function","z":"ab909cde.7dbe5","name":"Prepare POST Direct Method","func":"// msg.url = \"https://api.netfield.io/v1/devices/<device id>\";\nmsg.url = \"https://api.netfield.io/v1/devices/Device_ID/methods\";\nmsg.method = \"POST\";\nmsg.headers = {};\nmsg.headers['Content-Type'] = 'application/json';\nmsg.headers['Accept'] = 'application/json';\nmsg.headers['authorization'] = '';\n\nmsg.payload = {};\nmsg.payload['containerName'] = \"netfield-app-sample-multi-arch\";\nmsg.payload['methodName'] = \"SetTargetTemperature\";\nmsg.payload.methodPayload = {};\nmsg.payload.methodPayload['temperature'] = \"192\";\nmsg.payload.methodPayload['unit'] = \"centigrade\";\n\nreturn msg;","outputs":1,"noerr":0,"x":330,"y":180,"wires":[["39c0aea8.55d4d2","b700557.49412a8"]]},{"id":"71c6f264.13c87c","type":"inject","z":"ab909cde.7dbe5","name":"","topic":"","payload":"","payloadType":"date","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":100,"y":180,"wires":[["79c4bb67.b59584"]]},{"id":"d19cffb3.6bc85","type":"debug","z":"ab909cde.7dbe5","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","x":750,"y":180,"wires":[]},{"id":"b700557.49412a8","type":"debug","z":"ab909cde.7dbe5","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","x":550,"y":220,"wires":[]},{"id":"6207d972.7495e8","type":"comment","z":"ab909cde.7dbe5","name":"curl direct method","info":"curl -X POST --header 'Content-Type: application/json' --header 'Accept: application/json' --header 'authorization: ' -d '{\n \"containerName\": \"netfield-app-sample-multi-arch\",\n \"methodName\": \"SetTargetTemperature\",\n \"methodPayload\": {\n \"temperature\": \"180\",\n \"unit\": \"centigrade\"\n }\n}' 'https://api.netfield.io/v1/devices/Device_ID/methods'","x":110,"y":40,"wires":[]},{"id":"5fecdbc0.30b6b4","type":"mqtt-broker","z":"","name":"Local-Broker","broker":"mosquitto","port":"1883","clientid":"","usetls":false,"compatmode":false,"keepalive":"60","cleansession":true,"birthTopic":"","birthQos":"0","birthPayload":"","closeTopic":"","closeQos":"0","closePayload":"","willTopic":"","willQos":"0","willPayload":""}]