This example connects to an MQTT broker and subscribes to the OCR result from "camera" 5 and prints out the Container Code and if the checksum is correct or not (1 or 0).

import datetime
import json
import paho.mqtt.client as mqtt

# MQTT client
client = mqtt.Client()
# Callback for when the client receives a CONNACK response from the server
def on_connect(clientuserdataflagsrc):
    if rc == 0:
        print("Connected to the broker")
        #Subscribe to OCR results        
        print("Failed to connect to the broker. Return code:"rc)
# Callback for when a message is received from the server
def on_message(clientuserdatamsg):
    # Parse the JSON object
    data = json.loads(msg.payload)

    # Extract variables from the JSON object
    container_code = data.get("result")
    confidence = data.get("confidence")
    checksum = data.get("checksum")
    # Do relevant stuff with the results
    # Eg. print results to screen, Call API, Update DB, etc.
    # Here we print to screeen
    print ("%Y-%m-%d %H:%M:%S"), container_codechecksum)

# Set up the MQTT client
client.on_connect = on_connect
client.on_message = on_message

# Connect to the MQTT broker

# Start the MQTT client loop to listen for messages