|
[{"id":"3002f28d.52e31e","type":"tab","label":"*3_way_spit flow","disabled":false,"info":"This flow is used to call home assistant turn_on/off\nservices. \nIt will split the incoming message to three identical\nmessages, delete values so that each message contains\nonly the needed ones and guide the messages to \ndifferent paths, allowing the user to define the \nentity as switch/light/group.\n\nIt is made for users that are running\nHome Assistant and use Node-Red and Snips.AI as\nadd-ons.\n It can be easily switched for use as a flow\n on a satellite device that runs snips and node red \n and publish mqtt messages instead of triggering a \nhomeassistant turn_service. \n"},{"id":"7e14027e.84620c","type":"mqtt in","z":"3002f28d.52e31e","name":"mqtt listen (turn_on)","topic":"hermes/intent/nik_poz:lightturnon1","qos":"0","datatype":"auto","broker":"e92d1794.a4b0d8","x":95,"y":297,"wires":[["db688e4e.3f60e"]],"info":"This node listens for the lightturnon1 intent.\n(as found in the app.)\nYou must reconfigure this node:\n\n1)Edit server configuration and replace \nusername and password with yours\n\n2)You will also have to replace the topic with the\none produced by your assistant.\n"},{"id":"ed9321c6.b58db","type":"mqtt in","z":"3002f28d.52e31e","name":"mqtt listen (turn_off)","topic":"hermes/intent/nik_poz:lightturnoff1","qos":"0","datatype":"auto","broker":"4d9f5ea0.f1423","x":95,"y":336,"wires":[["db688e4e.3f60e"]],"info":"This node listens for the lightturnoff1 intent.\n(as found in the app.)\nYou must reconfigure this node:\n\n1)Edit server configuration and replace \nusername and password with yours\n\n2)You will also have to replace the topic with the\none produced by your assistant.\n"},{"id":"11f6b505.d1c7cb","type":"debug","z":"3002f28d.52e31e","name":"","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","x":1066,"y":311,"wires":[]},{"id":"db688e4e.3f60e","type":"yaml","z":"3002f28d.52e31e","property":"payload","name":"","x":271,"y":316,"wires":[["a950b8c7.f47d28","fc14b51c.5d6088","2844fc55.b02ba4"]]},{"id":"a950b8c7.f47d28","type":"switch","z":"3002f28d.52e31e","name":"Path for msg1","property":"payload","propertyType":"msg","rules":[{"t":"nempty"}],"checkall":"true","repair":false,"outputs":1,"x":511,"y":271,"wires":[["3bc2b724.b093a8","5d2a7080.c49b3"]],"info":"In this nodes we just divide the message into 3 \nidentical messages.\n\nNothing to configure in this node"},{"id":"fc14b51c.5d6088","type":"switch","z":"3002f28d.52e31e","name":"Path for msg2","property":"payload","propertyType":"msg","rules":[{"t":"nempty"}],"checkall":"true","repair":false,"outputs":1,"x":507,"y":310,"wires":[["464b113e.d4242","313d5e8e.bf7f02"]],"info":"In this nodes we just divide the message into 3 \nidentical messages.\n\nNothing to configure in this node"},{"id":"56207c07.729604","type":"debug","z":"3002f28d.52e31e","name":"","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","x":1070,"y":272,"wires":[]},{"id":"3bc2b724.b093a8","type":"change","z":"3002f28d.52e31e","name":"Delete values not used in msg1","rules":[{"t":"set","p":"topic","pt":"msg","to":"1","tot":"str"},{"t":"delete","p":"payload.asrTokens","pt":"msg"},{"t":"delete","p":"payload.slots[1]","pt":"msg"},{"t":"delete","p":"payload.slots[2]","pt":"msg"},{"t":"delete","p":"payload.input","pt":"msg"},{"t":"delete","p":"payload.siteId","pt":"msg"},{"t":"delete","p":"payload.customData","pt":"msg"},{"t":"delete","p":"payload.asrConfidence","pt":"msg"},{"t":"delete","p":"payload.sessionId","pt":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":863,"y":271,"wires":[["56207c07.729604","502d4a3a.0c5004"]],"info":" This node is used to set a temporary msg.topic\nfor each of the messages. \n\n The extra values are deleted in this node, so the \noutcoming messages will ONLY contain the data needed\nfor each message. Bare that in mind if \nyou find your self intrested in adding extra path.\nAll messages will be processed\nin the same way from now on so keeping the messages\nclear from extra values is crusial.\n\nNothing to configure in this node,\nunless extra path is added.\n\n"},{"id":"9c8dede3.41928","type":"debug","z":"3002f28d.52e31e","name":"","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","x":763,"y":728,"wires":[]},{"id":"6c7a1f96.fdb38","type":"change","z":"3002f28d.52e31e","name":"move values to msg.payload","rules":[{"t":"delete","p":"payload.sessionId","pt":"msg"},{"t":"delete","p":"payload.customData","pt":"msg"},{"t":"delete","p":"payload.siteId","pt":"msg"},{"t":"delete","p":"payload.input","pt":"msg"},{"t":"delete","p":"payload.asrTokens","pt":"msg"},{"t":"delete","p":"payload.asrConfidence","pt":"msg"},{"t":"delete","p":"payload.intent","pt":"msg"},{"t":"delete","p":"payload.slots","pt":"msg"},{"t":"delete","p":"qos","pt":"msg"},{"t":"delete","p":"retain","pt":"msg"},{"t":"delete","p":"_topic","pt":"msg"},{"t":"set","p":"payload","pt":"msg","to":"topic","tot":"msg"},{"t":"set","p":"topic","pt":"msg","to":"","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":522,"y":518,"wires":[["f9934a12.cfecb8","52058f39.0a5a3"]],"info":"In this node some more not needed values are deleted.\n\nIn this node is still contains asr confidence values\nthat will be implimentented in the future.\n\nThis will add to the flow a configurable node that \nwill allow user to delete the message if asr confidence\nis under the given price.\n\n"},{"id":"f9934a12.cfecb8","type":"switch","z":"3002f28d.52e31e","name":"seperation","property":"payload.data.entity_id","propertyType":"msg","rules":[{"t":"eq","v":"bench_right","vt":"str"},{"t":"eq","v":"bench_left","vt":"str"},{"t":"eq","v":"kitchen_main_light","vt":"str"},{"t":"eq","v":"tv_porch_1","vt":"str"},{"t":"eq","v":"tv_porch_2","vt":"str"},{"t":"eq","v":"living_room_main","vt":"str"},{"t":"eq","v":"living_room_main1","vt":"str"},{"t":"eq","v":"hallway","vt":"str"},{"t":"eq","v":"toilet_light","vt":"str"},{"t":"eq","v":"toilet_fan","vt":"str"},{"t":"eq","v":"secret_led_main","vt":"str"},{"t":"eq","v":"door_secret","vt":"str"},{"t":"eq","v":"node_clone","vt":"str"},{"t":"eq","v":"secret_led_two","vt":"str"},{"t":"eq","v":"kitchen_secret","vt":"str"},{"t":"eq","v":"secret_main","vt":"str"},{"t":"eq","v":"tv_secret_lights","vt":"str"},{"t":"eq","v":"tv_porch_light_1","vt":"str"},{"t":"eq","v":"tv_porch_light_2","vt":"str"},{"t":"eq","v":"porch","vt":"str"},{"t":"eq","v":"living_room_main_1","vt":"str"},{"t":"eq","v":"bench_s_light","vt":"str"},{"t":"eq","v":"benchs_left_light","vt":"str"},{"t":"eq","v":"kitchen_bench_left_light","vt":"str"},{"t":"eq","v":"kitchen_bench_right_light","vt":"str"},{"t":"eq","v":"hallway_light","vt":"str"},{"t":"eq","v":"living_lights","vt":"str"},{"t":"eq","v":"living","vt":"str"},{"t":"eq","v":"kitchen_lights","vt":"str"},{"t":"eq","v":"kitchen","vt":"str"},{"t":"eq","v":"living_room_lights","vt":"str"},{"t":"eq","v":"ground_floor_lights","vt":"str"},{"t":"eq","v":"tv_porch_light","vt":"str"},{"t":"eq","v":"porch_light","vt":"str"},{"t":"eq","v":"secret_lights","vt":"str"},{"t":"eq","v":"benchlight","vt":"str"}],"checkall":"true","repair":false,"outputs":36,"x":167,"y":898,"wires":[["32563350.4c01cc"],["32563350.4c01cc"],["32563350.4c01cc"],["32563350.4c01cc"],["32563350.4c01cc"],["32563350.4c01cc"],["32563350.4c01cc"],["32563350.4c01cc"],["32563350.4c01cc"],["32563350.4c01cc"],["1e86ddf9.dc84b2"],["1e86ddf9.dc84b2"],["1e86ddf9.dc84b2"],["1e86ddf9.dc84b2"],["1e86ddf9.dc84b2"],["1e86ddf9.dc84b2"],["d0ad1a36.ff5fe8"],["d0ad1a36.ff5fe8"],["d0ad1a36.ff5fe8"],["d0ad1a36.ff5fe8"],["d0ad1a36.ff5fe8"],["d0ad1a36.ff5fe8"],["d0ad1a36.ff5fe8"],["d0ad1a36.ff5fe8"],["d0ad1a36.ff5fe8"],["d0ad1a36.ff5fe8"],["d0ad1a36.ff5fe8"],["d0ad1a36.ff5fe8"],["d0ad1a36.ff5fe8"],["d0ad1a36.ff5fe8"],["d0ad1a36.ff5fe8"],["d0ad1a36.ff5fe8"],["d0ad1a36.ff5fe8"],["d0ad1a36.ff5fe8"],["d0ad1a36.ff5fe8"],["d0ad1a36.ff5fe8"]],"info":"\r\nIn this node we track our slot values. \r\nA path is created for each one.\r\nThis gives us the ability to choose the domain\r\nwe will forward the message to, for further processing.\r\n\r\nReconfigure this node\r\n\r\nIn this node you will have to manually enter your\r\nentities names as found in the developers tools/states,\r\nin your home assistant.\r\nNOTE:you should add them as names without domain, replacing any \" \" \r\nwith \"_\".\r\nThe domain will be added in the next node by linking\r\nthe entity with the desired domain function node.\r\n"},{"id":"32563350.4c01cc","type":"function","z":"3002f28d.52e31e","name":"\"switch.\" addition","func":"msg.payload.data.entity_id = ('switch.') + msg.payload.data.entity_id;\nreturn msg;","outputs":1,"noerr":0,"x":607,"y":728,"wires":[["9c8dede3.41928","81a37136.0296e"]],"info":"This function node will add \"switch.\" \nin front of the entity name.\nWire this node with the outputs that will call\nswitch turn_on/off services.\n\nNothing to configure in this node"},{"id":"d0ad1a36.ff5fe8","type":"function","z":"3002f28d.52e31e","name":"\"group.\"addition","func":"msg.payload.data.entity_id = ('group.') + msg.payload.data.entity_id;\nreturn msg;","outputs":1,"noerr":0,"x":619,"y":793,"wires":[["81a37136.0296e","7b26a40e.d2e51c"]],"info":"This function node will add \"group.\" \nin front of the entity name.\nWire this node with the outputs that will call\ngroup turn_on/off services.\n\nNothing to configure in this node"},{"id":"1e86ddf9.dc84b2","type":"function","z":"3002f28d.52e31e","name":"\"light.\" addition","func":"msg.payload.data.entity_id = ('light.') + msg.payload.data.entity_id;\nreturn msg;","outputs":1,"noerr":0,"x":612,"y":840,"wires":[["81a37136.0296e","ea6823b4.1935d"]],"info":"This function node will add \"light.\" \nin front of the entity name.\nWire this node with the outputs that will call\nlight turn_on/off services.\n\nNothing to configure in this node"},{"id":"52058f39.0a5a3","type":"debug","z":"3002f28d.52e31e","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","x":731,"y":518,"wires":[]},{"id":"502d4a3a.0c5004","type":"change","z":"3002f28d.52e31e","name":"value extraction","rules":[{"t":"set","p":"topic","pt":"msg","to":"{ \"domain\": \"homeassistant\", \"service\": \"turn_on\", \"data\": { \"entity_id\": \"light.secret_led_two\" }}","tot":"json"},{"t":"change","p":"payload.intent.intentName","pt":"msg","from":"nik_poz:lightturnon1","fromt":"str","to":"turn_on","tot":"str"},{"t":"change","p":"payload.intent.intentName","pt":"msg","from":"nik_poz:lightturnoff1","fromt":"str","to":"turn_off","tot":"str"},{"t":"change","p":"payload.slots[0].value.value","pt":"msg","from":" ","fromt":"str","to":"_","tot":"str"},{"t":"change","p":"topic.service","pt":"msg","from":"topic.service","fromt":"msg","to":"payload.intent.intentName","tot":"msg"},{"t":"change","p":"topic.data.entity_id","pt":"msg","from":"topic.data.entity_id","fromt":"msg","to":"payload.slots[0].value.value","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":114,"y":519,"wires":[["6c7a1f96.fdb38","f6664a55.e7e4b8"]],"info":"In this node we collect the needed values and alter \nthem so we can produce a turn_on/off service\naccordingly.\n\nWe are also setting up on msg.topic the message\nformat that we will use to trigger a \nhomeassistant turn_on service.\n All content of the msg.topic will become \n msg.payload later on in the process.\n\nThis node needs to be changed.\nSearch in Prorerties tab and replace:\n\n1) nik_poz:lightturnon1 with the intent name produced \nby your assistant\n\n2)nik_poz:lightturnoff1 with the intent name produced \nby your assistant"},{"id":"2844fc55.b02ba4","type":"switch","z":"3002f28d.52e31e","name":"Path for msg3","property":"payload","propertyType":"msg","rules":[{"t":"nempty"}],"checkall":"true","repair":false,"outputs":1,"x":508,"y":353,"wires":[["5b718de2.aa5524","73213969.817ae8"]],"info":"In this nodes we just divide the message into 3 \nidentical messages.\n\nNothing to configure in this node"},{"id":"8237c7f5.3a6378","type":"debug","z":"3002f28d.52e31e","name":"","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","x":1065,"y":355,"wires":[]},{"id":"5b718de2.aa5524","type":"debug","z":"3002f28d.52e31e","name":"","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","x":652,"y":352,"wires":[]},{"id":"464b113e.d4242","type":"debug","z":"3002f28d.52e31e","name":"","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","x":652,"y":310,"wires":[]},{"id":"5d2a7080.c49b3","type":"debug","z":"3002f28d.52e31e","name":"","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","x":653,"y":270,"wires":[]},{"id":"81a37136.0296e","type":"api-call-service","z":"3002f28d.52e31e","name":"call service","server":"4bbac141.a7708","service_domain":"homeassistant","service":"","data":"","mergecontext":"","output_location":"","output_location_type":"none","x":962,"y":841,"wires":[[]],"info":"This node calls the service according\nto the values collected\n\nMake sure you have added your server and entities \nare updated.\n\nNothing else to configure in this node"},{"id":"f6664a55.e7e4b8","type":"debug","z":"3002f28d.52e31e","name":"","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","x":291,"y":519,"wires":[]},{"id":"313d5e8e.bf7f02","type":"change","z":"3002f28d.52e31e","name":"Delete values not used in msg2","rules":[{"t":"set","p":"topic","pt":"msg","to":"2","tot":"str"},{"t":"delete","p":"payload.asrTokens","pt":"msg"},{"t":"delete","p":"payload.slots[0]","pt":"msg"},{"t":"delete","p":"payload.slots[2]","pt":"msg"},{"t":"delete","p":"payload.input","pt":"msg"},{"t":"delete","p":"payload.siteId","pt":"msg"},{"t":"delete","p":"payload.customData","pt":"msg"},{"t":"delete","p":"payload.asrConfidence","pt":"msg"},{"t":"delete","p":"payload.sessionId","pt":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":862,"y":311,"wires":[["502d4a3a.0c5004","11f6b505.d1c7cb"]],"info":" This node is used to set a temporary msg.topic\nfor each of the messages. \n\n The extra values are deleted in this node, so the \noutcoming messages will ONLY contain the data needed\nfor each message. Bare that in mind if \nyou find your self intrested in adding extra path.\nAll messages will be processed\nin the same way from now on so keeping the messages\nclear from extra values is crusial.\n\nNothing to configure in this node,\nunless extra path is added.\n\n"},{"id":"73213969.817ae8","type":"change","z":"3002f28d.52e31e","name":"Delete values not used in msg3","rules":[{"t":"set","p":"topic","pt":"msg","to":"3","tot":"str"},{"t":"delete","p":"payload.asrTokens","pt":"msg"},{"t":"delete","p":"payload.slots[1]","pt":"msg"},{"t":"delete","p":"payload.slots[0]","pt":"msg"},{"t":"delete","p":"payload.input","pt":"msg"},{"t":"delete","p":"payload.siteId","pt":"msg"},{"t":"delete","p":"payload.customData","pt":"msg"},{"t":"delete","p":"payload.asrConfidence","pt":"msg"},{"t":"delete","p":"payload.sessionId","pt":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":859,"y":352,"wires":[["502d4a3a.0c5004","8237c7f5.3a6378"]],"info":" This node is used to set a temporary msg.topic\nfor each of the messages. \n\n The extra values are deleted in this node, so the \noutcoming messages will ONLY contain the data needed\nfor each message. Bare that in mind if \nyou find your self intrested in adding extra path.\nAll messages will be processed\nin the same way from now on so keeping the messages\nclear from extra values is crusial.\n\nNothing to configure in this node,\nunless extra path is added.\n\n"},{"id":"ea6823b4.1935d","type":"debug","z":"3002f28d.52e31e","name":"","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","x":763,"y":841,"wires":[]},{"id":"7b26a40e.d2e51c","type":"debug","z":"3002f28d.52e31e","name":"","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","x":770,"y":792,"wires":[]},{"id":"8fa26cf0.66f03","type":"comment","z":"3002f28d.52e31e","name":"READ ME","info":"The below nodes needs to be re-configured\nRead the Description tab in each ofthe nodes to\nhelp you with your configuration.","x":99,"y":270,"wires":[]},{"id":"3230645f.d18c9c","type":"comment","z":"3002f28d.52e31e","name":"THE STEPS","info":" Steps\n1)Track the intent.\n2)Convert the string into a javascript object.\n3)Triple the message.\n4)Set temporary topics for each message and delete extra\n values.\n5)Start value extraction and rebuilt process \n for each message.\n6)Move values in msg.topic.\n7)Make paths for further message processing. \n8)Wire based connection to add \n\"light.\" or \"switch.\" or \"group.\" \n9)Trigger a homeassistant turn_on service.","x":182,"y":115,"wires":[]},{"id":"2b15825c.fd35ce","type":"comment","z":"3002f28d.52e31e","name":"TRIPLE ENTITY TURN_ON/OFF ","info":" A flow that handles dimming commands.\nUp to two entities can be dimmed in a single command.\nIt uses just two slots in snips assistant\n(dim value and entity_id).\nIt will function if the command follows the pattern:\n Fisrt entity and the desired color, followed\nby the second entity and the desired color.\n\n Make sure the entity_id slot in snips assistant\ncontains the names of your home assistant light entities,\nas found in States tab.\n Synonyms will call the actual name of the slot value.\nSo slot value must match. \n\n\n ","x":135,"y":32,"wires":[]},{"id":"8444473b.3f16f8","type":"comment","z":"3002f28d.52e31e","name":"Read the comments","info":" Read the comments to help you understand the steps\ninvolved.\n In each node, under Description tab, you will find \na brief node explanation.","x":164,"y":73,"wires":[]},{"id":"c28d6a5c.cc7c98","type":"comment","z":"3002f28d.52e31e","name":"READ ME","info":"The below node needs to be re-configured.\nRead the Description tab in each ofthe nodes to\nhelp you with your configuration.","x":115,"y":498,"wires":[]},{"id":"87e4ce74.e24bf","type":"comment","z":"3002f28d.52e31e","name":"READ ME","info":"The below nodes needs to be re-configured\nRead the Description tab in each ofthe nodes to\nhelp you with your configuration.","x":162,"y":627,"wires":[]},{"id":"e92d1794.a4b0d8","type":"mqtt-broker","z":"","name":"","broker":"127.0.0.1","port":"1883","clientid":"","usetls":false,"compatmode":true,"keepalive":"60","cleansession":true,"birthTopic":"","birthQos":"0","birthPayload":"","closeTopic":"","closeQos":"0","closePayload":"","willTopic":"","willQos":"0","willPayload":""},{"id":"4d9f5ea0.f1423","type":"mqtt-broker","z":"","name":"","broker":"127.0.0.1","port":"1883","clientid":"","usetls":false,"compatmode":true,"keepalive":"60","cleansession":true,"birthTopic":"","birthQos":"0","birthPayload":"","closeTopic":"","closeQos":"0","closePayload":"","willTopic":"","willQos":"0","willPayload":""},{"id":"4bbac141.a7708","type":"server","z":"","name":"Home Assistant","legacy":false,"hassio":true,"rejectUnauthorizedCerts":true,"ha_boolean":"y|yes|true|on|home|open","connectionDelay":false}] |