change order

This commit is contained in:
robert 2024-02-01 07:16:37 +00:00
parent 4765690f8e
commit 84a7423cb4

View File

@ -60,22 +60,7 @@ def subscribe(client: mqtt_client, topic):
client.subscribe(topic) client.subscribe(topic)
client.on_message = on_message client.on_message = on_message
def monitor(charge_point_power):
def run():
client = connect_mqtt()
house_battery_soc = subscribe(client, topic_house_battery_soc)
house_battery_power = subscribe(client, topic_house_battery_power)
power_import_export = subscribe(client, topic_power_import_export)
pv_power = subscribe(client, topic_pv_power)
house_power = subscribe(client, topic_house_power)
car_soc = subscribe(client, topic_car_soc)
charge_point_power = subscribe(client, topic_charge_point_power)
monitor(charge_point_power)
def monitor(charge_point_power)
try: try:
logging.info("epd2in13b_V3 Demo") logging.info("epd2in13b_V3 Demo")
@ -123,5 +108,18 @@ def monitor(charge_point_power)
#client.loop_forever() #client.loop_forever()
def run():
client = connect_mqtt()
house_battery_soc = subscribe(client, topic_house_battery_soc)
house_battery_power = subscribe(client, topic_house_battery_power)
power_import_export = subscribe(client, topic_power_import_export)
pv_power = subscribe(client, topic_pv_power)
house_power = subscribe(client, topic_house_power)
car_soc = subscribe(client, topic_car_soc)
charge_point_power = subscribe(client, topic_charge_point_power)
monitor(charge_point_power)
if __name__ == '__main__': if __name__ == '__main__':
run() run()