TWCManager
TWCManager copied to clipboard
'twc_xxxx_state' reverts to value 0
I use the MQTT output 'twc_xxxx_state' to control some home automations. Unfortunately, the Raspberry Pi and/or the TWCManager instance goes to sleep after a period of time. The value 0 is sent until the car is woken with a Start Charge command. This means the car is registered as unplugged, even though it is connected.
What part of the TWCManager code causes the 0 state or the sleep routine? Is there a way to maintain the last status value in the event of the car going to sleep?
I've ascertained the following values for 'twc_xxxx_state' -
0 = Unplugged 1 = Charging 3 = Stopped or No Power 4 = Stopped? 8 = Starting 9 = Plugged in
Are there any other values listed somewhere I should be aware of?
Assuming this is actually the value reported by the TWC, 9 is actually “changing power level” and 1 is “maintaining previous power level and charging.” When TWCManager tells it to change what it offers, it sends 9 until the car responds, then returns to 1. From the TWC’s perspective, there’s no difference between being unplugged and having a sleeping car on the other side, unfortunately. You’d need to be monitoring the vehicle side to know if it was still plugged in when it went to sleep or if it was unplugged before going to sleep.
You can see the states and the current understanding of their meanings at https://github.com/ngardiner/TWCManager/blob/main/lib/TWCManager/TWCSlave.py#L193 and https://github.com/ngardiner/TWCManager/blob/main/lib/TWCManager/TWCSlave.py#L390.