Connecting Raspberry Pi with OpenRemote (localhost)

Hi, I have two devices: a Raspberry Pi (IP: 192.168.0.108) and a MacBook (192.168.0.52, localhost). On my MacBook there runs OpenRemote on localhost and on my Raspberry Pi I have a DHT22 sensor connected, which measures temperature and humidity. Now I want to publish these values to my OR plattform on the MacBook. My python-script looks like the following:

import paho.mqtt.client as mqtt
import Adafruit_DHT
import time


# Set up DHT22 sensor
dht_sensor = Adafruit_DHT.DHT22
dht_pin = 4  # Replace with the GPIO pin number that the sensor is connected to


username = 'ewg:mqttuser2'
secret = 'I8KY0e339HTejA3V611PRTA69zfi4mOC'
host = '192.168.0.52'
port = 8883
clientID = 'client456'
assetID = '5WMeImEqR3CDpR90Ltd2Qv'
attribute = 'humidity'


def on_connect(client, userdata, flags, rc):
    if rc == 0:
        print("Connected to broker")
    else:
        print("Connection failed")


def on_publish(client, userdata, result):
    print("Data published \n")
    print(humidity)  # test if humidity is correct
    pass


clientMQTT = mqtt.Client(clientID)
clientMQTT.username_pw_set(username, password=secret)
clientMQTT.on_connect = on_connect
clientMQTT.on_publish = on_publish
clientMQTT.connect(host, port=port)

# Continuously read and send temperature values
while True:
    humidity, temperature = Adafruit_DHT.read_retry(dht_sensor, dht_pin)
    if humidity is not None and temperature is not None:
        humidity = int(humidity)
        clientMQTT.publish(f"ewg/{clientID}/writeattributevalue/{attribute}/{assetID}", humidity)
    else:
        print("Failed to read temperature sensor data")
    time.sleep(5)

clientMQTT.disconnect()

The script is running, so no error message appears, but no values are arriving at my MacBook. Does someone has an idea what could be the problem? I have a service user created and also an asset with the attributes ‘temperature’ and ‘humidity’ (both of kind Number).