Mqtt: revert publishing phase values as array instead of slice
This commit is contained in:
parent
a885f39d18
commit
c9e8ee27ae
2 changed files with 2 additions and 2 deletions
|
|
@ -442,7 +442,7 @@ func (site *Site) updateMeters() error {
|
|||
i1, i2, i3, err := phaseMeter.Currents()
|
||||
if err == nil {
|
||||
site.log.DEBUG.Printf("grid currents: %.3gA", []float64{i1, i2, i3})
|
||||
site.publish("gridCurrents", [3]float64{i1, i2, i3}) // array[3] for mqtt special-casing phases
|
||||
site.publish("gridCurrents", []float64{i1, i2, i3})
|
||||
} else {
|
||||
site.log.ERROR.Printf("grid meter currents: %v", err)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -63,7 +63,7 @@ func (m *MQTT) publishSingleValue(topic string, retained bool, payload interface
|
|||
|
||||
func (m *MQTT) publish(topic string, retained bool, payload interface{}) {
|
||||
// publish phase values
|
||||
if slice, ok := payload.([3]float64); ok {
|
||||
if slice, ok := payload.([]float64); ok && len(slice) == 3 {
|
||||
var total float64
|
||||
for i, v := range slice {
|
||||
total += v
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue