change
This commit is contained in:
parent
fbb22a3572
commit
fc7d944ce0
@ -90,7 +90,7 @@ def subscribe(client: mqtt_client, topic):
|
|||||||
client.on_message = on_message
|
client.on_message = on_message
|
||||||
client.loop_stop()
|
client.loop_stop()
|
||||||
|
|
||||||
def monitor(topics):
|
def init_monitor(topics):
|
||||||
|
|
||||||
logging.info("epd2in13b_V3 Demo")
|
logging.info("epd2in13b_V3 Demo")
|
||||||
logging.info(libdir)
|
logging.info(libdir)
|
||||||
@ -119,21 +119,6 @@ def monitor(topics):
|
|||||||
drawblack.text((4, 48), 'Batterie', font = font16, fill = 0)
|
drawblack.text((4, 48), 'Batterie', font = font16, fill = 0)
|
||||||
drawblack.text((4, 64), 'Batterie Entladen', font = font16, fill = 0)
|
drawblack.text((4, 64), 'Batterie Entladen', font = font16, fill = 0)
|
||||||
drawblack.text((4, 80), 'Auto Laden', font = font16, fill = 0)
|
drawblack.text((4, 80), 'Auto Laden', font = font16, fill = 0)
|
||||||
|
|
||||||
for topic_id, topic_info in topics.items():
|
|
||||||
print("\nTopic ID:", topic_id)
|
|
||||||
|
|
||||||
for key in topic_info:
|
|
||||||
print(key + ':', topic_info[key])
|
|
||||||
print(topic_info["line"])
|
|
||||||
print(topic_info["value"])
|
|
||||||
drawblack.text((160, int(topic_info["line"])), str(topic_info["value"]), font = font16, fill = 0)
|
|
||||||
|
|
||||||
#drawblack.text((160, 16), str(house_power), font = font16, fill = 0)
|
|
||||||
#drawblack.text((160, 32), str(power_import_export), font = font16, fill = 0)
|
|
||||||
#drawblack.text((160, 48), str(house_battery_soc), font = font16, fill = 0)
|
|
||||||
#drawblack.text((160, 64), str(house_battery_power), font = font16, fill = 0)
|
|
||||||
#drawblack.text((160, 80), str(charge_point_power), font = font16, fill = 0)
|
|
||||||
|
|
||||||
epd.display(epd.getbuffer(HBlackimage), epd.getbuffer(HRYimage))
|
epd.display(epd.getbuffer(HBlackimage), epd.getbuffer(HRYimage))
|
||||||
|
|
||||||
@ -156,17 +141,8 @@ def monitor(topics):
|
|||||||
|
|
||||||
|
|
||||||
def run():
|
def run():
|
||||||
client = connect_mqtt()
|
|
||||||
|
|
||||||
for topic_id, topic_info in topics.items():
|
|
||||||
print("\nTopic ID:", topic_id)
|
|
||||||
|
|
||||||
for key in topic_info:
|
|
||||||
print(key + ':', topic_info[key])
|
|
||||||
topic_info["value"] = subscribe(client, topic_info["topic"])
|
|
||||||
|
|
||||||
try:
|
try:
|
||||||
monitor(topics)
|
init_monitor(topics)
|
||||||
|
|
||||||
except IOError as e:
|
except IOError as e:
|
||||||
logging.info(e)
|
logging.info(e)
|
||||||
@ -175,7 +151,20 @@ def run():
|
|||||||
logging.info("ctrl + c:")
|
logging.info("ctrl + c:")
|
||||||
epd2in13b_V3.epdconfig.module_exit()
|
epd2in13b_V3.epdconfig.module_exit()
|
||||||
exit()
|
exit()
|
||||||
|
|
||||||
|
client = connect_mqtt()
|
||||||
|
|
||||||
|
for topic_id, topic_info in topics.items():
|
||||||
|
print("\nTopic ID:", topic_id)
|
||||||
|
|
||||||
|
for key in topic_info:
|
||||||
|
print(key + ':', topic_info[key])
|
||||||
|
topic_info["value"] = subscribe(client, topic_info["topic"])
|
||||||
|
print(topic_info["line"])
|
||||||
|
print(topic_info["value"])
|
||||||
|
drawblack.text((160, int(topic_info["line"])), str(topic_info["value"]), font = font16, fill = 0)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
run()
|
run()
|
Loading…
Reference in New Issue
Block a user