Skip to content

Commit

Permalink
Merge pull request #60 from ffrog8/add-temps
Browse files Browse the repository at this point in the history
Add temperatures to MQTT
  • Loading branch information
jagheterfredrik authored Aug 3, 2024
2 parents 24fd9d1 + 6d11191 commit 7b884fc
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 0 deletions.
33 changes: 33 additions & 0 deletions app/sensors.go
Original file line number Diff line number Diff line change
Expand Up @@ -230,6 +230,39 @@ func getEntities(w *wallbox.Wallbox) map[string]Entity {
"name": "Status",
},
},
"temp_l1": {
Component: "sensor",
Getter: func() string { return fmt.Sprint(w.Data.RedisM2W.TempL1) },
Config: map[string]string{
"name": "Temperature Line 1",
"unit_of_measurement": "°C",
"device_class": "temperature",
"state_class": "measurement",
"suggested_display_precision": "1",
},
},
"temp_l2": {
Component: "sensor",
Getter: func() string { return fmt.Sprint(w.Data.RedisM2W.TempL2) },
Config: map[string]string{
"name": "Temperature Line 2",
"unit_of_measurement": "°C",
"device_class": "temperature",
"state_class": "measurement",
"suggested_display_precision": "1",
},
},
"temp_l3": {
Component: "sensor",
Getter: func() string { return fmt.Sprint(w.Data.RedisM2W.TempL3) },
Config: map[string]string{
"name": "Temperature Line 3",
"unit_of_measurement": "°C",
"device_class": "temperature",
"state_class": "measurement",
"suggested_display_precision": "1",
},
},
}
}

Expand Down
3 changes: 3 additions & 0 deletions app/wallbox/wallbox.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,9 @@ type DataCache struct {
PowerBoostLine2Current float64 `redis:"PBO.line2.current.value"`
PowerBoostLine3Current float64 `redis:"PBO.line3.current.value"`
PowerBoostCumulativeEnergy float64 `redis:"PBO.energy_wh.value"`
TempL1 float64 `redis:"tms.line1.temp_deg.value"`
TempL2 float64 `redis:"tms.line2.temp_deg.value"`
TempL3 float64 `redis:"tms.line3.temp_deg.value"`
}
}

Expand Down

0 comments on commit 7b884fc

Please sign in to comment.