Last active
May 30, 2024 18:51
-
-
Save sebastianrothbucher/002a724e8340dbb3da39af42a83b508d to your computer and use it in GitHub Desktop.
IoTcore simple policy and node-red flow
This file contains hidden or 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": "426169ba36026cef", | |
"type": "tab", | |
"label": "Flow 1", | |
"disabled": false, | |
"info": "", | |
"env": [] | |
}, | |
{ | |
"id": "667e31258947c5a5", | |
"type": "mqtt out", | |
"z": "426169ba36026cef", | |
"d": true, | |
"name": "", | |
"topic": "test1", | |
"qos": "0", | |
"retain": "true", | |
"respTopic": "", | |
"contentType": "", | |
"userProps": "", | |
"correl": "", | |
"expiry": "", | |
"broker": "4c98c9faf0d2c5cc", | |
"x": 510, | |
"y": 100, | |
"wires": [] | |
}, | |
{ | |
"id": "0ea43f2046318427", | |
"type": "inject", | |
"z": "426169ba36026cef", | |
"name": "", | |
"props": [ | |
{ | |
"p": "payload" | |
}, | |
{ | |
"p": "topic", | |
"vt": "str" | |
} | |
], | |
"repeat": "", | |
"crontab": "", | |
"once": false, | |
"onceDelay": 0.1, | |
"topic": "whatever", | |
"payload": "{\t \"deviceId\": \"0815\",\t \"ts\": $toMillis($now()),\t \"heat\": 100.0*$random()\t}", | |
"payloadType": "jsonata", | |
"x": 110, | |
"y": 100, | |
"wires": [ | |
[ | |
"667e31258947c5a5", | |
"57998534d0ca3d80" | |
] | |
] | |
}, | |
{ | |
"id": "44b9e02a0dfa8c44", | |
"type": "debug", | |
"z": "426169ba36026cef", | |
"name": "debug 2", | |
"active": true, | |
"tosidebar": true, | |
"console": false, | |
"tostatus": false, | |
"complete": "false", | |
"statusVal": "", | |
"statusType": "auto", | |
"x": 520, | |
"y": 240, | |
"wires": [] | |
}, | |
{ | |
"id": "b8a7111d1565fbe2", | |
"type": "mqtt in", | |
"z": "426169ba36026cef", | |
"d": true, | |
"name": "", | |
"topic": "test1", | |
"qos": "2", | |
"datatype": "auto-detect", | |
"broker": "4c98c9faf0d2c5cc", | |
"nl": false, | |
"rap": true, | |
"rh": 0, | |
"inputs": 0, | |
"x": 110, | |
"y": 220, | |
"wires": [ | |
[ | |
"44b9e02a0dfa8c44" | |
] | |
] | |
}, | |
{ | |
"id": "a652fd65381f40ac", | |
"type": "mqtt in", | |
"z": "426169ba36026cef", | |
"name": "", | |
"topic": "test/one", | |
"qos": "0", | |
"datatype": "auto-detect", | |
"broker": "aac991e8d61de49a", | |
"nl": false, | |
"rap": true, | |
"rh": 0, | |
"inputs": 0, | |
"x": 120, | |
"y": 300, | |
"wires": [ | |
[ | |
"44b9e02a0dfa8c44", | |
"fa4d7b71e9ab69eb" | |
] | |
] | |
}, | |
{ | |
"id": "57998534d0ca3d80", | |
"type": "mqtt out", | |
"z": "426169ba36026cef", | |
"name": "", | |
"topic": "test/one", | |
"qos": "", | |
"retain": "", | |
"respTopic": "", | |
"contentType": "", | |
"userProps": "", | |
"correl": "", | |
"expiry": "", | |
"broker": "aac991e8d61de49a", | |
"x": 520, | |
"y": 160, | |
"wires": [] | |
}, | |
{ | |
"id": "39468f6bb7315779", | |
"type": "kafkajs-producer", | |
"z": "426169ba36026cef", | |
"name": "test", | |
"client": "90767895dcb3e60b", | |
"topic": "bla", | |
"advancedoptions": false, | |
"acknowledge": "all", | |
"partition": "", | |
"headeritems": {}, | |
"key": "", | |
"responsetimeout": 30000, | |
"transactiontimeout": 60000, | |
"metadatamaxage": 300000, | |
"allowautotopiccreation": false, | |
"x": 510, | |
"y": 320, | |
"wires": [] | |
}, | |
{ | |
"id": "a31befe8a4c8aa0f", | |
"type": "kafkajs-consumer", | |
"z": "426169ba36026cef", | |
"name": "", | |
"client": "90767895dcb3e60b", | |
"groupid": "nodered01dbg", | |
"topic": "bla", | |
"advancedoptions": false, | |
"autocommitinterval": 5000, | |
"autocommitthreshold": 100, | |
"sessiontimeout": 30000, | |
"rebalancetimeout": 60000, | |
"heartbeatinterval": 3000, | |
"metadatamaxage": 300000, | |
"maxbytesperpartition": 1048576, | |
"minbytes": 1, | |
"maxbytes": 10485760, | |
"maxwaittimeinms": 5000, | |
"frombeginning": false, | |
"clearoffsets": false, | |
"allowautotopiccreation": false, | |
"x": 130, | |
"y": 420, | |
"wires": [ | |
[ | |
"c8c5d42ab228b2e1" | |
] | |
] | |
}, | |
{ | |
"id": "c8c5d42ab228b2e1", | |
"type": "debug", | |
"z": "426169ba36026cef", | |
"name": "debug 3", | |
"active": true, | |
"tosidebar": true, | |
"console": false, | |
"tostatus": false, | |
"complete": "false", | |
"statusVal": "", | |
"statusType": "auto", | |
"x": 520, | |
"y": 420, | |
"wires": [] | |
}, | |
{ | |
"id": "fa4d7b71e9ab69eb", | |
"type": "json", | |
"z": "426169ba36026cef", | |
"name": "", | |
"property": "payload", | |
"action": "str", | |
"pretty": false, | |
"x": 370, | |
"y": 320, | |
"wires": [ | |
[ | |
"39468f6bb7315779" | |
] | |
] | |
}, | |
{ | |
"id": "4c98c9faf0d2c5cc", | |
"type": "mqtt-broker", | |
"name": "", | |
"broker": "localhost", | |
"port": "1883", | |
"clientid": "nodered1", | |
"autoConnect": true, | |
"usetls": false, | |
"protocolVersion": "4", | |
"keepalive": "60", | |
"cleansession": true, | |
"autoUnsubscribe": true, | |
"birthTopic": "", | |
"birthQos": "0", | |
"birthRetain": "false", | |
"birthPayload": "", | |
"birthMsg": {}, | |
"closeTopic": "", | |
"closeQos": "0", | |
"closeRetain": "false", | |
"closePayload": "", | |
"closeMsg": {}, | |
"willTopic": "", | |
"willQos": "0", | |
"willRetain": "false", | |
"willPayload": "", | |
"willMsg": {}, | |
"userProps": "", | |
"sessionExpiry": "" | |
}, | |
{ | |
"id": "aac991e8d61de49a", | |
"type": "mqtt-broker", | |
"name": "", | |
"broker": "a21mq687wwyf8l-ats.iot.eu-central-1.amazonaws.com", | |
"port": "8883", | |
"tls": "b0b22f022f6359d5", | |
"clientid": "test", | |
"autoConnect": true, | |
"usetls": true, | |
"protocolVersion": "5", | |
"keepalive": "60", | |
"cleansession": true, | |
"autoUnsubscribe": true, | |
"birthTopic": "", | |
"birthQos": "0", | |
"birthRetain": "false", | |
"birthPayload": "", | |
"birthMsg": {}, | |
"closeTopic": "", | |
"closeQos": "0", | |
"closeRetain": "false", | |
"closePayload": "", | |
"closeMsg": {}, | |
"willTopic": "", | |
"willQos": "0", | |
"willRetain": "false", | |
"willPayload": "", | |
"willMsg": {}, | |
"userProps": "", | |
"sessionExpiry": "" | |
}, | |
{ | |
"id": "90767895dcb3e60b", | |
"type": "kafkajs-client", | |
"name": "localhost", | |
"brokers": "localhost:9092", | |
"clientid": "nodered01", | |
"connectiontimeout": "3000", | |
"requesttimeout": "25000", | |
"advancedretry": false, | |
"maxretrytime": "30000", | |
"initialretrytime": "300", | |
"factor": "0.2", | |
"multiplier": "2", | |
"retries": "5", | |
"auth": "none", | |
"tlsselfsign": false, | |
"tlscacert": "", | |
"tlsclientcert": "", | |
"tlsprivatekey": "", | |
"tlspassphrase": "", | |
"saslssl": true, | |
"saslmechanism": "plain", | |
"loglevel": "error" | |
}, | |
{ | |
"id": "b0b22f022f6359d5", | |
"type": "tls-config", | |
"name": "", | |
"cert": "/Users/sebastianrothbucher/Downloads/f0aa72369dcd131aede19e79624b56a3be94f04f32ab4d0e3c11bb81f3b6f21e-certificate.pem.crt", | |
"key": "/Users/sebastianrothbucher/Downloads/f0aa72369dcd131aede19e79624b56a3be94f04f32ab4d0e3c11bb81f3b6f21e-private.pem.key", | |
"ca": "/Users/sebastianrothbucher/Downloads/AmazonRootCA1.pem", | |
"certname": "f0aa72369dcd131aede19e79624b56a3be94f04f32ab4d0e3c11bb81f3b6f21e-public.pem.key", | |
"keyname": "f0aa72369dcd131aede19e79624b56a3be94f04f32ab4d0e3c11bb81f3b6f21e-private.pem.key", | |
"caname": "AmazonRootCA1.pem", | |
"servername": "", | |
"verifyservercert": true, | |
"alpnprotocol": "" | |
} | |
] |
This file contains hidden or 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
{ | |
"Version": "2012-10-17", | |
"Statement": [ | |
{ | |
"Effect": "Allow", | |
"Action": [ | |
"iot:Publish", | |
"iot:Receive", | |
"iot:RetainPublish" | |
], | |
"Resource": "arn:aws:iot:eu-central-1:525869301127:topic/test/one" | |
}, | |
{ | |
"Effect": "Allow", | |
"Action": "iot:Subscribe", | |
"Resource": "arn:aws:iot:eu-central-1:525869301127:topicfilter/test/one" | |
}, | |
{ | |
"Effect": "Allow", | |
"Action": "iot:Connect", | |
"Resource": [ | |
"arn:aws:iot:eu-central-1:525869301127:client/test", | |
"arn:aws:iot:eu-central-1:525869301127:client/testcli" | |
] | |
} | |
] | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment