|
|
@ -127,7 +127,9 @@ func chargeStatus(m chat1.MsgSummary) { |
|
|
|
ret += fmt.Sprintf("\nConnected Cable: %+v", state.ConnChargeCable) |
|
|
|
ret += fmt.Sprintf("\nConnected Cable: %+v", state.ConnChargeCable) |
|
|
|
ret += fmt.Sprintf("\nCharging State: %+v", state.ChargingState) |
|
|
|
ret += fmt.Sprintf("\nCharging State: %+v", state.ChargingState) |
|
|
|
if state.ChargingState != "Stopped" { |
|
|
|
if state.ChargingState != "Stopped" { |
|
|
|
ret += fmt.Sprintf("\nTime to full: %+vmin", state.MinutesToFullCharge) |
|
|
|
|
|
|
|
|
|
|
|
chargeTimer := time.Duration(state.MinutesToFullCharge) * time.Minute |
|
|
|
|
|
|
|
ret += fmt.Sprintf("\nTime to full: %+v (%+v)", formatDuration(chargeTimer), time.Now().Add(chargeTimer).Format("15:04")) |
|
|
|
if state.FastChargerPresent { |
|
|
|
if state.FastChargerPresent { |
|
|
|
ret += fmt.Sprintf("\nFast Charger: %+v %+v", state.FastChargerBrand, state.FastChargerType) |
|
|
|
ret += fmt.Sprintf("\nFast Charger: %+v %+v", state.FastChargerBrand, state.FastChargerType) |
|
|
|
} |
|
|
|
} |
|
|
@ -142,7 +144,13 @@ func chargeStatus(m chat1.MsgSummary) { |
|
|
|
} |
|
|
|
} |
|
|
|
k.SendMessageByConvID(m.ConvID, ret) |
|
|
|
k.SendMessageByConvID(m.ConvID, ret) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
func formatDuration(d time.Duration) string { |
|
|
|
|
|
|
|
d = d.Round(time.Minute) |
|
|
|
|
|
|
|
h := d / time.Hour |
|
|
|
|
|
|
|
d -= h * time.Hour |
|
|
|
|
|
|
|
m := d / time.Minute |
|
|
|
|
|
|
|
return fmt.Sprintf("%02d:%02d", h, m) |
|
|
|
|
|
|
|
} |
|
|
|
func flashLights(m chat1.MsgSummary) { |
|
|
|
func flashLights(m chat1.MsgSummary) { |
|
|
|
v := getVehicle(m) |
|
|
|
v := getVehicle(m) |
|
|
|
if v == nil { |
|
|
|
if v == nil { |
|
|
|