add car chargepoint power
This commit is contained in:
parent
8c1922ed1c
commit
b7c11700d1
@ -13,16 +13,51 @@ import time
|
|||||||
from PIL import Image,ImageDraw,ImageFont
|
from PIL import Image,ImageDraw,ImageFont
|
||||||
import traceback
|
import traceback
|
||||||
|
|
||||||
|
# Import MQTT client.
|
||||||
|
import paho.mqtt.client as paho
|
||||||
|
|
||||||
logging.basicConfig(level=logging.DEBUG)
|
logging.basicConfig(level=logging.DEBUG)
|
||||||
|
|
||||||
|
# MQTT credentials
|
||||||
|
#mqtt_username = 'homeassistant' # MQTT client username
|
||||||
|
#mqtt_password = '3355' # MQTT client password
|
||||||
|
client_id = 'solarmonitor' # unique client_id
|
||||||
|
mqtt_broker = "openwb-2" # broker address, usually your HASS IP address
|
||||||
|
|
||||||
|
# create the MQTT client
|
||||||
|
client = paho.Client(client_id, protocol=paho.MQTTv31) # * set a random string (max 23 chars)
|
||||||
|
|
||||||
|
# client connection
|
||||||
|
# client.username_pw_set(mqtt_username, mqtt_password) # MQTT server credentials
|
||||||
|
client.connect(mqtt_broker, 1883, 60) # MQTT server address
|
||||||
|
|
||||||
|
topic_house_battery_soc = "openWB/bat/get/soc"
|
||||||
|
topic_house_battery_power = "openWB/bat/get/power"
|
||||||
|
|
||||||
|
topic_power_import_export = "openWB/counter/7/get/power"
|
||||||
|
topic_pv_power = "openWB/pv/8/get/power"
|
||||||
|
|
||||||
|
topic_house_power = "openWB/graph/lastlivevaluesJson" #house-power
|
||||||
|
|
||||||
|
topic_car_soc = "openWB/vehicle/4/get/soc"
|
||||||
|
topic_charge_point_power = "openWB/internal_chargepoint/0/get/powers"
|
||||||
|
|
||||||
|
|
||||||
|
house_battery_soc = client.subscribe(topic_house_battery_soc)
|
||||||
|
house_battery_power = client.subscribe(topic_house_battery_power)
|
||||||
|
power_import_export = client.subscribe(topic_power_import_export)
|
||||||
|
pv_power = client.subscribe(topic_pv_power)
|
||||||
|
house_power = client.subscribe(topic_house_power)
|
||||||
|
car_soc = client.subscribe(topic_car_soc)
|
||||||
|
charge_point_power = client.subscribe(topic_charge_point_power)
|
||||||
|
|
||||||
try:
|
try:
|
||||||
logging.info("epd2in13b_V3 Demo")
|
logging.info("epd2in13b_V3 Demo")
|
||||||
|
|
||||||
epd = epd2in13b_V3.EPD()
|
epd = epd2in13b_V3.EPD()
|
||||||
logging.info("init and Clear")
|
#logging.info("init and Clear")
|
||||||
epd.init()
|
#epd.init()
|
||||||
epd.Clear()
|
#epd.Clear()
|
||||||
time.sleep(1)
|
|
||||||
|
|
||||||
# Drawing on the image
|
# Drawing on the image
|
||||||
logging.info("Drawing")
|
logging.info("Drawing")
|
||||||
@ -40,9 +75,12 @@ try:
|
|||||||
drawblack.text((2, 32), 'Strom Import', font = font16, fill = 0)
|
drawblack.text((2, 32), 'Strom Import', font = font16, fill = 0)
|
||||||
drawblack.text((2, 48), 'Batterie', font = font16, fill = 0)
|
drawblack.text((2, 48), 'Batterie', font = font16, fill = 0)
|
||||||
drawblack.text((2, 64), 'Batterie Entladen', font = font16, fill = 0)
|
drawblack.text((2, 64), 'Batterie Entladen', font = font16, fill = 0)
|
||||||
drawblack.text((2, 80), 'Batterie Entladen', font = font16, fill = 0)
|
drawblack.text((2, 80), 'Auto Laden', font = font16, fill = 0)
|
||||||
|
|
||||||
|
drawblack.text((100, 80), charge_point_power, font = font16, fill = 0)
|
||||||
epd.display(epd.getbuffer(HBlackimage), epd.getbuffer(HRYimage))
|
epd.display(epd.getbuffer(HBlackimage), epd.getbuffer(HRYimage))
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#logging.info("Clear...")
|
#logging.info("Clear...")
|
||||||
|
Loading…
Reference in New Issue
Block a user