diff --git a/lib/TWCManager/Control/HTTPControl.py b/lib/TWCManager/Control/HTTPControl.py index c57f3a7e..b38b84f3 100644 --- a/lib/TWCManager/Control/HTTPControl.py +++ b/lib/TWCManager/Control/HTTPControl.py @@ -16,7 +16,7 @@ import urllib.parse import uuid -logger = logging.getLogger("\U0001F3AE HTTP") +logger = logging.getLogger("\U0001f3ae HTTP") class ThreadingSimpleServer(ThreadingMixIn, HTTPServer): diff --git a/lib/TWCManager/Control/MQTTControl.py b/lib/TWCManager/Control/MQTTControl.py index acdf04be..cbdf9605 100644 --- a/lib/TWCManager/Control/MQTTControl.py +++ b/lib/TWCManager/Control/MQTTControl.py @@ -1,6 +1,6 @@ import logging -logger = logging.getLogger("\U0001F3AE MQTT") +logger = logging.getLogger("\U0001f3ae MQTT") class MQTTControl: diff --git a/lib/TWCManager/Control/WebIPCControl.py b/lib/TWCManager/Control/WebIPCControl.py index 934961a0..fa1ea100 100644 --- a/lib/TWCManager/Control/WebIPCControl.py +++ b/lib/TWCManager/Control/WebIPCControl.py @@ -249,13 +249,13 @@ def processIPC(self): else 13 ), ) - if (twcMsg[0:2] == b"\xFC\x19") or (twcMsg[0:2] == b"\xFC\x1A"): + if (twcMsg[0:2] == b"\xfc\x19") or (twcMsg[0:2] == b"\xfc\x1a"): logger.info( "\n*** ERROR: Web interface requested sending command:\n" + self.master.hex_str(twcMsg) + "\nwhich could permanently disable the TWC. Aborting.\n" ) - elif twcMsg[0:2] == b"\xFB\xE8": + elif twcMsg[0:2] == b"\xfb\xe8": logger.info( "\n*** ERROR: Web interface requested sending command:\n" + self.master.hex_str(twcMsg) diff --git a/lib/TWCManager/EMS/DSMRreader.py b/lib/TWCManager/EMS/DSMRreader.py index 4b8e8044..ed99361b 100644 --- a/lib/TWCManager/EMS/DSMRreader.py +++ b/lib/TWCManager/EMS/DSMRreader.py @@ -1,7 +1,7 @@ import logging import json -logger = logging.getLogger("\U000026A1 DSMRread") +logger = logging.getLogger("\U000026a1 DSMRread") class DSMRreader: diff --git a/lib/TWCManager/EMS/Efergy.py b/lib/TWCManager/EMS/Efergy.py index e97e5a2e..abd19cb1 100644 --- a/lib/TWCManager/EMS/Efergy.py +++ b/lib/TWCManager/EMS/Efergy.py @@ -2,7 +2,7 @@ import time import logging -logger = logging.getLogger("\U000026A1 Efergy") +logger = logging.getLogger("\U000026a1 Efergy") class Efergy: diff --git a/lib/TWCManager/EMS/EmonCMS.py b/lib/TWCManager/EMS/EmonCMS.py index 0c86e0e0..c8f317dd 100644 --- a/lib/TWCManager/EMS/EmonCMS.py +++ b/lib/TWCManager/EMS/EmonCMS.py @@ -1,6 +1,6 @@ import logging -logger = logging.getLogger("\U000026A1 EmonCMS") +logger = logging.getLogger("\U000026a1 EmonCMS") class EmonCMS: diff --git a/lib/TWCManager/EMS/Enphase.py b/lib/TWCManager/EMS/Enphase.py index ef09c819..d2a5fba7 100644 --- a/lib/TWCManager/EMS/Enphase.py +++ b/lib/TWCManager/EMS/Enphase.py @@ -2,7 +2,7 @@ import logging import time -logger = logging.getLogger("\U000026C5 Enphase") +logger = logging.getLogger("\U000026c5 Enphase") class Enphase: diff --git a/lib/TWCManager/EMS/Fronius.py b/lib/TWCManager/EMS/Fronius.py index ef305307..0dd54e5a 100644 --- a/lib/TWCManager/EMS/Fronius.py +++ b/lib/TWCManager/EMS/Fronius.py @@ -3,7 +3,7 @@ import requests import time -logger = logging.getLogger("\U000026C5 Fronius") +logger = logging.getLogger("\U000026c5 Fronius") class Fronius: diff --git a/lib/TWCManager/EMS/Growatt.py b/lib/TWCManager/EMS/Growatt.py index 58866148..fd823906 100644 --- a/lib/TWCManager/EMS/Growatt.py +++ b/lib/TWCManager/EMS/Growatt.py @@ -3,7 +3,7 @@ import datetime -logger = logging.getLogger("\U000026C5 Growatt") +logger = logging.getLogger("\U000026c5 Growatt") class Growatt: diff --git a/lib/TWCManager/EMS/HASS.py b/lib/TWCManager/EMS/HASS.py index 2707c46a..d0ec3a93 100644 --- a/lib/TWCManager/EMS/HASS.py +++ b/lib/TWCManager/EMS/HASS.py @@ -1,6 +1,6 @@ import logging -logger = logging.getLogger("\U000026A1 HASS") +logger = logging.getLogger("\U000026a1 HASS") class HASS: diff --git a/lib/TWCManager/EMS/IotaWatt.py b/lib/TWCManager/EMS/IotaWatt.py index e1747b19..bcf4ecf8 100644 --- a/lib/TWCManager/EMS/IotaWatt.py +++ b/lib/TWCManager/EMS/IotaWatt.py @@ -1,6 +1,6 @@ import logging -logger = logging.getLogger("\U000026C5 IotaWatt") +logger = logging.getLogger("\U000026c5 IotaWatt") class IotaWatt: diff --git a/lib/TWCManager/EMS/Kostal.py b/lib/TWCManager/EMS/Kostal.py index 4ba5a229..ae972b4b 100644 --- a/lib/TWCManager/EMS/Kostal.py +++ b/lib/TWCManager/EMS/Kostal.py @@ -22,7 +22,7 @@ ENDIAN_BIG = 0x01 # big endian (ABCD) Sunspec ENDIAN_LITTLE = 0x00 # little endian (CDAB) Standard Modbus -logger = logging.getLogger("\U000026C5 Kostal") +logger = logging.getLogger("\U000026c5 Kostal") # diff --git a/lib/TWCManager/EMS/MQTT.py b/lib/TWCManager/EMS/MQTT.py index 29bf1fae..b9690a76 100644 --- a/lib/TWCManager/EMS/MQTT.py +++ b/lib/TWCManager/EMS/MQTT.py @@ -1,6 +1,6 @@ import logging -logger = logging.getLogger("\U000026A1 MQTT") +logger = logging.getLogger("\U000026a1 MQTT") class MQTT: diff --git a/lib/TWCManager/EMS/OpenHab.py b/lib/TWCManager/EMS/OpenHab.py index 349cc408..88ee52b0 100644 --- a/lib/TWCManager/EMS/OpenHab.py +++ b/lib/TWCManager/EMS/OpenHab.py @@ -2,7 +2,7 @@ import requests import time -logger = logging.getLogger("\U000026A1 OpenHab") +logger = logging.getLogger("\U000026a1 OpenHab") class OpenHab: diff --git a/lib/TWCManager/EMS/OpenWeatherMap.py b/lib/TWCManager/EMS/OpenWeatherMap.py index 0e709880..ad87b9f1 100644 --- a/lib/TWCManager/EMS/OpenWeatherMap.py +++ b/lib/TWCManager/EMS/OpenWeatherMap.py @@ -3,7 +3,7 @@ import requests import time -logger = logging.getLogger("\U000026C5 OpenWthr") +logger = logging.getLogger("\U000026c5 OpenWthr") class OpenWeatherMap: diff --git a/lib/TWCManager/EMS/P1Monitor.py b/lib/TWCManager/EMS/P1Monitor.py index 0e1a012d..24c0166a 100644 --- a/lib/TWCManager/EMS/P1Monitor.py +++ b/lib/TWCManager/EMS/P1Monitor.py @@ -8,7 +8,7 @@ import scipy.stats import json -logger = logging.getLogger("\U000026A1 P1Monitr") +logger = logging.getLogger("\U000026a1 P1Monitr") class P1Monitor: diff --git a/lib/TWCManager/EMS/SmartMe.py b/lib/TWCManager/EMS/SmartMe.py index a3f35c10..c3db8192 100644 --- a/lib/TWCManager/EMS/SmartMe.py +++ b/lib/TWCManager/EMS/SmartMe.py @@ -1,6 +1,6 @@ import logging -logger = logging.getLogger("\U000026A1 SmartMe") +logger = logging.getLogger("\U000026a1 SmartMe") class SmartMe: diff --git a/lib/TWCManager/EMS/SmartPi.py b/lib/TWCManager/EMS/SmartPi.py index adb212b2..8cfde203 100644 --- a/lib/TWCManager/EMS/SmartPi.py +++ b/lib/TWCManager/EMS/SmartPi.py @@ -2,7 +2,7 @@ import requests import time -logger = logging.getLogger("\U000026A1 SmartPi") +logger = logging.getLogger("\U000026a1 SmartPi") class SmartPi: diff --git a/lib/TWCManager/EMS/SolarEdge.py b/lib/TWCManager/EMS/SolarEdge.py index 457fee6b..6ffa346a 100644 --- a/lib/TWCManager/EMS/SolarEdge.py +++ b/lib/TWCManager/EMS/SolarEdge.py @@ -3,7 +3,7 @@ import time import solaredge_modbus -logger = logging.getLogger("\U000026C5 SolarEdg") +logger = logging.getLogger("\U000026c5 SolarEdg") class SolarEdge: diff --git a/lib/TWCManager/EMS/SolarLog.py b/lib/TWCManager/EMS/SolarLog.py index 0a83538a..582aaa71 100644 --- a/lib/TWCManager/EMS/SolarLog.py +++ b/lib/TWCManager/EMS/SolarLog.py @@ -1,7 +1,7 @@ import logging import time -logger = logging.getLogger("\U000026C5 SolarLog") +logger = logging.getLogger("\U000026c5 SolarLog") class SolarLog: diff --git a/lib/TWCManager/EMS/TED.py b/lib/TWCManager/EMS/TED.py index 1b436b44..faf3be4c 100644 --- a/lib/TWCManager/EMS/TED.py +++ b/lib/TWCManager/EMS/TED.py @@ -5,7 +5,7 @@ import time -logger = logging.getLogger("\U000026C5 TED") +logger = logging.getLogger("\U000026c5 TED") class TED: diff --git a/lib/TWCManager/EMS/TeslaPowerwall2.py b/lib/TWCManager/EMS/TeslaPowerwall2.py index e669391c..dce96d8e 100644 --- a/lib/TWCManager/EMS/TeslaPowerwall2.py +++ b/lib/TWCManager/EMS/TeslaPowerwall2.py @@ -2,7 +2,7 @@ import logging import time -logger = logging.getLogger("\U000026C5 TeslaPwl") +logger = logging.getLogger("\U000026c5 TeslaPwl") class TeslaPowerwall2: diff --git a/lib/TWCManager/EMS/URL.py b/lib/TWCManager/EMS/URL.py index 24560170..2a7edea6 100644 --- a/lib/TWCManager/EMS/URL.py +++ b/lib/TWCManager/EMS/URL.py @@ -2,7 +2,7 @@ import requests import time -logger = logging.getLogger("\U000026A1 URL") +logger = logging.getLogger("\U000026a1 URL") class URL: diff --git a/lib/TWCManager/EMS/Volkszahler.py b/lib/TWCManager/EMS/Volkszahler.py index ab13fcca..c37090f2 100644 --- a/lib/TWCManager/EMS/Volkszahler.py +++ b/lib/TWCManager/EMS/Volkszahler.py @@ -3,7 +3,7 @@ import time import re -logger = logging.getLogger("\U000026C5 Volkszlr") +logger = logging.getLogger("\U000026c5 Volkszlr") class Volkszahler: diff --git a/lib/TWCManager/Interface/Dummy.py b/lib/TWCManager/Interface/Dummy.py index 1610d2f9..fb25a987 100644 --- a/lib/TWCManager/Interface/Dummy.py +++ b/lib/TWCManager/Interface/Dummy.py @@ -55,7 +55,7 @@ def send(self, msg): "Command": "SlaveLinkready", "SenderID": self.twcID, "Sign": self.master.getSlaveSign(), - "Amps": bytearray(b"\x1F\x40"), + "Amps": bytearray(b"\x1f\x40"), } ) ) diff --git a/lib/TWCManager/Interface/RS485.py b/lib/TWCManager/Interface/RS485.py index 51b1227f..91265437 100644 --- a/lib/TWCManager/Interface/RS485.py +++ b/lib/TWCManager/Interface/RS485.py @@ -1,7 +1,7 @@ import logging import time -logger = logging.getLogger("\U0001F50C RS485") +logger = logging.getLogger("\U0001f50c RS485") class RS485: diff --git a/lib/TWCManager/Policy/Policy.py b/lib/TWCManager/Policy/Policy.py index 67e6dc44..c5d15c7e 100644 --- a/lib/TWCManager/Policy/Policy.py +++ b/lib/TWCManager/Policy/Policy.py @@ -2,7 +2,7 @@ import time -logger = logging.getLogger("\u26FD Policy") +logger = logging.getLogger("\u26fd Policy") class Policy: diff --git a/lib/TWCManager/Protocol/TWCProtocol.py b/lib/TWCManager/Protocol/TWCProtocol.py index dc110954..ba244717 100644 --- a/lib/TWCManager/Protocol/TWCProtocol.py +++ b/lib/TWCManager/Protocol/TWCProtocol.py @@ -65,7 +65,7 @@ def createMessage(self, packet): elif packet["Command"] == "GetFirmwareVersion": msg = ( - bytearray(b"\xFB\x1B") + bytearray(b"\xfb\x1b") + packet["SenderID"] + packet["RecieverID"] + bytearray(b"\x00\x00\xa0\x00\x00\x00\x00") @@ -77,7 +77,7 @@ def createMessage(self, packet): elif packet["Command"] == "SlaveHeartbeat": msg = ( - bytearray(b"\xFD\xE0") + bytearray(b"\xfd\xe0") + packet["SenderID"] + packet["RecieverID"] + bytearray(b"\x00\x00\xa0\x00\x00\x00\x00") @@ -89,7 +89,7 @@ def createMessage(self, packet): elif packet["Command"] == "SlaveLinkready": msg = ( - bytearray(b"\xFD\xE2") + bytearray(b"\xfd\xe2") + packet["SenderID"] + packet["Sign"] + packet["Amps"] diff --git a/lib/TWCManager/Status/HASSStatus.py b/lib/TWCManager/Status/HASSStatus.py index 7da5dbb8..ca346753 100644 --- a/lib/TWCManager/Status/HASSStatus.py +++ b/lib/TWCManager/Status/HASSStatus.py @@ -5,7 +5,7 @@ import time -logger = logging.getLogger("\U0001F4CA HASS") +logger = logging.getLogger("\U0001f4ca HASS") class HASSStatus: diff --git a/lib/TWCManager/Status/MQTTStatus.py b/lib/TWCManager/Status/MQTTStatus.py index 9a2633a5..878d8727 100644 --- a/lib/TWCManager/Status/MQTTStatus.py +++ b/lib/TWCManager/Status/MQTTStatus.py @@ -5,7 +5,7 @@ import time -logger = logging.getLogger("\U0001F4CA MQTT") +logger = logging.getLogger("\U0001f4ca MQTT") class MQTTStatus: diff --git a/lib/TWCManager/TWCManager.py b/lib/TWCManager/TWCManager.py index e1f5c5ef..1278b95f 100755 --- a/lib/TWCManager/TWCManager.py +++ b/lib/TWCManager/TWCManager.py @@ -63,7 +63,7 @@ logging.DEBUG2 = 9 -logger = logging.getLogger("\u26FD Manager") +logger = logging.getLogger("\u26fd Manager") # Define available modules for the instantiator # All listed modules will be loaded at boot time @@ -928,14 +928,14 @@ def update_sunrise_sunset(): # voltage/kWh report. if ( master.lastTWCResponseMsg == b"" - and msg[0:2] != b"\xFB\xE0" - and msg[0:2] != b"\xFD\xE0" - and msg[0:2] != b"\xFC\xE1" - and msg[0:2] != b"\xFB\xE2" - and msg[0:2] != b"\xFD\xE2" - and msg[0:2] != b"\xFB\xEB" - and msg[0:2] != b"\xFD\xEB" - and msg[0:2] != b"\xFD\xE0" + and msg[0:2] != b"\xfb\xe0" + and msg[0:2] != b"\xfd\xe0" + and msg[0:2] != b"\xfc\xe1" + and msg[0:2] != b"\xfb\xe2" + and msg[0:2] != b"\xfd\xe2" + and msg[0:2] != b"\xfb\xeb" + and msg[0:2] != b"\xfd\xeb" + and msg[0:2] != b"\xfd\xe0" ): master.lastTWCResponseMsg = msg @@ -1720,10 +1720,10 @@ def update_sunrise_sunset(): ) ) master.getInterfaceModule().send( - bytearray(b"\xFD\xEB") + bytearray(b"\xfd\xeb") + fakeTWCID + kWhPacked - + bytearray(b"\x00\xF0\x00\x00\x00\x00\x00") + + bytearray(b"\x00\xf0\x00\x00\x00\x00\x00") ) else: msgMatch = re.search( diff --git a/lib/TWCManager/TWCMaster.py b/lib/TWCManager/TWCMaster.py index ed90503f..02adaa64 100644 --- a/lib/TWCManager/TWCMaster.py +++ b/lib/TWCManager/TWCMaster.py @@ -14,7 +14,7 @@ import requests import bisect -logger = logging.getLogger("\u26FD Master") +logger = logging.getLogger("\u26fd Master") class TWCMaster: @@ -439,7 +439,7 @@ def getSlaveLifetimekWh(self): if now >= self.lastkWhPoll + 60: for slaveTWC in self.getSlaveTWCs(): self.getInterfaceModule().send( - bytearray(b"\xFB\xEB") + bytearray(b"\xfb\xeb") + self.TWCID + slaveTWC.TWCID + bytearray(b"\x00\x00\x00\x00\x00\x00\x00\x00") @@ -545,11 +545,11 @@ def getTWCbyVIN(self, vin): def getVehicleVIN(self, slaveID, part): prefixByte = None if int(part) == 0: - prefixByte = bytearray(b"\xFB\xEE") + prefixByte = bytearray(b"\xfb\xee") if int(part) == 1: - prefixByte = bytearray(b"\xFB\xEF") + prefixByte = bytearray(b"\xfb\xef") if int(part) == 2: - prefixByte = bytearray(b"\xFB\xF1") + prefixByte = bytearray(b"\xfb\xf1") if prefixByte: self.getInterfaceModule().send( @@ -1245,7 +1245,7 @@ def send_master_linkready1(self): # linkready1/2 and if a master sees slave linkready, it will start sending # the slave master heartbeat once per second and the two are then connected. self.getInterfaceModule().send( - bytearray(b"\xFC\xE1") + bytearray(b"\xfc\xe1") + self.TWCID + self.masterSign + bytearray(b"\x00\x00\x00\x00\x00\x00\x00\x00") @@ -1271,7 +1271,7 @@ def send_master_linkready2(self): # no longer sends the global linkready2 message (or if it does, # they're quite rare so I haven't seen them). self.getInterfaceModule().send( - bytearray(b"\xFB\xE2") + bytearray(b"\xfb\xe2") + self.TWCID + self.masterSign + bytearray(b"\x00\x00\x00\x00\x00\x00\x00\x00") @@ -1287,10 +1287,10 @@ def send_slave_linkready(self): # LED on. Manual says this means "The networked Wall Connectors have # different maximum current capabilities". msg = ( - bytearray(b"\xFD\xE2") + bytearray(b"\xfd\xe2") + self.TWCID + self.slaveSign - + bytearray(b"\x1F\x40\x00\x00\x00\x00\x00\x00") + + bytearray(b"\x1f\x40\x00\x00\x00\x00\x00\x00") ) if self.protocolVersion == 2: msg += bytearray(b"\x00\x00") @@ -1301,7 +1301,7 @@ def sendStartCommand(self): # This function will loop through each of the Slave TWCs, and send them the start command. for slaveTWC in self.getSlaveTWCs(): self.getInterfaceModule().send( - bytearray(b"\xFC\xB1") + bytearray(b"\xfc\xb1") + self.TWCID + slaveTWC.TWCID + bytearray(b"\x00\x00\x00\x00\x00\x00\x00\x00\x00") @@ -1313,7 +1313,7 @@ def sendStopCommand(self, subTWC=None): for slaveTWC in self.getSlaveTWCs(): if (not subTWC) or (subTWC == slaveTWC.TWCID): self.getInterfaceModule().send( - bytearray(b"\xFC\xB2") + bytearray(b"\xfc\xb2") + self.TWCID + slaveTWC.TWCID + bytearray(b"\x00\x00\x00\x00\x00\x00\x00\x00\x00") diff --git a/lib/TWCManager/TWCSlave.py b/lib/TWCManager/TWCSlave.py index 97734194..30d490e0 100644 --- a/lib/TWCManager/TWCSlave.py +++ b/lib/TWCManager/TWCSlave.py @@ -4,7 +4,7 @@ import time -logger = logging.getLogger("\u26FD Slave") +logger = logging.getLogger("\u26fd Slave") class TWCSlave: @@ -322,7 +322,7 @@ def send_slave_heartbeat(self, masterID): self.master.slaveHeartbeatData.append(0x00) self.master.getModulesByType("Interface")[0]["ref"].send( - bytearray(b"\xFD\xE0") + bytearray(b"\xfd\xe0") + self.master.getFakeTWCID() + bytearray(masterID) + bytearray(self.master.slaveHeartbeatData) @@ -545,7 +545,7 @@ def send_master_heartbeat(self): self.master.startCarsCharging() self.master.getModulesByType("Interface")[0]["ref"].send( - bytearray(b"\xFB\xE0") + bytearray(b"\xfb\xe0") + self.master.getFakeTWCID() + bytearray(self.TWCID) + bytearray(self.masterHeartbeatData) diff --git a/lib/TWCManager/Vehicle/TeslaAPI.py b/lib/TWCManager/Vehicle/TeslaAPI.py index 9cc89a92..1b61d289 100644 --- a/lib/TWCManager/Vehicle/TeslaAPI.py +++ b/lib/TWCManager/Vehicle/TeslaAPI.py @@ -10,7 +10,7 @@ from urllib.parse import parse_qs import jwt -logger = logging.getLogger("\U0001F697 TeslaAPI") +logger = logging.getLogger("\U0001f697 TeslaAPI") class TeslaAPI: diff --git a/lib/TWCManager/Vehicle/TeslaBLE.py b/lib/TWCManager/Vehicle/TeslaBLE.py index 423560f4..fbd9199d 100644 --- a/lib/TWCManager/Vehicle/TeslaBLE.py +++ b/lib/TWCManager/Vehicle/TeslaBLE.py @@ -10,7 +10,7 @@ from threading import Timer import time -logger = logging.getLogger("\U0001F697 TeslaBLE") +logger = logging.getLogger("\U0001f697 TeslaBLE") class TeslaBLE: diff --git a/lib/TWCManager/Vehicle/TeslaMateVehicle.py b/lib/TWCManager/Vehicle/TeslaMateVehicle.py index f60da9bc..b27db904 100644 --- a/lib/TWCManager/Vehicle/TeslaMateVehicle.py +++ b/lib/TWCManager/Vehicle/TeslaMateVehicle.py @@ -5,7 +5,7 @@ import threading import time -logger = logging.getLogger("\U0001F697 TeslaMate") +logger = logging.getLogger("\U0001f697 TeslaMate") class TeslaMateVehicle: