SonOff ZbBridge Tasmota Zigbee

Collection of flows for using the Tasmota Zigbee firmware with Node-RED easily.

No need to change configurations.

Possibility to set a delta for adjusting the pressure values.

Ready to use, just import it and restart the Tasmota ZigBee bridge to recognize it.

You have to save some info in the persistent storage, https://nodered.org/docs/user-guide/context.

[{"id":"6152dadc.c29704","type":"tab","label":"ZBBridge Setup","disabled":false,"info":"https://tasmota.github.io/docs/Lights/\nhttps://tasmota.github.io/docs/Commands/#light\nhttps://tasmota.github.io/docs/Zigbee/\n\nCT: [150-500]\nbrightness: [0-100]\nColor: [0-65534,0-65534]\n\nXY <-> RGB\nhttps://gist.github.com/popcorn245/30afa0f98eea1c2fd34d\n\nhttps://discourse.nodered.org/t/tradfri-zbbridge-zigbee-tasmota-commands-in-node-red/32969\n\nhttps://discourse.nodered.org/t/sonoff-zigbee-tasmota-and-node-red/46036\n\nhttps://discourse.nodered.org/t/parsing-nested-object-with-wildcard/45802\n\nhttps://www.youtube.com/watch?v=SDynPbCGvS0\n\nhttps://github.com/arendst/Tasmota/releases\n\nhttp://www.diegm.uniud.it/bernardini/Laboratorio_Didattico/2016-2017/2017-Telecomando/ir-protocols.html\n\nhttps://www.sbprojects.net/knowledge/ir/rc6.php\n"},{"id":"688243a2.94408c","type":"function","z":"6152dadc.c29704","name":"Tasmota 2 Node-RED","func":"if (typeof msg.payload === 'string') {\n    try {\n        msg.payload = JSON.parse(msg.payload);\n    } catch (e) {}\n}\nconst delta_pressione = flow.get(\"delta_pressione\") ||  {};\nlet msg2 = null;\nlet msg3 = null;\nif (typeof msg.payload.ZbReceived === \"object\") {\n    Object.keys(msg.payload.ZbReceived).forEach(device_id => {\n        let device = msg.payload.ZbReceived[device_id];\n        if (typeof device.LinkQuality === \"number\") {\n            device.linkquality = device.LinkQuality;\n        }\n        if (typeof device.BatteryVoltage === \"number\") {\n            device.voltage = device.BatteryVoltage;\n        }\n        if (typeof device.BatteryPercentage === \"number\") {\n            device.battery = device.BatteryPercentage;\n        }\n        if (typeof device.Power === \"number\") {\n            device.on = device.Power === 1;\n        }\n        if (typeof device.Dimmer === \"number\") {\n            device.brightness = Math.round(1 + (device.Dimmer -1) * 99 / 253);\n        }\n        if (typeof device.CT === \"number\") {\n            let temperature = 2000 + 7000 * (1 - (device.CT - 153)/347);\n            device.color_temp = Math.round(temperature);\n            // device.color_temp = device.CT;\n        }\n        if (typeof device.Temperature === \"number\") {\n            device.temperature = device.Temperature;\n        }\n        if (typeof device.Pressure === \"number\") {\n            device.Pressure = device.Pressure + (delta_pressione[device.Name] || 0);\n            device.pressure = device.Pressure;\n        }\n        if (typeof device.Humidity === \"number\") {\n            device.humidity = device.Humidity;\n        }\n        msg2 = {\n           topic: device.Name,\n           payload: device\n        };\n    });\n    /*\n    var name = msg.payload.ZbReceived[Object.keys(msg.payload.ZbReceived)[0]].Name;\n    var topic = Object.keys(msg.payload.ZbReceived[name])[2]\n    msg.payload= msg.payload.ZbReceived[name][topic];\n    topic = \"tele/\" + name +\"/\" + topic;\n    msg.topic = topic;\n    return msg;\n    */\n} else if (typeof msg.payload.ZbState === \"object\") {\n    if (typeof msg.payload.ZbState.Status === \"number\") {\n        // node.error(\"Status \" + msg.payload.ZbState.Status);\n        if (msg.payload.ZbState.Status === 20) {\n            // Pairing mode disabled\n            msg3 = {payload: 0};\n        } else if (msg.payload.ZbState.Status === 21) {\n            // Pairing mode enabled\n            msg3 = {payload: 1};\n        }\n    }\n}\n\nreturn [msg, msg2, msg3];","outputs":3,"noerr":0,"initialize":"","finalize":"","libs":[],"x":280,"y":300,"wires":[["5f0d189f.550548"],["cac94437.a12c98","f47a516f.6a6a9"],["6f953690.62b1f8","195076e.ce2dd89","e0a63eb4.67dfc"]],"info":"Power: 0/1\nCT: [153-500]\nDimmer: [0-254]\nColor: [0-65534,0-65534]\n\non: boolean\ncolor.hex: RRGGBB\nbrightness: [0-100]\ncolor_temp: [2000-9000]\n"},{"id":"9e26d757.2d4da8","type":"mqtt in","z":"6152dadc.c29704","name":"","topic":"tele/#","qos":"2","datatype":"auto","broker":"","nl":false,"rap":false,"inputs":0,"x":70,"y":300,"wires":[["688243a2.94408c"]]},{"id":"5f0d189f.550548","type":"debug","z":"6152dadc.c29704","name":"Tasmota tele","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":530,"y":280,"wires":[]},{"id":"cac94437.a12c98","type":"debug","z":"6152dadc.c29704","name":"Tasmota tele 2","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":540,"y":320,"wires":[]},{"id":"26c49366.da459c","type":"mqtt in","z":"6152dadc.c29704","name":"","topic":"+/+/+/set","qos":"0","datatype":"json","broker":"","nl":false,"rap":false,"inputs":0,"x":80,"y":400,"wires":[["b86ed010.7f367"]]},{"id":"a72b5dff.2582c","type":"mqtt in","z":"6152dadc.c29704","name":"","topic":"stat/#","qos":"2","datatype":"json","broker":"","nl":false,"rap":false,"inputs":0,"x":70,"y":520,"wires":[["020a859ed383b029","9d2ae1ed.7b8fd","b454901d065ba6d6"]]},{"id":"9d2ae1ed.7b8fd","type":"debug","z":"6152dadc.c29704","name":"Tasmota stat","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":270,"y":560,"wires":[]},{"id":"6c9d6b5e.74ceb4","type":"mqtt in","z":"6152dadc.c29704","name":"","topic":"cmnd/#","qos":"2","datatype":"auto","broker":"","nl":false,"rap":false,"inputs":0,"x":70,"y":240,"wires":[["3416b10d.dc18de"]]},{"id":"3eb65802.7787c8","type":"debug","z":"6152dadc.c29704","name":"Tasmota cmnd","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":420,"y":240,"wires":[]},{"id":"75666051.2abb2","type":"inject","z":"6152dadc.c29704","name":"ZbStatus1","props":[{"p":"topic","vt":"str"},{"p":"payload"}],"repeat":"","crontab":"","once":true,"onceDelay":"10","topic":"cmnd/ZbBridge/ZbStatus1","payloadType":"str","x":110,"y":600,"wires":[["c396385001178fe9"]]},{"id":"323df961.dca246","type":"mqtt out","z":"6152dadc.c29704","name":"mqtt","topic":"","qos":"0","retain":"false","respTopic":"","contentType":"","userProps":"","correl":"","expiry":"","broker":"","x":1130,"y":780,"wires":[]},{"id":"b86ed010.7f367","type":"function","z":"6152dadc.c29704","name":"Node-RED 2 Tasmota","func":"const topic = 'cmnd/ZbBridge/ZbSend';\n\nfunction EnhanceColor(normalized) {\n    if (normalized > 0.04045)\n        return Math.pow( (normalized + 0.055) / (1.0 + 0.055), 2.4);\n    return normalized / 12.92;\n}\n\nfunction RGBtoXY(r, g, b) {\n    let rNorm = r / 255.0;\n    let gNorm = g / 255.0;\n    let bNorm = b / 255.0;\n\n    let rFinal = EnhanceColor(rNorm);\n    let gFinal = EnhanceColor(gNorm);\n    let bFinal = EnhanceColor(bNorm);\n    \n    let X = rFinal * 0.649926 + gFinal * 0.103455 + bFinal * 0.197109;\n    let Y = rFinal * 0.234327 + gFinal * 0.743075 + bFinal * 0.022598;\n    let Z = rFinal * 0.000000 + gFinal * 0.053077 + bFinal * 1.035763;\n\n    if (X + Y + Z == 0)\n        return [0,0];\n\n    let xFinal = X / (X + Y + Z);\n    let yFinal = Y / (X + Y + Z);\n\n    return [xFinal, yFinal, Y];\n}\n\nfunction hexToRgb(hex) {\n    var result = /^#?([a-f\\d]{2})([a-f\\d]{2})([a-f\\d]{2})$/i.exec(hex);\n    return result ? {\n        r: parseInt(result[1], 16),\n        g: parseInt(result[2], 16),\n        b: parseInt(result[3], 16)\n    } : null;\n}\n\nfunction sendColor(r, g, b) {\n    if (typeof r === \"string\") {\n        argb = hexToRgb(r);\n        r = argb.r;\n        g = argb.g;\n        b = argb.b;\n    }\n    // node.error(\"r \" + r);\n    // node.error(\"g \" + g);\n    // node.error(\"b \" + b);\n    xy = RGBtoXY(r, g, b);\n    let x = Math.round(xy[0] * 65534);\n    let y = Math.round(xy[1] * 65534);\n    node.send({\n        topic: topic,\n        payload: {\n            Device:device_id,\n            Send: {\n                Color: x + \",\" + y\n            }\n        }\n    });\n}\n\n// Temperature is [2000-7500]\n// ZigBee Bulb temperature is [150-500] inverted\nfunction sendTemp(temperatureK) {\n    const color_temp = Math.round(153+347*(1-(temperatureK-2000)/7000));\n    node.send({\n        topic: topic,\n        payload: {\n            Device: device_id,\n            Send: {\n                CT: color_temp\n            }\n        }\n    });\n}\n\n//const topicArr = msg.topic.split(\"/\");\n//const device_name = topicArr[topicArr.length-2];\nconst device_name = msg.topic.substring(0, msg.topic.length-4);\n// node.warn(\"device_name \" + device_name);\nconst devices = flow.get(\"devices\") || {};\nif (Object.keys(devices).length === 0) {\n    return {\n        topic: 'cmnd/ZbBridge/ZbStatus1',\n        payload: ''\n    }\n}\n// node.warn(\"devices \" + JSON.stringify(devices));\nconst device_id = devices[device_name];\n// node.warn(\"device_id \" + JSON.stringify(device_id));\n// node.warn(device_name + \": \" + device_id);\nif (device_id !== undefined) {\n    // node.error(msg);\n    const payload = typeof msg.payload === 'string' ? JSON.parse(msg.payload) : msg.payload;\n    let toSendPowerOff = typeof payload.on === \"boolean\" && !payload.on;\n    let powerOnNotSent = false;\n    let pop = {\n        topic: topic,\n        payload: {\n            Device: device_id,\n            Send: {\n                Power: 1\n            }\n        }\n    };\n    if (!toSendPowerOff) {\n        let powerOnNotSent = !toSendPowerOff;\n        \n        // brightness\n        if (typeof payload.brightness === \"number\") {\n            if (powerOnNotSent) {\n                powerOnNotSent = false;\n                node.send(pop);\n            }\n            node.send({\n                topic: topic,\n                payload: {\n                    Device: device_id,\n                    Send: {\n                        Dimmer: Math.round(1 + (payload.brightness - 1) * 253 / 99)\n                    }\n                }\n            });\n        }\n    \n        if (typeof payload.color_temp === \"number\") {\n            if (powerOnNotSent) {\n                powerOnNotSent = false;\n                node.send(pop);\n            }\n            sendTemp(payload.color_temp);\n        }\n       \n        // rgb\n        if (typeof payload.rgb === \"string\") {\n            if (powerOnNotSent) {\n                powerOnNotSent = false;\n                node.send(pop);\n            }\n            sendColor(payload.rgb);\n        }\n    }\n\n    if (typeof payload.on === 'boolean') {\n        const power = payload.on ? 1 : 0;\n        //if (powerOnNotSent || power === 0) {\n            powerOnNotSent = true;\n            pop.payload.Send.Power = power;\n            node.send(pop);\n        //}\n    }\n    const device = flow.get(\"device\");\n    if (device === device_id) {\n        return [null, msg];\n    }\n}\n","outputs":2,"noerr":0,"initialize":"","finalize":"","libs":[],"x":300,"y":400,"wires":[["a251cdc2.0bb03","c396385001178fe9"],["0f850d0bafa7b4bb"]],"info":"Power: 0/1\nCT: [153-500]\nDimmer: [0-254]\nColor: [0-65534,0-65534]\n\non: boolean\ncolor.hex: RRGGBB\nbrightness: [0-100]\ncolor_temp: [2000-9000]\n"},{"id":"3416b10d.dc18de","type":"function","z":"6152dadc.c29704","name":"2 JSON","func":"if (typeof msg.payload === 'string') {\n    try {\n        msg.payload = JSON.parse(msg.payload);\n    } catch (e) {}\n}\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":220,"y":240,"wires":[["3eb65802.7787c8"]]},{"id":"c917e399.1daa8","type":"ui_dropdown","z":"6152dadc.c29704","name":"Devices","label":"","tooltip":"Seleziona un dispositivo","place":"Seleziona un dispositivo","group":"696d676.4c75a98","order":9,"width":"0","height":"0","passthru":false,"multiple":false,"options":[{"label":"","value":"","type":"str"}],"payload":"","topic":"topic","topicType":"msg","x":660,"y":1160,"wires":[["fb6b41e.e7095c","99aa480bea8e4c66"]]},{"id":"24877ee2.21da42","type":"ui_button","z":"6152dadc.c29704","name":"Aggiona","group":"696d676.4c75a98","order":3,"width":"1","height":"1","passthru":true,"label":"","tooltip":"Aggiona","color":"","bgcolor":"","icon":"fa-refresh","payload":" ","payloadType":"str","topic":"cmnd/ZbBridge/ZbStatus1","topicType":"str","x":660,"y":1120,"wires":[["12d59d36.40a573","c396385001178fe9"]]},{"id":"1db4b772.ed9919","type":"ui_text_input","z":"6152dadc.c29704","name":"Rename","label":"","tooltip":"Nome dispositivo","group":"696d676.4c75a98","order":10,"width":"0","height":"0","passthru":false,"mode":"text","delay":"0","topic":"","topicType":"str","x":660,"y":1220,"wires":[["fb6b41e.e7095c","1b797a02ab7a045d"]]},{"id":"fb6b41e.e7095c","type":"function","z":"6152dadc.c29704","name":"","func":"\nfunction compare_device(d1, d2) {\n    var nameA = (Object.keys(d1)[0]).toUpperCase();\n    var nameB = (Object.keys(d2)[0]).toUpperCase();\n    let i = nameA.indexOf(\" \");\n    if (i > 0) {\n        nameA = nameA.substring(i);\n    }\n    i = nameB.indexOf(\" \");\n    if (i > 0) {\n        nameB = nameB.substring(i);\n    }\n    if (nameA < nameB) {\n        return -1;\n    }\n    if (nameA > nameB) {\n        return 1;\n    }\n    return 0;\n}\n\nfunction device_list(devices) {\n    let dl = [];\n    Object.keys(devices).forEach(name => {\n        let device = {};\n        let id = devices[name];\n        device[id + \" \" + name] = id + \"\\t\";\n        dl.push(device);\n    });\n    dl.sort(compare_device);\n    return dl;\n}\n\nfunction get_name(devices, id) {\n    let name;\n    Object.keys(devices).forEach(i_name => {\n       if (devices[i_name] === id) {\n            name = i_name;\n       }\n    });\n    return name;\n}\n\nconst id = flow.get(\"device\") || null;\nlet devices = {};\nif (typeof msg.payload.ZbStatus1 === 'object') {\n    msg.payload.ZbStatus1.forEach(d => {\n        if (d.Name) {\n            devices[d.Name] = d.Device;\n        } else {\n            devices[\"./\" + d.Device + \"/1\"] = d.Device;\n        }\n    });\n    flow.set(\"devices\", devices);\n    return {\n        payload: id + \"\\t\",\n        options: device_list(devices)\n    };\n} else {\n    devices = flow.get(\"devices\") || {};\n}\n\nlet name;\nif (id) {\n    name = get_name(devices, id);\n}\n\n\nif (msg.topic === 'ZbForget' || \n    msg.topic === 'ZbPing' || \n    msg.topic === 'ZbStatus1' || \n    msg.topic === 'ZbStatus2' || \n    msg.topic === 'ZbStatus3') {\n    if (id) {\n        let msg3 = {\n            topic: \"cmnd/ZbBridge/\" + msg.topic,\n            payload: id\n        };\n        return ['', null, msg3, { payload: msg.topic + \" \" + id + \" \" + name}];\n    } else {\n        return [null, null, null, { payload: \"Nessun dispositivo selezionato\"}];\n    }\n} else if (msg.topic === 'Rimuovi dispositivo') {\n    if (id) {\n        let msg3 = {\n            topic: \"cmnd/ZbBridge/ZbForget\",\n            payload: id\n        };\n        return ['', null, msg3, { payload: \"Rimuovo \" + id + \" \" + name}];\n    } else {\n        return [null, null, null, { payload: \"Nessun dispositivo selezionato\"}];\n    }\n} else if (typeof msg.payload === \"string\") {\n    if (msg.payload.endsWith(\"\\t\")) {\n        let id = msg.payload.trim();\n        let idx = -1;\n        name = get_name(devices, id);\n        if (name != undefined) {\n            flow.set(\"device\", id);\n            return [null, { payload: name }];\n        } else {\n            return [null, null, null, { payload: \"Dispositivo \" + id + \" non trovato\"}];\n        }\n    } else {\n        if (id != null) {\n            let cur_name = get_name(devices, id);\n            let name = msg.payload.trim();\n            if (name !== undefined) {\n                if (name != cur_name) {\n                    if (devices[name]) {\n                        return [null, null, null, { payload: \"Nome \" + name + ' già presente'}];\n                    }\n                    delete devices[cur_name];\n                    devices[name] = id;\n                    flow.set(\"devices\", devices);\n                    let msg1 = { payload: id + \"\\t\", options: device_list(devices) };\n                    let msg2 = { payload: name };\n                    let msg3 = {\n                        topic: \"cmnd/ZbBridge/ZbName\",\n                        payload: id + \",\" + name\n                    };\n                    return [msg1, msg2, msg3, { payload: \"Rinomino \" + cur_name}];\n                }\n            } else {\n                return [null, null, null, { payload: \"Dispositivo \" + id + \" non trovato\"}];\n            }\n        } else {\n            return [null, null, null, { payload: \"Nessun dispositivo selezionato\"}];\n        }\n    }\n}\n","outputs":4,"noerr":0,"initialize":"","finalize":"","libs":[],"x":500,"y":520,"wires":[["c917e399.1daa8"],["1db4b772.ed9919"],["c396385001178fe9"],["89ad1f54.a7836"]]},{"id":"89ad1f54.a7836","type":"ui_toast","z":"6152dadc.c29704","position":"top right","displayTime":"3","highlight":"","sendall":false,"outputs":0,"ok":"OK","cancel":"","raw":false,"topic":"","name":"","x":630,"y":1260,"wires":[]},{"id":"6f953690.62b1f8","type":"ui_switch","z":"6152dadc.c29704","name":"","label":"Associazione Dispositivo","tooltip":"","group":"696d676.4c75a98","order":2,"width":0,"height":0,"passthru":false,"decouple":"true","topic":"cmnd/ZbBridge/RESULT/ZbPermitJoin","topicType":"str","style":"","onvalue":"1","onvalueType":"num","onicon":"","oncolor":"","offvalue":"0","offvalueType":"num","officon":"","offcolor":"","animate":false,"x":610,"y":1080,"wires":[["c396385001178fe9","7fc68506aa8b253e"]]},{"id":"916f90c7.309ba","type":"inject","z":"6152dadc.c29704","name":"Get ZbConfig","props":[{"p":"topic","vt":"str"},{"p":"payload"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"cmnd/ZbBridge/ZbConfig","payloadType":"str","x":110,"y":780,"wires":[["c396385001178fe9"]]},{"id":"9cf3660e.cb8a58","type":"inject","z":"6152dadc.c29704","name":"ZbNameKey 0","props":[{"p":"topic","vt":"str"},{"p":"payload"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"cmnd/ZbBridge/ZbNameKey","payload":"0","payloadType":"str","x":110,"y":900,"wires":[["c396385001178fe9"]]},{"id":"64c8b3cb.a097ac","type":"inject","z":"6152dadc.c29704","name":"ZbNameKey 1","props":[{"p":"topic","vt":"str"},{"p":"payload"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"cmnd/ZbBridge/ZbNameKey","payload":"1","payloadType":"str","x":110,"y":940,"wires":[["c396385001178fe9"]]},{"id":"7e48010d.69099","type":"inject","z":"6152dadc.c29704","name":"ZbStatus2","props":[{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"cmnd/ZbBridge/ZbStatus2","payloadType":"str","x":100,"y":640,"wires":[["7d0824b4d23b5075"]]},{"id":"be148149.6a692","type":"inject","z":"6152dadc.c29704","name":"ZbStatus3","props":[{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"cmnd/ZbBridge/ZbStatus3","payloadType":"str","x":100,"y":680,"wires":[["7d0824b4d23b5075"]]},{"id":"f47a516f.6a6a9","type":"mqtt out","z":"6152dadc.c29704","name":"mqtts","topic":"","qos":"0","retain":"false","respTopic":"","contentType":"","userProps":"","correl":"","expiry":"","broker":"","x":1130,"y":300,"wires":[]},{"id":"195076e.ce2dd89","type":"debug","z":"6152dadc.c29704","name":"Tasmota join","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":530,"y":360,"wires":[]},{"id":"2bb84210.60df7e","type":"mqtt in","z":"6152dadc.c29704","name":"","topic":"scene/associazione dispositivo/set","qos":"0","datatype":"json","broker":"","nl":false,"rap":false,"inputs":0,"x":160,"y":1020,"wires":[["c5501fc8.d8ced"]]},{"id":"c5501fc8.d8ced","type":"change","z":"6152dadc.c29704","name":"","rules":[{"t":"set","p":"payload","pt":"msg","to":"msg.payload? 1 : 0","tot":"jsonata"},{"t":"set","p":"topic","pt":"msg","to":"cmnd/ZbBridge/RESULT/ZbPermitJoin","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":420,"y":1020,"wires":[["c396385001178fe9"]]},{"id":"78b984f2.e388bc","type":"ui_toast","z":"6152dadc.c29704","position":"dialog","displayTime":"3","highlight":"","sendall":true,"outputs":1,"ok":"OK","cancel":"Annulla","raw":false,"topic":"","name":"","x":650,"y":1500,"wires":[["25dbdfa4.33328"]]},{"id":"be79dea1.3ff8d","type":"ui_button","z":"6152dadc.c29704","name":"Rimuovi","group":"696d676.4c75a98","order":5,"width":"1","height":"1","passthru":false,"label":"","tooltip":"Rimuovi","color":"","bgcolor":"","icon":"fa-trash","payload":"device","payloadType":"flow","topic":"Rimuovi dispositivo","topicType":"str","x":660,"y":1340,"wires":[["8389a880f30c81fc"]]},{"id":"25dbdfa4.33328","type":"switch","z":"6152dadc.c29704","name":"","property":"payload","propertyType":"msg","rules":[{"t":"eq","v":"OK","vt":"str"}],"checkall":"true","repair":false,"outputs":1,"x":810,"y":1500,"wires":[["fb6b41e.e7095c","1da3a89e.17eb57"]]},{"id":"1da3a89e.17eb57","type":"delay","z":"6152dadc.c29704","name":"","pauseType":"delay","timeout":"5","timeoutUnits":"seconds","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"outputs":1,"x":1000,"y":1500,"wires":[["24877ee2.21da42"]]},{"id":"e0a63eb4.67dfc","type":"switch","z":"6152dadc.c29704","name":"","property":"payload","propertyType":"msg","rules":[{"t":"eq","v":"0","vt":"num"}],"checkall":"true","repair":false,"outputs":1,"x":570,"y":640,"wires":[["24877ee2.21da42"]]},{"id":"12d59d36.40a573","type":"change","z":"6152dadc.c29704","name":"","rules":[{"t":"set","p":"topic","pt":"msg","to":"Aggiornamento dispositivi","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":430,"y":1260,"wires":[["89ad1f54.a7836"]]},{"id":"6f60782.c591f88","type":"inject","z":"6152dadc.c29704","name":"Set ZbConfig","props":[{"p":"topic","vt":"str"},{"p":"payload"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"cmnd/ZbBridge/ZbConfig","payload":"{\"Channel\":17,\"PanID\":\"0x2714\",\"ExtPanID\":\"0xA639F45B9E384C78\",\"KeyL\":\"\",\"KeyH\":\"\"}","payloadType":"json","x":110,"y":820,"wires":[["c396385001178fe9"]]},{"id":"e82a4122.f105a","type":"inject","z":"6152dadc.c29704","name":"Set Rand ZbConfig","props":[{"p":"topic","vt":"str"},{"p":"payload"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"cmnd/ZbBridge/ZbConfig","payload":"{\"KeyL\":\"\",\"KeyH\":\"\"}","payloadType":"json","x":130,"y":860,"wires":[["c396385001178fe9"]]},{"id":"a251cdc2.0bb03","type":"debug","z":"6152dadc.c29704","name":"","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":510,"y":400,"wires":[]},{"id":"1bb1fbef.e3e9a4","type":"trigger","z":"6152dadc.c29704","name":"reset msg","op1":"","op2":".","op1type":"pay","op2type":"str","duration":"250","extend":false,"overrideDelay":false,"units":"ms","reset":"","bytopic":"all","topic":"topic","outputs":1,"x":1120,"y":1580,"wires":[["a3055ee6.92f7f"]]},{"id":"a3055ee6.92f7f","type":"ui_template","z":"6152dadc.c29704","group":"696d676.4c75a98","name":"window redirect","order":1,"width":0,"height":0,"format":"<script>\n(function(scope) {\n    scope.$watch('msg.payload', function(data) {\n        if (data && data !== '.') {\n            window.open(data);\n        }\n    });\n})(scope);\n</script>","storeOutMessages":false,"fwdInMessages":true,"resendOnRefresh":false,"templateScope":"local","x":1300,"y":1580,"wires":[[]]},{"id":"1d9904b0.9287fb","type":"ui_button","z":"6152dadc.c29704","name":"","group":"696d676.4c75a98","order":11,"width":"3","height":"1","passthru":false,"label":"ZbBridge","tooltip":"ZbBridge Web GUI","color":"","bgcolor":"","icon":"","payload":"http://ZbBridgeIP/","payloadType":"str","topic":"url","topicType":"str","x":660,"y":1580,"wires":[["76b245f04ce66232"]]},{"id":"5ab826c4.6b6da8","type":"inject","z":"6152dadc.c29704","name":"ZbLight","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"cmnd/ZbBridge/ZbLight","payload":"0x3785,5","payloadType":"str","x":90,"y":980,"wires":[["c396385001178fe9"]]},{"id":"db8ccb697c24b8ea","type":"ui_switch","z":"6152dadc.c29704","name":"","label":"ON/OFF","tooltip":"","group":"696d676.4c75a98","order":12,"width":0,"height":0,"passthru":false,"decouple":"true","topic":"","topicType":"str","style":"","onvalue":"true","onvalueType":"bool","onicon":"","oncolor":"","offvalue":"false","offvalueType":"bool","officon":"","offcolor":"","animate":true,"x":660,"y":1620,"wires":[["06c7b1474a069b81"]]},{"id":"5a2ee862099bddc2","type":"ui_slider","z":"6152dadc.c29704","name":"","label":"Luminosità","tooltip":"","group":"696d676.4c75a98","order":13,"width":0,"height":0,"passthru":false,"outs":"end","topic":"","topicType":"str","min":"1","max":"100","step":"","x":650,"y":1660,"wires":[["06c7b1474a069b81"]]},{"id":"6c2f6861937e850e","type":"ui_button","z":"6152dadc.c29704","name":"","group":"696d676.4c75a98","order":14,"width":"3","height":"1","passthru":false,"label":"Fredda","tooltip":"","color":"","bgcolor":"","icon":"","payload":"9000","payloadType":"num","topic":"","topicType":"str","x":660,"y":1980,"wires":[["06c7b1474a069b81"]]},{"id":"afbe1ab759ce9a30","type":"ui_slider","z":"6152dadc.c29704","name":"","label":"Temperatura","tooltip":"","group":"696d676.4c75a98","order":16,"width":0,"height":0,"passthru":false,"outs":"end","topic":"","topicType":"str","min":"2000","max":"9000","step":"10","x":650,"y":2060,"wires":[["06c7b1474a069b81"]]},{"id":"34f61f4333ccc55a","type":"ui_button","z":"6152dadc.c29704","name":"","group":"696d676.4c75a98","order":15,"width":"3","height":"1","passthru":false,"label":"Calda","tooltip":"","color":"","bgcolor":"","icon":"","payload":"2000","payloadType":"num","topic":"","topicType":"str","x":670,"y":2020,"wires":[["06c7b1474a069b81"]]},{"id":"bc345d5a069b382f","type":"ui_colour_picker","z":"6152dadc.c29704","name":"","label":"Colore","group":"696d676.4c75a98","format":"hex","outformat":"string","showSwatch":true,"showPicker":false,"showValue":false,"showHue":false,"showAlpha":false,"showLightness":true,"square":"false","dynOutput":"false","order":17,"width":0,"height":0,"passthru":false,"topic":"","topicType":"str","x":670,"y":1700,"wires":[["06c7b1474a069b81"]]},{"id":"06c7b1474a069b81","type":"function","z":"6152dadc.c29704","name":"Dashboard 2 Node-RED","func":"let id = flow.get(\"device\") || null;\nif (id) {\n    msg.topic = id;\n    const devices = flow.get(\"devices\") || {};\n    Object.keys(devices).forEach(i_name => {\n       if (devices[i_name] === id) {\n            msg.topic = i_name;\n       }\n    });\n    switch (typeof msg.payload) {\n        case \"boolean\":\n            msg.payload = { on: msg.payload };\n            break;\n        case \"string\":\n            msg.payload = { rgb: msg.payload };\n            break;\n        case \"number\":\n            if (msg.payload <= 100) {\n                msg.payload = { brightness: msg.payload };\n            } else {\n                msg.payload = { color_temp: msg.payload };\n            }\n            break;\n    }\n    if (msg.topic) {\n        msg.topic = msg.topic + '/set';\n        return msg;\n    }\n}\n","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":930,"y":1760,"wires":[["b86ed010.7f367"]]},{"id":"808f3d39875d5268","type":"change","z":"6152dadc.c29704","name":"","rules":[{"t":"set","p":"delta_pressione","pt":"flow","to":"delta_pressione","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":290,"y":80,"wires":[[]]},{"id":"3694e08422689c46","type":"inject","z":"6152dadc.c29704","name":"","props":[{"p":"name","v":"tasmota_9DD4CE","vt":"str"},{"p":"ip","v":"tasmota-9dd4ce-5326","vt":"str"},{"p":"delta_pressione","v":"{\"sensore/camera nonna/1\":-36,\"sensore/cucina/1\":2}","vt":"json"}],"repeat":"","crontab":"","once":true,"onceDelay":0.1,"topic":"","payloadType":"str","x":90,"y":80,"wires":[["808f3d39875d5268"]]},{"id":"8706aa064501cd0e","type":"ui_button","z":"6152dadc.c29704","name":"Rosso","group":"696d676.4c75a98","order":18,"width":"1","height":"1","passthru":false,"label":"","tooltip":"","color":"","bgcolor":"red","icon":"","payload":"FF0000","payloadType":"str","topic":"","topicType":"str","x":670,"y":1740,"wires":[["06c7b1474a069b81"]]},{"id":"97c8495661f58e38","type":"ui_button","z":"6152dadc.c29704","name":"Verde","group":"696d676.4c75a98","order":19,"width":"1","height":"1","passthru":false,"label":"","tooltip":"","color":"","bgcolor":"green","icon":"","payload":"00FF00","payloadType":"str","topic":"","topicType":"str","x":670,"y":1780,"wires":[["06c7b1474a069b81"]]},{"id":"93b5dc053bee9559","type":"ui_button","z":"6152dadc.c29704","name":"Blu","group":"696d676.4c75a98","order":20,"width":"1","height":"1","passthru":false,"label":"","tooltip":"","color":"","bgcolor":"blue","icon":"","payload":"0000FF","payloadType":"str","topic":"","topicType":"str","x":670,"y":1820,"wires":[["06c7b1474a069b81"]]},{"id":"f72ff60719f1e1d4","type":"ui_button","z":"6152dadc.c29704","name":"Giallo","group":"696d676.4c75a98","order":23,"width":"1","height":"1","passthru":false,"label":"","tooltip":"","color":"","bgcolor":"yellow","icon":"","payload":"FFFF00","payloadType":"str","topic":"","topicType":"str","x":670,"y":1940,"wires":[["06c7b1474a069b81"]]},{"id":"5f3e40c75c7da338","type":"ui_button","z":"6152dadc.c29704","name":"Magenta","group":"696d676.4c75a98","order":22,"width":"1","height":"1","passthru":false,"label":"","tooltip":"","color":"","bgcolor":"magenta","icon":"","payload":"FF00FF","payloadType":"str","topic":"","topicType":"str","x":660,"y":1900,"wires":[["06c7b1474a069b81"]]},{"id":"788ff080858fa68b","type":"ui_button","z":"6152dadc.c29704","name":"Azzurro","group":"696d676.4c75a98","order":21,"width":"1","height":"1","passthru":false,"label":"","tooltip":"","color":"","bgcolor":"cyan","icon":"","payload":"00FFFF","payloadType":"str","topic":"","topicType":"str","x":660,"y":1860,"wires":[["06c7b1474a069b81"]]},{"id":"bd8dbffe46186933","type":"ui_button","z":"6152dadc.c29704","name":"Ping","group":"696d676.4c75a98","order":4,"width":"1","height":"1","passthru":false,"label":"","tooltip":"Ping","color":"","bgcolor":"","icon":"fa-question","payload":"device","payloadType":"flow","topic":"ZbPing","topicType":"str","x":670,"y":1300,"wires":[["fb6b41e.e7095c"]]},{"id":"a42b144b101f0529","type":"ui_button","z":"6152dadc.c29704","name":"ZbStatus2","group":"696d676.4c75a98","order":7,"width":"1","height":"1","passthru":false,"label":"","tooltip":"ZbStatus2","color":"","bgcolor":"","icon":"fa-file-o","payload":"","payloadType":"str","topic":"ZbStatus2","topicType":"str","x":650,"y":1420,"wires":[["fb6b41e.e7095c"]]},{"id":"c396385001178fe9","type":"change","z":"6152dadc.c29704","name":"ZbBridge","rules":[{"t":"set","p":"zbbridge","pt":"msg","to":"#:(file)::name","tot":"flow"},{"t":"set","p":"zbbridge","pt":"msg","to":"'/' & msg.zbbridge & '/'","tot":"jsonata"},{"t":"change","p":"topic","pt":"msg","from":"/ZbBridge/","fromt":"str","to":"zbbridge","tot":"msg"},{"t":"delete","p":"zbbridge","pt":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":960,"y":780,"wires":[["323df961.dca246"]]},{"id":"b2f475e303f99f06","type":"ui_button","z":"6152dadc.c29704","name":"ZbStatus3","group":"696d676.4c75a98","order":8,"width":"1","height":"1","passthru":false,"label":"","tooltip":"ZbStatus3","color":"","bgcolor":"","icon":"fa-file","payload":"","payloadType":"str","topic":"ZbStatus3","topicType":"str","x":650,"y":1460,"wires":[["fb6b41e.e7095c"]]},{"id":"b9061ddf.04184","type":"ui_button","z":"6152dadc.c29704","name":"ZbStatus1","group":"696d676.4c75a98","order":6,"width":"1","height":"1","passthru":false,"label":"","tooltip":"ZbStatus1","color":"","bgcolor":"","icon":"fa-info","payload":"device","payloadType":"flow","topic":"ZbStatus1","topicType":"str","x":650,"y":1380,"wires":[["fb6b41e.e7095c"]]},{"id":"8389a880f30c81fc","type":"function","z":"6152dadc.c29704","name":"rimuovi","func":"const id = flow.get(\"device\") || null;\nif (id) {\n    let msg = {\n        topic: 'Rimuovi dispositivo',\n        payload: id\n    };\n    const devices = flow.get(\"devices\") || {};\n    Object.keys(devices).forEach(i_name => {\n       if (devices[i_name] === id) {\n            msg.payload = msg.payload + ' ' + i_name;\n       }\n    });\n    return msg;\n}\n","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":820,"y":1340,"wires":[["78b984f2.e388bc"]]},{"id":"7d0824b4d23b5075","type":"change","z":"6152dadc.c29704","name":"","rules":[{"t":"set","p":"devices","pt":"msg","to":"devices","tot":"flow"},{"t":"set","p":"payload","pt":"msg","to":"(\t  $kr := function($devices) {(\t      $ks := $keys($devices);\t      $c := $count($ks);\t      $r := $floor($random() * $c);\t      $k := $ks[$r];\t      $lookup($devices, $k)\t  )};\t\t  $kr(msg.devices)\t)\t","tot":"jsonata"},{"t":"delete","p":"devices","pt":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":300,"y":660,"wires":[["c396385001178fe9","3da538799bb44040"]]},{"id":"1b797a02ab7a045d","type":"trigger","z":"6152dadc.c29704","name":"","op1":"","op2":"","op1type":"str","op2type":"str","duration":"5","extend":false,"overrideDelay":false,"units":"s","reset":"","bytopic":"all","topic":"topic","outputs":2,"x":840,"y":1220,"wires":[[],["5ac93580c96a7515"]]},{"id":"5ac93580c96a7515","type":"change","z":"6152dadc.c29704","name":"","rules":[{"t":"set","p":"topic","pt":"msg","to":"cmnd/ZbBridge/ZbStatus1","tot":"str"},{"t":"delete","p":"payload","pt":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":1020,"y":1220,"wires":[["c396385001178fe9","12d59d36.40a573"]]},{"id":"7fc68506aa8b253e","type":"change","z":"6152dadc.c29704","name":"","rules":[{"t":"set","p":"payload","pt":"msg","to":"payload = 1","tot":"jsonata"},{"t":"set","p":"topic","pt":"msg","to":"scene/associazione dispositivo/set","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":900,"y":1080,"wires":[["f47a516f.6a6a9"]]},{"id":"8e05af46b2d0cf5c","type":"ui_button","z":"6152dadc.c29704","name":"","group":"696d676.4c75a98","order":11,"width":"3","height":"1","passthru":false,"label":"ZbBridge Maps","tooltip":"ZbBridge Maps","color":"","bgcolor":"","icon":"","payload":"http://ZbBridgeIP/zbm?","payloadType":"str","topic":"url","topicType":"str","x":680,"y":1540,"wires":[["76b245f04ce66232"]]},{"id":"0f850d0bafa7b4bb","type":"function","z":"6152dadc.c29704","name":"Node-RED 2 Dashboard","func":"let state = null;\nlet brightness = null;\nlet color = null;\nlet temp = null;\n\nif (typeof msg.payload.on === 'boolean') {\n    state = {payload: msg.payload.on};\n}\n\nif (typeof msg.payload.brightness === 'number') {\n    brightness = {payload: msg.payload.brightness};\n}\n\nif (typeof msg.payload.color_temp === 'number' ) {\n    temp = {payload: msg.payload.color_temp};\n    color = { payload: \"FFFFFF\" }\n}\n\nif (typeof msg.payload.rgb === 'string') {\n    color = {payload: msg.payload.rgb.startsWith(\"#\") ? msg.payload.rgb.substring(1) : msg.payload.rgb};\n}\n\nreturn [state, brightness, color, temp];\n","outputs":4,"noerr":0,"initialize":"","finalize":"","libs":[],"x":330,"y":1700,"wires":[["db8ccb697c24b8ea"],["5a2ee862099bddc2"],["bc345d5a069b382f"],["afbe1ab759ce9a30"]]},{"id":"020a859ed383b029","type":"switch","z":"6152dadc.c29704","name":"","property":"payload.ZbStatus1","propertyType":"msg","rules":[{"t":"nempty"}],"checkall":"true","repair":false,"outputs":1,"x":250,"y":520,"wires":[["fb6b41e.e7095c"]]},{"id":"b454901d065ba6d6","type":"function","z":"6152dadc.c29704","name":"Tasmota 2 Node-RED","func":"if (typeof msg.payload === 'string') {\n    try {\n        msg.payload = JSON.parse(msg.payload);\n    } catch (e) {}\n}\n\nconst selected_device = flow.get(\"device\");\nconst delta_pressione = flow.get(\"delta_pressione\") ||  {};\nlet msgq = [];\nlet msgd = null;\nif (typeof msg.payload.ZbStatus3 === \"object\") {\n    msg.payload.ZbStatus3.forEach(device => {\n        if (typeof device.LinkQuality === \"number\") {\n            device.linkquality = device.LinkQuality;\n        }\n        if (typeof device.BatteryVoltage === \"number\") {\n            device.voltage = device.BatteryVoltage;\n        }\n        if (typeof device.BatteryPercentage === \"number\") {\n            device.battery = device.BatteryPercentage;\n        }\n        if (typeof device.Power === \"number\") {\n            device.on = device.Power === 1;\n        }\n        if (typeof device.Dimmer === \"number\") {\n            device.brightness = Math.round(1 + (device.Dimmer -1) * 99 / 253);\n        }\n        if (typeof device.CT === \"number\") {\n            let temperature = 2000 + 7000 * (1 - (device.CT - 153)/347);\n            device.color_temp = Math.round(temperature);\n            // device.color_temp = device.CT;\n        }\n        if (typeof device.Temperature === \"number\") {\n            device.temperature = device.Temperature;\n        }\n        if (typeof device.Pressure === \"number\") {\n            device.Pressure = device.Pressure + (delta_pressione[device.Name] || 0);\n            device.pressure = device.Pressure;\n        }\n        if (typeof device.Humidity === \"number\") {\n            device.humidity = device.Humidity;\n        }\n        msgq.push({\n           topic: device.Name,\n           payload: device\n        });\n        if (selected_device === device.Device) {\n            msgd = { payload: device };\n        }\n    });\n    return [msgq, msgd];\n}\n","outputs":2,"noerr":0,"initialize":"","finalize":"","libs":[],"x":300,"y":460,"wires":[["f47a516f.6a6a9"],["0f850d0bafa7b4bb"]],"info":"Power: 0/1\nCT: [153-500]\nDimmer: [0-254]\nColor: [0-65534,0-65534]\n\non: boolean\ncolor.hex: RRGGBB\nbrightness: [0-100]\ncolor_temp: [2000-9000]\n"},{"id":"66c7a52689181177","type":"inject","z":"6152dadc.c29704","name":"ZbStatus3 all","props":[{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":true,"onceDelay":"15","topic":"","x":120,"y":720,"wires":[["399932e0857af99e"]]},{"id":"399932e0857af99e","type":"function","z":"6152dadc.c29704","name":"ZbStatus3 all","func":"const devices = flow.get(\"devices\") || {};\nObject.keys(devices).forEach(name => {\n    node.send({\n        topic: \"cmnd/ZbBridge/ZbStatus3\",\n        payload: devices[name]\n    });\n});\n","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":310,"y":720,"wires":[["19af33ae9b46fff2"]]},{"id":"19af33ae9b46fff2","type":"delay","z":"6152dadc.c29704","name":"","pauseType":"rate","timeout":"100","timeoutUnits":"milliseconds","rate":"5","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"allowrate":false,"outputs":1,"x":500,"y":740,"wires":[["c396385001178fe9"]]},{"id":"76b245f04ce66232","type":"change","z":"6152dadc.c29704","name":"","rules":[{"t":"set","p":"zbbridgeip","pt":"msg","to":"#:(file)::ip","tot":"flow"},{"t":"set","p":"zbbridgeip","pt":"msg","to":"'/' & msg.zbbridgeip & '/'","tot":"jsonata"},{"t":"change","p":"payload","pt":"msg","from":"/ZbBridgeIP/","fromt":"str","to":"zbbridgeip","tot":"msg"},{"t":"delete","p":"zbbridgeip","pt":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":900,"y":1580,"wires":[["1bb1fbef.e3e9a4"]]},{"id":"9a2ff0e0a230beab","type":"comment","z":"6152dadc.c29704","name":"Delta pressure","info":"","x":300,"y":40,"wires":[]},{"id":"a703b7a66b86ecfd","type":"mqtt in","z":"6152dadc.c29704","name":"","topic":"tele/+/INFO2","qos":"2","datatype":"json","broker":"","nl":false,"rap":true,"rh":0,"inputs":0,"x":90,"y":180,"wires":[["927216f726d51acc"]]},{"id":"a860a2c0bc37f51a","type":"change","z":"6152dadc.c29704","name":"","rules":[{"t":"set","p":"#:(file)::name","pt":"flow","to":"$split(msg.topic, '/')[1]","tot":"jsonata"},{"t":"set","p":"#:(file)::hostname","pt":"flow","to":"payload.Info2.Hostname","tot":"msg"},{"t":"set","p":"#:(file)::ip","pt":"flow","to":"payload.Info2.IPAddress","tot":"msg"},{"t":"set","p":"#:(file)::tasmota[msg.name]","pt":"flow","to":"hostname","tot":"msg"},{"t":"set","p":"payload","pt":"msg","to":"","tot":"str"},{"t":"set","p":"topic","pt":"msg","to":"'cmnd/' & $split(msg.topic, '/')[1] & '/ZbStatus1'","tot":"jsonata"}],"action":"","property":"","from":"","to":"","reg":false,"x":640,"y":180,"wires":[["323df961.dca246"]]},{"id":"8b63e1339639a64e","type":"debug","z":"6152dadc.c29704","name":"Tasmota INFO2","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":440,"y":200,"wires":[]},{"id":"8806fb92acfb4022","type":"mqtt in","z":"6152dadc.c29704","name":"","topic":"tele/+/INFO1","qos":"2","datatype":"json","broker":"","nl":false,"rap":true,"rh":0,"inputs":0,"x":90,"y":120,"wires":[["664f0ffad8290b15"]]},{"id":"3de60ffa278b253b","type":"debug","z":"6152dadc.c29704","name":"Tasmota INFO1","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":640,"y":120,"wires":[]},{"id":"664f0ffad8290b15","type":"switch","z":"6152dadc.c29704","name":"","property":"payload.Info1.Module","propertyType":"msg","rules":[{"t":"eq","v":"Sonoff ZbBridge","vt":"str"}],"checkall":"true","repair":false,"outputs":1,"x":250,"y":120,"wires":[["2968ab96b62f3de3"]]},{"id":"2968ab96b62f3de3","type":"change","z":"6152dadc.c29704","name":"","rules":[{"t":"set","p":"#:(file)::name","pt":"flow","to":"$split(msg.topic, '/')[1]","tot":"jsonata"}],"action":"","property":"","from":"","to":"","reg":false,"x":440,"y":120,"wires":[["3de60ffa278b253b"]]},{"id":"927216f726d51acc","type":"switch","z":"6152dadc.c29704","name":"","property":"#:(file)::name","propertyType":"flow","rules":[{"t":"eq","v":"$split(msg.topic, '/')[1]","vt":"jsonata"}],"checkall":"true","repair":false,"outputs":1,"x":250,"y":180,"wires":[["a860a2c0bc37f51a","8b63e1339639a64e"]]},{"id":"7ab9e6a6c21724de","type":"comment","z":"6152dadc.c29704","name":"Restart the tasmota ZigBee device just one time after deploy","info":"","x":700,"y":40,"wires":[]},{"id":"d9d659206a03b61b","type":"comment","z":"6152dadc.c29704","name":"Store in a persistent storage","info":"","x":440,"y":140,"wires":[]},{"id":"988e8fb3cb9b1ce0","type":"comment","z":"6152dadc.c29704","name":"Store in a persistent storage","info":"","x":680,"y":200,"wires":[]},{"id":"3da538799bb44040","type":"debug","z":"6152dadc.c29704","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":1200,"y":700,"wires":[]},{"id":"99aa480bea8e4c66","type":"change","z":"6152dadc.c29704","name":"","rules":[{"t":"set","p":"topic","pt":"msg","to":"cmnd/ZbBridge/ZbStatus3","tot":"str"},{"t":"set","p":"payload","pt":"msg","to":"$trim(msg.payload)","tot":"jsonata"}],"action":"","property":"","from":"","to":"","reg":false,"x":880,"y":1140,"wires":[["c396385001178fe9"]]},{"id":"bbdd702a44056584","type":"ui_spacer","z":"6152dadc.c29704","name":"spacer","group":"ec2defc404497892","order":1,"width":1,"height":1},{"id":"696d676.4c75a98","type":"ui_group","name":"ZBBridge","tab":"15e6eb15.d05db5","order":2,"disp":true,"width":"6","collapse":false},{"id":"ec2defc404497892","type":"ui_group","name":"Dati","tab":"22cf0131.c8501e","order":6,"disp":false,"width":"20","collapse":false},{"id":"15e6eb15.d05db5","type":"ui_tab","name":"Impostazioni","icon":"dashboard","order":12,"disabled":false,"hidden":false},{"id":"22cf0131.c8501e","type":"ui_tab","name":"Generale","icon":"dashboard","order":1,"disabled":false,"hidden":false}]

Flow Info

Created 3 years, 7 months ago
Rating: not yet rated

Owner

Actions

Rate:

Node Types

Core
  • change (x11)
  • comment (x4)
  • debug (x9)
  • delay (x2)
  • function (x9)
  • inject (x11)
  • mqtt in (x7)
  • mqtt out (x2)
  • switch (x5)
  • trigger (x2)
Other

Tags

  • Tasmota
  • ZigBee
  • ZbBridge
  • Sonoff
Copy this flow JSON to your clipboard and then import into Node-RED using the Import From > Clipboard (Ctrl-I) menu option