Skip to content

Commit 96ca64e

Browse files
authored
Create V2_HUE _Event_Sender.json
1 parent abad313 commit 96ca64e

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

V2_HUE _Event_Sender.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
[{"id":"faf916c374c80c7b","type":"tab","label":"V2 HUE Event Sender","disabled":true,"info":"","env":[]},{"id":"0114fef4bcb4653a","type":"group","z":"faf916c374c80c7b","name":"Step 1. HUE Bridge API v2 - Engine","style":{"label":true,"stroke":"#a4a4a4","fill":"#d1d1d1","color":"#7f7f7f","fill-opacity":"0.6"},"nodes":["e59fe819e55b1895","ebe9adc553c042e6","6240e138b9203444"],"x":818,"y":373,"w":1364,"h":374},{"id":"e59fe819e55b1895","type":"group","z":"faf916c374c80c7b","g":"0114fef4bcb4653a","name":"HUE Bridge API v2 - Receiver (Monitoring)","style":{"stroke":"#ffdf7f","fill":"#ffffbf","label":true,"color":"#3f3f3f","fill-opacity":"0.6"},"nodes":["2a1427b15cddf1ba","5f1d5b57bf6134f1","c99d4ac3b861d026","d4c748fd31c7f848"],"x":894,"y":399,"w":752,"h":122},{"id":"ebe9adc553c042e6","type":"group","z":"faf916c374c80c7b","g":"0114fef4bcb4653a","name":"HUE Bridge API v2 - Sender (Injecting) - DO NOT CHANGE","style":{"label":true,"stroke":"#ffbfbf","fill":"#ffbfbf","color":"#ff0000","fill-opacity":"0.6"},"nodes":["1ef946d510f54d06","0a8ddad56e62a0a9","089712bde547d4d9","135e05bf48ea57c6","bbd4895b3c4dd8b4","8e6c4490f0d449b4","792518a5af0e6bf2","d7ea0c7ba2f1a205","1daca79576e7480a","f0949d51d2f7089d","c58b158019d00c6d"],"x":844,"y":539,"w":1292,"h":182},{"id":"6240e138b9203444","type":"group","z":"faf916c374c80c7b","g":"0114fef4bcb4653a","name":"","style":{"stroke":"#ffdf7f","label":true,"fill":"#ffffbf","fill-opacity":"0.6"},"nodes":["397cdeadacad40d7","a6e649e3fbf84a64","50f039b39b97b285"],"x":1624,"y":399,"w":532,"h":122},{"id":"c58b158019d00c6d","type":"junction","z":"faf916c374c80c7b","g":"ebe9adc553c042e6","x":1490,"y":600,"wires":[[]]},{"id":"2a1427b15cddf1ba","type":"philipshue-events","z":"faf916c374c80c7b","g":"e59fe819e55b1895","bridge":"","x":1020,"y":480,"wires":[["5f1d5b57bf6134f1","c99d4ac3b861d026"]]},{"id":"5f1d5b57bf6134f1","type":"link out","z":"faf916c374c80c7b","g":"e59fe819e55b1895","name":"HUE Bridge API v2 Receiver","mode":"link","links":["40d3a5e96fd49e78","7dc9365442da8850","b073c2ca.c11b7","bf51feaf2b0d20f4","5e77d5fda10f43e1","65c6e23f0662100a","c8f51bf6ae9bd535","779066aaf87850aa","8a366c952ed297fd","b17f047ec6bb0898"],"x":1500,"y":480,"wires":[],"l":true},{"id":"c99d4ac3b861d026","type":"debug","z":"faf916c374c80c7b","g":"e59fe819e55b1895","name":"HUE monitor","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":1220,"y":460,"wires":[]},{"id":"d4c748fd31c7f848","type":"comment","z":"faf916c374c80c7b","g":"e59fe819e55b1895","name":"1a. Configure the node","info":"","x":1020,"y":440,"wires":[]},{"id":"1ef946d510f54d06","type":"function","z":"faf916c374c80c7b","g":"ebe9adc553c042e6","name":"HUE API V2","func":"// ACTION REQUIRED : You can copy the user key from the hue config node out of Huemagic\nlet user = flow.get('HUEBridge_Key');\nlet ip = flow.get('HUEBridge_IP');\n\n// DO NOT CHANGE UNDERNEATH\nif(msg.endpoint === undefined)\n msg.url = 'https://' + ip + '/clip/v2/resource';\nelse if(msg.topic === undefined)\n msg.url = 'https://' + ip + '/clip/v2/resource/' + msg.endpoint;\nelse\n msg.url = 'https://' + ip + '/clip/v2/resource/' + msg.endpoint + \"/\" + msg.topic;\n\nmsg.headers = {};\n\nmsg.headers['hue-application-key'] = user;\nmsg.headers['Content-Type'] = 'application/json';\nmsg.headers['Accept'] = 'application/json';\n\nif (msg.payload != undefined) {\n msg.headers['ContentLength'] = JSON.stringify(msg.payload).length;\n}\nif (msg.verb === undefined) {\n msg.method = \"get\";\n} else {\n msg.method = msg.verb;\n}\n\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":1180,"y":620,"wires":[["bbd4895b3c4dd8b4"]],"icon":"font-awesome/fa-send"},{"id":"0a8ddad56e62a0a9","type":"link in","z":"faf916c374c80c7b","g":"ebe9adc553c042e6","name":"HUE API v2 Sender","links":[],"x":1000,"y":620,"wires":[["1ef946d510f54d06"]],"l":true},{"id":"089712bde547d4d9","type":"http request","z":"faf916c374c80c7b","g":"ebe9adc553c042e6","name":"https HUE API V2","method":"use","ret":"obj","paytoqs":"ignore","url":"","tls":"4bc31af9bd03bbdc","persist":false,"proxy":"","insecureHTTPParser":false,"authType":"","senderr":false,"headers":[],"x":1600,"y":620,"wires":[["f0949d51d2f7089d"]]},{"id":"135e05bf48ea57c6","type":"link out","z":"faf916c374c80c7b","g":"ebe9adc553c042e6","name":"API Response OUT","mode":"return","links":[],"x":2020,"y":620,"wires":[],"l":true},{"id":"bbd4895b3c4dd8b4","type":"function","z":"faf916c374c80c7b","g":"ebe9adc553c042e6","name":"Take snapshot \\n - or - \\n Restore snapshot \\n (retry processing)","func":"// Take a copy of payload & headers as they are now to be able to re-use it on retry\nif (msg.retryInfo === undefined) {\n // msg was never processed befor, take a copy (snapshot) of key values to be re-applied in case of retry\n msg.retryInfo = {}\n msg.retryInfo.payload = msg.payload;\n msg.retryInfo.headers = msg.headers;\n msg.retryInfo.retryCount = 0;\n} else {\n // msg was processed at least once before, apply snapshot'd values back\n msg.payload = msg.retryInfo.payload;\n msg.headers = msg.retryInfo.headers;\n msg.statusCode = undefined;\n msg.retryInfo.retryCount++\n}\n\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":1400,"y":620,"wires":[["089712bde547d4d9"]],"outputLabels":["Blocked msg to send to repeater"],"icon":"font-awesome/fa-copy"},{"id":"8e6c4490f0d449b4","type":"delay","z":"faf916c374c80c7b","g":"ebe9adc553c042e6","name":"..wait a bit (0.25s - 0.5s)...","pauseType":"random","timeout":"1100","timeoutUnits":"milliseconds","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"250","randomLast":"500","randomUnits":"milliseconds","drop":false,"allowrate":false,"outputs":1,"x":1170,"y":680,"wires":[["bbd4895b3c4dd8b4"]]},{"id":"792518a5af0e6bf2","type":"debug","z":"faf916c374c80c7b","g":"ebe9adc553c042e6","name":"HUE API error","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":2000,"y":660,"wires":[]},{"id":"d7ea0c7ba2f1a205","type":"link in","z":"faf916c374c80c7b","g":"ebe9adc553c042e6","name":"Retry...","links":["1daca79576e7480a"],"x":920,"y":680,"wires":[["8e6c4490f0d449b4"]],"l":true},{"id":"1daca79576e7480a","type":"link out","z":"faf916c374c80c7b","g":"ebe9adc553c042e6","name":"Try to retry...","mode":"link","links":["d7ea0c7ba2f1a205"],"x":1980,"y":580,"wires":[],"l":true},{"id":"f0949d51d2f7089d","type":"switch","z":"faf916c374c80c7b","g":"ebe9adc553c042e6","name":"Catch Error 503","property":"statusCode","propertyType":"msg","rules":[{"t":"eq","v":"503","vt":"num"},{"t":"regex","v":"2\\d\\d","vt":"str","case":false},{"t":"else"}],"checkall":"true","repair":false,"outputs":3,"x":1780,"y":620,"wires":[["1daca79576e7480a"],["135e05bf48ea57c6"],["135e05bf48ea57c6","792518a5af0e6bf2"]],"outputLabels":["503 : too many calls sent","2xx : all OK","others (Error)"]},{"id":"397cdeadacad40d7","type":"comment","z":"faf916c374c80c7b","g":"6240e138b9203444","name":"1b. Update IP & Key info","info":"","x":2020,"y":440,"wires":[]},{"id":"a6e649e3fbf84a64","type":"inject","z":"faf916c374c80c7b","g":"6240e138b9203444","name":"push HUE config","props":[{"p":"payload"}],"repeat":"","crontab":"","once":true,"onceDelay":0.1,"topic":"","payload":"true","payloadType":"bool","x":1760,"y":480,"wires":[["50f039b39b97b285"]]},{"id":"50f039b39b97b285","type":"change","z":"faf916c374c80c7b","g":"6240e138b9203444","name":"HUE Bridge config","rules":[{"t":"set","p":"HUEBridge_IP","pt":"flow","to":"<<Enter HUE Bridge IP xxx.xxx.xxx.xxx>>","tot":"str"},{"t":"set","p":"HUEBridge_Key","pt":"flow","to":"<<Enter HUE Bridge key>>","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":1980,"y":480,"wires":[[]]},{"id":"fa8953761ae92450","type":"comment","z":"faf916c374c80c7b","name":"ATTENTION! READ FIRST \\n Step 1a : Configure the 'philipshue-events' node \\n Step 1b : Update the info (key (=secret) and IP address) in 'HUE Bridge config' node ","info":"ATTENTION! READ FIRST\n\nStep 1a : Configure the 'philipshue-events' node\nStep 1b : Update the info (key (=secret) and IP address) in 'HUE Bridge config' node","x":1110,"y":320,"wires":[]},{"id":"15d7fc4480b88005","type":"comment","z":"faf916c374c80c7b","name":"Your need to have the option to save your context to file to get this work","info":"","x":1680,"y":340,"wires":[]},{"id":"4bc31af9bd03bbdc","type":"tls-config","name":"","cert":"","key":"","ca":"","certname":"","keyname":"","caname":"","servername":"","verifyservercert":false}]

0 commit comments

Comments
 (0)