srne-mqtt/misc/test_load_switch.py

26 lines
729 B
Python

# -*- coding: utf-8 -*-
import os
import sys
from time import sleep
sys.path.insert(1, os.path.dirname(os.path.dirname(sys.argv[0])))
from srnemqtt.config import get_config, get_interface # noqa: E402
from srnemqtt.protocol import ChargeController # noqa: E402
if __name__ == "__main__":
conf = get_config()
iface = get_interface(conf)
cc = ChargeController(iface)
print(f"Serial: {cc.serial}")
print(f"Load enabled: {cc.load_enabled}")
cc.load_enabled = True
print(f"Load enabled: {cc.load_enabled}")
sleep(5)
cc.load_enabled = False
print(f"Load enabled: {cc.load_enabled}")
# print(f"Name: {cc.name}")
# cc.name = "☀️ 🔌🔋Charger"
# print(f"Name: {cc.name}")