Dialogic Systems GmbH & Co. KG
Page History
...
Sonos Türgong > hc-sipphone
Quellen: Packete > node-red-contrib-sonos-plus 2.1.7
| Code Block | ||||
|---|---|---|---|---|
| ||||
[{"id":"9e605caf.04fea","type":"tab","label":"Sonos Türgong","disabled":false,"info":""},{"id":"a298395a.5ba178","type":"sonos-control-player","z":"9e605caf.04fea","confignode":"d0901383.4f256","name":"","x":880,"y":300,"wires":[["e5e66f2f.f7134"]]},{"id":"e5e66f2f.f7134","type":"debug","z":"9e605caf.04fea","name":"Control Player","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","x":1060,"y":300,"wires":[]},{"id":"40dea410.00c54c","type":"inject","z":"9e605caf.04fea","name":"Test stop","topic":"","payload":"<State>Connected</State>","payloadType":"str","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":140,"y":300,"wires":[["4c7907cb.02d098"]]},{"id":"3c224b32.f982e4","type":"inject","z":"9e605caf.04fea","name":"Test start (play)","topic":"","payload":"<State>Incoming</State>","payloadType":"str","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":160,"y":240,"wires":[["4c7907cb.02d098"]]},{"id":"5baa084f.5207f8","type":"change","z":"9e605caf.04fea","name":"play_notification","rules":[{"t":"set","p":"payload","pt":"msg","to":"play_notification","tot":"str"},{"t":"set","p":"topic","pt":"msg","to":"http://192.168.1.168:1880/tuergong.wav","tot":"str"},{"t":"set","p":"volume","pt":"msg","to":"20","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":460,"y":340,"wires":[["f1998e9c.903d7"]]},{"id":"b32a91a9.92977","type":"http in","z":"9e605caf.04fea","name":"","url":"/tuergong.wav","method":"get","upload":false,"swaggerDoc":"","x":170,"y":80,"wires":[["5fe7e56f.6e29dc"]]},{"id":"5fe7e56f.6e29dc","type":"file in","z":"9e605caf.04fea","name":"","filename":"D:/Musik/tuergong2.wav","format":"","x":450,"y":80,"wires":[["ce7cfa45.9574e8"]]},{"id":"ce7cfa45.9574e8","type":"http response","z":"9e605caf.04fea","name":"http://192.168.1.168:1880/tuergong.wav","statusCode":"","headers":{"content-type":"audio/mpeg"},"x":800,"y":80,"wires":[]},{"id":"67220dee.0b9264","type":"udp in","z":"9e605caf.04fea","name":"","iface":"","port":"55002","ipv":"udp4","multicast":"false","group":"","datatype":"utf8","x":140,"y":180,"wires":[["d8b1a7e7.fcbf48","4c7907cb.02d098"]]},{"id":"4c7907cb.02d098","type":"function","z":"9e605caf.04fea","name":"Read SipphoneState","func":" const compareLastValue = (str) => {\n let lastValue = context.get('lastValue');\n if (lastValue == str) return true;\n\n return false;\n};\n\n// prüfe ob string im payload vorhanden\nconst existStr = (str) => {\n if (msg.payload.search(str) > -1) return true;\n \n return false;\n};\n\n// neue Messages erstellen\nconst setMessage = (str) => {\n let newMsg = { payload: str };\n return [newMsg,null]; // output 1\n};\n\n\nif (existStr(\"Incoming\") && !compareLastValue(\"Incoming\")) {\n context.set('lastValue',\"Incoming\");\n return [null,setMessage(\"play\")];\n}\n\nif (!existStr(\"Incoming\")){\n // prüfe ob letzter Wert Incoming war\n if (compareLastValue(\"Incoming\")) \n {\n context.set('lastValue',\"NotIncoming\");\n return [setMessage(\"stop\"),null];\n }\n} \nreturn;","outputs":2,"noerr":0,"x":440,"y":240,"wires":[["f1998e9c.903d7"],["5baa084f.5207f8","879e0e58.6cb4b"]]},{"id":"d8b1a7e7.fcbf48","type":"udp out","z":"9e605caf.04fea","name":"","addr":"127.0.0.1","iface":"","port":"55001","ipv":"udp4","outport":"","base64":false,"multicast":"false","x":440,"y":180,"wires":[]},{"id":"879e0e58.6cb4b","type":"trigger","z":"9e605caf.04fea","op1":"","op2":"stop","op1type":"nul","op2type":"str","duration":"10","extend":false,"units":"s","reset":"","bytopic":"all","name":"","x":470,"y":300,"wires":[["f1998e9c.903d7"]]},{"id":"f1998e9c.903d7","type":"function","z":"9e605caf.04fea","name":"compare_msg","func":"const compareLastValue = (str) => {\n let lastValue = context.get('lastValue');\n if (lastValue == str) return true;\n context.set('lastValue',str);\n return false;\n};\n\nif (compareLastValue(msg.payload)) return;\n \nreturn msg;","outputs":1,"noerr":0,"x":700,"y":300,"wires":[["a298395a.5ba178"]]},{"id":"5d5965da.4a1bbc","type":"comment","z":"9e605caf.04fea","name":"Sonos lädt Musik nur von http (Node-Red umstellen)","info":"","x":250,"y":40,"wires":[]},{"id":"bc5f901f.5b92f","type":"comment","z":"9e605caf.04fea","name":"Sipphone Port umstellen, play_notificationn anpassen und evtl Auslöser","info":"","x":310,"y":140,"wires":[]},{"id":"d0901383.4f256","type":"sonos-config","z":"","name":"Ausstellung","serialnum":"00-0E-58-7C-35-64:8","ipaddress":"192.168.1.155"}] |
...
Overview
Content Tools
