Cfos: remove currents due to invalid values (#3074)
This commit is contained in:
parent
07676f7820
commit
6151628dd1
1 changed files with 14 additions and 14 deletions
|
|
@ -13,7 +13,7 @@ const (
|
|||
cfosRegPower = 8062 // power reading
|
||||
)
|
||||
|
||||
var cfosRegCurrents = []uint16{8064, 8066, 8068} // current readings
|
||||
// var cfosRegCurrents = []uint16{8064, 8066, 8068} // current readings
|
||||
|
||||
// CfosPowerBrain is a meter implementation for cFos PowerBrain wallboxes.
|
||||
// It uses Modbus TCP to communicate at modbus client id 1 and power meters at id 2 and 3.
|
||||
|
|
@ -78,19 +78,19 @@ func (wb *CfosPowerBrain) TotalEnergy() (float64, error) {
|
|||
return float64(binary.BigEndian.Uint64(b)) / 1e3, err
|
||||
}
|
||||
|
||||
var _ api.MeterCurrent = (*CfosPowerBrain)(nil)
|
||||
// var _ api.MeterCurrent = (*CfosPowerBrain)(nil)
|
||||
|
||||
// Currents implements the api.MeterCurrent interface
|
||||
func (wb *CfosPowerBrain) Currents() (float64, float64, float64, error) {
|
||||
var currents []float64
|
||||
for _, regCurrent := range cfosRegCurrents {
|
||||
b, err := wb.conn.ReadHoldingRegisters(regCurrent, 2)
|
||||
if err != nil {
|
||||
return 0, 0, 0, err
|
||||
}
|
||||
// // Currents implements the api.MeterCurrent interface
|
||||
// func (wb *CfosPowerBrain) Currents() (float64, float64, float64, error) {
|
||||
// var currents []float64
|
||||
// for _, regCurrent := range cfosRegCurrents {
|
||||
// b, err := wb.conn.ReadHoldingRegisters(regCurrent, 2)
|
||||
// if err != nil {
|
||||
// return 0, 0, 0, err
|
||||
// }
|
||||
|
||||
currents = append(currents, float64(binary.BigEndian.Uint32(b))/10)
|
||||
}
|
||||
// currents = append(currents, float64(binary.BigEndian.Uint32(b))/10)
|
||||
// }
|
||||
|
||||
return currents[0], currents[1], currents[2], nil
|
||||
}
|
||||
// return currents[0], currents[1], currents[2], nil
|
||||
// }
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue