This repository contains a bidirectional UDP to MQTT bridge. It seamlessly translates data between UDP packets and MQTT messages, enabling interoperability between UDP and MQTT-based systems.
flowchart TD
Pruefstand --Signals--> AVL/Intime
AVL/Intime --UDP--> BridgePruefstand
BridgePruefstand --MQTT(topic/pruefstand-out)--> AWS
AWS --MQTT(topic/simulator-in)--> BridgeSimulator
BridgeSimulator --UDP--> ViGrade
ViGrade --Signals--> Simulator
Simulator--Signals--> ViGrade
ViGrade --UDP--> BridgeSimulator
BridgeSimulator --MQTT(topic/simulator-out)--> AWS
AWS --MQTT(topic/pruefstand-in)--> BridgePruefstand
BridgePruefstand --UDP--> AVL/Intime
AVL/Intime --Signals--> Pruefstand
AVL-->Intime; Intime-->BridgePruefstand; BridgePruefstand-->AWS; AWS-->BridgeSimulator; BridgeSimulator-->Simulator; Simulator-->BridgeSimulator; BridgeSimulator-->AWS; AWS-->BridgePruefstand; BridgePruefstand-->Intime; Intime-->AVL; AVL-->Pruefstand;
-
Create a new IoT thing:
aws iot create-thing --thing-name your-thing-name
Replace
your-thing-namewith the desired name for your IoT thing.
-
Retrieve the AWS IoT endpoint:
aws iot describe-endpoint --endpoint-type iot:Data-ATS
This command will return the endpoint URL that your IoT device will use to communicate with AWS IoT.
-
Create a new certificate and keys:
aws iot create-keys-and-certificate --set-as-active --certificate-pem-outfile cert.pem --public-key-outfile public.key --private-key-outfile private.key
This command will generate a certificate and keys, and save them to
cert.pem,public.key, andprivate.keyrespectively. -
Attach the certificate to your IoT thing:
aws iot attach-thing-principal --thing-name your-thing-name --principal arn:aws:iot:region:account-id:cert/certificate-id
Replace
your-thing-namewith the name of your IoT thing, andarn:aws:iot:region:account-id:cert/certificate-idwith the ARN of the certificate created in the previous step.
-
Create an IoT policy (if you don't have one already):
aws iot create-policy --policy-name your-policy-name --policy-document file://policy.json
Replace
your-policy-namewith the desired name for your policy, and ensurepolicy.jsoncontains the appropriate policy document. -
Attach the policy to the certificate:
aws iot attach-policy --policy-name your-policy-name --target arn:aws:iot:region:account-id:cert/certificate-id
Replace
your-policy-namewith the name of your policy, andarn:aws:iot:region:account-id:cert/certificate-idwith the ARN of the certificate.
-
Download the Amazon Root CA certificate:
wget https://www.amazontrust.com/repository/AmazonRootCA1.pem
-
Copy all the certificates and keys to the
config/certsdirectory in the project root. -
Rename the certificates and keys as follows or change configuration in
config.yaml:cert.pem->certificate.pem.crtpublic.key->public.pem.keyprivate.key->private.pem.keyAmazonRootCA1.pem->root.pem
-
Update the
config.yamlfile with the appropriate certificate and key filenames.
echo "{\"specversion\":\"1.0\",\"id\":\"$(uuidgen)\",\"source\":\"https://bosch-engineering.com\",\"type\":\"com.bosch-engineering.ping\",\"datacontenttype\":\"application/json\",\"data\":{\"message\":\"ping\"}}" | socat - UDP-DATAGRAM:127.0.0.1:6000while true; do nc -u -l 6001; echo ""; done