Created
January 31, 2021 03:09
-
-
Save kumajaya/9dfc280f06b9a62228be222572bda797 to your computer and use it in GitHub Desktop.
Wildcard like for accessing payload property
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[ | |
{ | |
"id": "e9d5efea.bbe38", | |
"type": "inject", | |
"z": "b2c190b4.edfa7", | |
"name": "", | |
"props": [ | |
{ | |
"p": "payload" | |
}, | |
{ | |
"p": "topic", | |
"vt": "str" | |
} | |
], | |
"repeat": "", | |
"crontab": "", | |
"once": false, | |
"onceDelay": 0.1, | |
"topic": "", | |
"payload": "{\"ZbReceived\":{\"MiButton2\":{\"Device\":\"0x0E10\",\"Name\":\"MiButton2\",\"Power\":1,\"Endpoint\":1,\"LinkQuality\":110}}}", | |
"payloadType": "json", | |
"x": 130, | |
"y": 1660, | |
"wires": [ | |
[ | |
"3368a2ff.e0679e" | |
] | |
] | |
}, | |
{ | |
"id": "5443d975.8eaba8", | |
"type": "inject", | |
"z": "b2c190b4.edfa7", | |
"name": "", | |
"props": [ | |
{ | |
"p": "payload" | |
}, | |
{ | |
"p": "topic", | |
"vt": "str" | |
} | |
], | |
"repeat": "", | |
"crontab": "", | |
"once": false, | |
"onceDelay": 0.1, | |
"topic": "", | |
"payload": "{\"ZbReceived\":{\"unknown\":{\"Device\":\"0x0E10\",\"Name\":\"MiButton2\",\"Power\":1,\"Endpoint\":1,\"LinkQuality\":110}}}", | |
"payloadType": "json", | |
"x": 130, | |
"y": 1700, | |
"wires": [ | |
[ | |
"3368a2ff.e0679e" | |
] | |
] | |
}, | |
{ | |
"id": "3368a2ff.e0679e", | |
"type": "function", | |
"z": "b2c190b4.edfa7", | |
"name": "", | |
"func": "var obj = msg.payload.ZbReceived,\n Name = obj[Object.keys(obj)[0]].Name;\n\nmsg.payload = Name;\nreturn msg;", | |
"outputs": 1, | |
"noerr": 0, | |
"initialize": "", | |
"finalize": "", | |
"x": 310, | |
"y": 1680, | |
"wires": [ | |
[ | |
"264f5a5e.3b91a6" | |
] | |
] | |
}, | |
{ | |
"id": "264f5a5e.3b91a6", | |
"type": "debug", | |
"z": "b2c190b4.edfa7", | |
"name": "", | |
"active": true, | |
"tosidebar": true, | |
"console": false, | |
"tostatus": false, | |
"complete": "false", | |
"statusVal": "", | |
"statusType": "auto", | |
"x": 490, | |
"y": 1680, | |
"wires": [] | |
} | |
] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment