node-red voice and remote control

This flow enables node-red users to add remote control and voice control to their projects in a simple way.

It uses the tuya-cloud and only one switch device: because Smartlife app and the tuya-cloud are free, only you need to buy the device (USD 8-10), used as a dual-port register. Requires WiFi.

On your smartlife app you can create up to 100 buttons to activate your TRIGGERS (e.g. 1800, 1810... 2790), you can enable up to 20 other users and you get worldwide remote control over your node-red flows. Button names and icons are customizable in smartlife.

If you want, Googlehome can also add voice control to your TRIGGER.

This is a downsizing of tuyaDAEMON, created to have complete integration between node-red and tuya ecosystem, for projects involving IOT and smart devices, like the home automation. Watch it for more details on devices tested for this use.

[{"id":"66ca1554.e4c85c","type":"subflow","name":"red trigger","info":"Build a REDTRG msg for tuya_bridge device.\n\nREDTRG values are in range 2000-3000 (convention)\n\nNote: it uses dp 102 (for  [Switch MS-104]). \nChange the code if your tuya-bridge device uses a different dp.","category":"","in":[{"x":60,"y":80,"wires":[{"id":"f0932848.b39158"}]}],"out":[{"x":360,"y":80,"wires":[{"id":"f0932848.b39158","port":0}]}],"env":[{"name":"TRGnumber","type":"str","value":"800"}],"color":"#A6BBCF","inputLabels":["any msg"],"outputLabels":["continue"],"icon":"font-awesome/fa-arrow-right"},{"id":"f0932848.b39158","type":"function","z":"66ca1554.e4c85c","name":"send  X TRIGGER","func":"const triggerDP = 102;  // tuya-bridge countdown\n// normal use: no msg.payload.data.dps[triggerDP]\n// ack use:   msg.payload.data.dps[triggerDP] > 800\n if ((msg.payload.data != undefined) && (msg.payload.data.dps != undefined) && (msg.payload.data.dps[triggerDP] < 800))\n    return null;\nvar n = env.get(\"TRGnumber\");\nvar trig = {\n       \"payload\": {\n          \"dps\":triggerDP, \n          \"set\": parseInt(n)       \n          }\n}\n\nreturn trig ;","outputs":1,"noerr":0,"initialize":"// Code added here will be run once\n// whenever the node is deployed.\nflow.set(\"tsstart\", null);\nflow.set(\"pingstat\",{\n      total:1,\n      test: 0,\n      sum:0,\n      min: 100000000000,\n      max:0\n});\n","finalize":"","x":210,"y":80,"wires":[[]]},{"id":"38b9c7dd.edfd08","type":"tuya-smart-device","z":"b10f9b24.3fb858","deviceName":"tuya_bridge","deviceId":"here your id","deviceKey":"","x":270,"y":580,"wires":[["ecbcb8a7.3bfe28","6d46880b.ff93a8"]],"info":"**tuya_ms_104**   \n\n_tuya bridge for \"WiFi Smart Switch Module MS-104\"_\n\nAfter any command, this device sends (and this node captures) a 'status' message carring only the changed values.\n\nA command can be send by node-red, SmartLife app, Google home, Google voice: in any case this node captures the status message.\n\n_note:_\n If node-red changes the switch state, SmartLife is updated correctly, but Google Home not.\n \n_Input:_\nTo send a command via node-red. the payload structure can be:\n` multiple: true\n  data: object\n    1: true\n    102: 5`\n\n_nb:_\nset **Device Virtual ID** and **Device Key** to a tuya connected and working switch, model M-104 ( see [https://it.aliexpress.com/wholesale?SearchText=smart+switch+ms+104](https://it.aliexpress.com/wholesale?SearchText=smart+switch+ms+104))."},{"id":"ecbcb8a7.3bfe28","type":"switch","z":"b10f9b24.3fb858","name":"TRIGGER selector","property":"payload.data.dps[\"102\"]","propertyType":"msg","rules":[{"t":"eq","v":"1810","vt":"str"},{"t":"eq","v":"<more triggers>","vt":"str"}],"checkall":"false","repair":false,"outputs":2,"x":470,"y":580,"wires":[["3aff7447.b8e14c"],["16ac8a5a.d699e6"]],"info":"for my device\ndp = 102    // countdown"},{"id":"6d46880b.ff93a8","type":"subflow:66ca1554.e4c85c","z":"b10f9b24.3fb858","name":"send ACK","env":[{"name":"TRGnumber","value":"0","type":"str"}],"x":440,"y":520,"wires":[["38b9c7dd.edfd08"]]},{"id":"3aff7447.b8e14c","type":"link out","z":"b10f9b24.3fb858","name":"TRIGGER1810","links":[],"x":700,"y":560,"wires":[],"l":true},{"id":"16ac8a5a.d699e6","type":"link out","z":"b10f9b24.3fb858","name":"more triggers...","links":[],"x":700,"y":600,"wires":[],"l":true},{"id":"93a3390b.661618","type":"comment","z":"b10f9b24.3fb858","name":"tuyaTRIGGER for node-red users","info":"# tuyaTRIGGER for node-red users\n\n_This flow enables node-red users to add remote control and voice control to their projects in a simple way._\n\n![](./../../pics/tuyadaemon06.jpg)\n\nIt uses the `tuya cloud` and only `one switch` device: because _Smartlife_ app and the use of  _Tuya cloud_ are free, only you need to buy the device (USD 8-10), used as dual port register. Requires WiFi.\n\nOn your _smartlife_ app you can create up to 100 buttons to activate your TRIGGER (e.g. 1800, 1810... 1890), you can enable up to 20 other users and you get worldwide remote control over your node-red flows. Button names and icons are customizable.\n\nIf you want, Googlehome can also add _voice control_ to your TRIGGER.\n\nThis is a downsizing of [tuyaTRIGGER](https://github.com/msillano/tuyaDAEMON/tree/main/tuyaTRIGGER), created to _integrate node-red into the tuya ecosystem for home automation_. Watch it for more details on devices tested for this use.\n\n- Install in node-red the node (I use 'manage pallette'): [node-red-contrib-tuya-smart-device](https://github.com/vinodsr/node-red-contrib-tuya-smart-device)\n- To use this node, you need the 'id' and 'key' of your device: see [here](https://github.com/codetheweb/tuyapi/blob/master/docs/SETUP.md)\n-_note: based on switch used, you may must change the 'data point' used by the counter: change it in nodes 'send ACK' and 'trigger selector'._\n","x":310,"y":460,"wires":[]}]

Flow Info

Created 3 years, 5 months ago
Updated 3 years, 1 month ago
Rating: not yet rated

Owner

Actions

Rate:

Node Types

Core
  • comment (x1)
  • function (x1)
  • link out (x2)
  • switch (x1)
Other

Tags

  • remote
  • voice-control
  • iot
  • tuya-devices
  • home-automation
Copy this flow JSON to your clipboard and then import into Node-RED using the Import From > Clipboard (Ctrl-I) menu option