change mqtt import

This commit is contained in:
robert 2024-01-31 23:13:14 +00:00
parent 737b12cf3b
commit d0928855d1

View File

@ -14,7 +14,8 @@ from PIL import Image,ImageDraw,ImageFont
import traceback import traceback
# Import MQTT client. # Import MQTT client.
import paho.mqtt.client as paho from paho.mqtt import client as mqtt_client
logging.basicConfig(level=logging.DEBUG) logging.basicConfig(level=logging.DEBUG)
@ -25,7 +26,7 @@ client_id = 'solarmonitor' # unique client_id
mqtt_broker = "openwb-2" # broker address, usually your HASS IP address mqtt_broker = "openwb-2" # broker address, usually your HASS IP address
# create the MQTT client # create the MQTT client
client = paho.Client(client_id, protocol=paho.MQTTv31) # * set a random string (max 23 chars) client = mqtt_client.Client(client_id, protocol=mqtt_client.MQTTv31) # * set a random string (max 23 chars)
# client connection # client connection
# client.username_pw_set(mqtt_username, mqtt_password) # MQTT server credentials # client.username_pw_set(mqtt_username, mqtt_password) # MQTT server credentials