Rename range to vehicleRange

This commit is contained in:
andig 2021-10-10 13:01:14 +02:00
parent da3c98d08d
commit b809356d4f
15 changed files with 45 additions and 36 deletions

View file

@ -124,6 +124,14 @@ func (m *MQTT) Run(site site.API, in <-chan util.Param) {
updated := time.Now().Unix()
m.publish(fmt.Sprintf("%s/updated", m.root), true, updated)
// remove deprecated topics
for id := range site.LoadPoints() {
topic := fmt.Sprintf("%s/loadpoints/%d", m.root, id+1)
for _, dep := range []string{"range", "socCharge", "vehicleSoc"} {
m.publish(fmt.Sprintf("%s/%s", topic, dep), true, nil)
}
}
// publish
for p := range in {
topic := fmt.Sprintf("%s/site", m.root)