Error while send data from Paho

Hi ,
I setup openremote on IDE. I have succesfully tested data communicating from MQTT Exoplorer to openremote. Here I use unsecure communication with 1883 poprt(Mqtt Explorer TLS =OFF, SSL =OFF).

Now I tried to send data from Pythone code Paho to openremote but it give some error.

import paho.mqtt.client as mqtt
import time
import certifi
import ssl
import json
import requests
from requests import *

def on_connect(client, userdata, flags, rc):
if rc == 0:
print(“Connected to broker”)
global Connected # Use global variable
Connected = True # Signal connection
print(“Connection failed”)

def on_publish(client, userdata, result):
print(f’Data published. Data: {attribute_value}')

def on_message(client, userdata, message):
msg = json.loads(message.payload.decode(“utf-8”))
id = msg[“attributeState”][“ref”][“id”]
att_name = msg[“attributeState”][“ref”][“name”]
att_value = msg[“attributeState”][“value”]
print(f’Message received. Asset ID: {id}. Attribute name: {att_name}. Attribute value: {att_value}')

Connected = False
username = “master:mqttuser”
secret = “Q3XdkI47UzePlgQGyIxGGuSsbHfni26s”
host = “”
port = 1883
clientID = ‘client12345’
assetID = ‘585TvXai66JeXi07w1LZVK’
attributeWr = ‘writeAttribute’
attributeRd = ‘subscribeAttribute’

clientMQTT = mqtt.Client(clientID)
clientMQTT.username_pw_set(username, password=secret)

the key steps here

context = ssl.SSLContext(ssl.PROTOCOL_TLSv1_2)

if you do not want to check the cert hostname, skip it

context.check_hostname = False
response = requests.get(“”, verify=False)

clientMQTT.on_connect = on_connect
clientMQTT.on_publish = on_publish
clientMQTT.on_message = on_message
clientMQTT.connect(host, port=port)

while Connected != True:

attribute_value = 10
i = 0
for i in range(attribute_value):
clientMQTT.publish(f"master/{clientID}/writeattributevalue/{attributeWr}/{assetID}", i)


we have tried to off/disable TLS, SSL but we have tried that method is correct or not we have doubt.
Connection established but data not send


Best to use markup code blocks when pasting code…

Maybe you would see why data doesn’t get to the OpenRemote broker if you have no error handling on your publish call or look at the OpenRemote logs?

Obvious thing is to make sure the data you are publishing is compatible with the attribute type you are writing to.