Thank you for the awesome work!
Iām looking to integrate this a bit different way than with raspi. Iām going with old mobile phone running termux because I wanāt mobile connectivity and good battery life for my āPHEV remoteā and to have the mobile as my car phone / navigator at the same time.
Iāve succesfully gotten phev2mqtt running now and I can get Tasker to handle the wifi switching etc. so that I will be able to use phev2mqtt over 4G/LTE.
Now my problem is that I wonāt be able to use mqtt abilities because of the 4G/WIFI switching and running with Tasker. Well I might be able to achieve this by using rooted phone and by configuring ip routes to correct network interfaces but my phone at the moment is unrootable (Blackberry).
I would like to use phev2mqtt client set commands for now. Iām trying to understand how to set the climate (acmode, heat/windscreenā¦, duration). Iām inspecting the mqtt file from cmd folder:
else if strings.HasPrefix(msg.Topic(), m.topic("/set/climate/")) {
topic := msg.Topic()
payload := strings.ToLower(string(msg.Payload()))
modeMap := map[string]byte{"off": 0x0, "OFF": 0x0, "cool": 0x1, "heat": 0x2, "windscreen": 0x3, "mode": 0x4}
durMap := map[string]byte{"10": 0x0, "20": 0x10, "30": 0x20, "on": 0x0, "off": 0x0}
parts := strings.Split(topic, "/")
state := byte(0x02) // initial.
mode, ok := modeMap[parts[len(parts)-1]]
if !ok {
log.Errorf("Unknown climate mode: %s", parts[len(parts)-1])
return
}
if mode == 0x4 { // set/climate/mode -> "heat"
mode = modeMap[payload]
payload = "on"
}
if payload == "off" {
mode = 0x0
}
duration, ok := durMap[payload]
if mode != 0x0 && !ok {
log.Errorf("Unknown climate duration: %s", payload)
return
}
if mode == 0x0 {
state = 0x1
}
if err := m.phev.SetRegister(0x1b, []byte{state, mode, duration, 0x0}); err != nil {
log.Infof("Error setting register 0x1b: %v", err)
return
So for heat 20 minutes I use command āphev2mqtt client set 0x1b,0x02,0x2,0x10,0x0ā am I correct?
Just want to make this sure so I donāt break anything at the PHEVā¦