RCT: add external power

This commit is contained in:
andig 2023-02-27 16:14:07 +01:00
parent 1f9361fec0
commit 78e5119855
3 changed files with 8 additions and 4 deletions

2
go.mod
View file

@ -67,7 +67,7 @@ require (
github.com/mergermarket/go-pkcs7 v0.0.0-20170926155232-153b18ea13c9
github.com/mitchellh/go-homedir v1.1.0
github.com/mitchellh/mapstructure v1.5.0
github.com/mlnoga/rct v0.1.2-0.20230215163419-4242ff35a8ce
github.com/mlnoga/rct v0.1.2-0.20230227143934-71af1fb7dfa1
github.com/muka/go-bluetooth v0.0.0-20220219050759-674a63b8741a
github.com/mxschmitt/golang-combinations v1.1.0
github.com/nicksnyder/go-i18n/v2 v2.2.1

4
go.sum
View file

@ -810,8 +810,8 @@ github.com/mitchellh/mapstructure v1.5.0/go.mod h1:bFUtVrKA4DC2yAKiSyO/QUcy7e+RR
github.com/mitchellh/reflectwalk v1.0.0/go.mod h1:mSTlrgnPZtwu0c4WaC2kGObEpuNDbx0jmZXqmk4esnw=
github.com/mitchellh/reflectwalk v1.0.2 h1:G2LzWKi524PWgd3mLHV8Y5k7s6XUvT0Gef6zxSIeXaQ=
github.com/mitchellh/reflectwalk v1.0.2/go.mod h1:mSTlrgnPZtwu0c4WaC2kGObEpuNDbx0jmZXqmk4esnw=
github.com/mlnoga/rct v0.1.2-0.20230215163419-4242ff35a8ce h1:74Mw2TfstLVHfWkI6eg7TSxuchIwyUff9wQj6yLjMxY=
github.com/mlnoga/rct v0.1.2-0.20230215163419-4242ff35a8ce/go.mod h1:0lfd2mmBnBzIvuzYtdhG+2371u+cUfIxsYErm4P9KRI=
github.com/mlnoga/rct v0.1.2-0.20230227143934-71af1fb7dfa1 h1:+OVWP3tJu+en06qieaXY/pcX+1qKp4X1oX9g3hMgOCk=
github.com/mlnoga/rct v0.1.2-0.20230227143934-71af1fb7dfa1/go.mod h1:0lfd2mmBnBzIvuzYtdhG+2371u+cUfIxsYErm4P9KRI=
github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q=
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd h1:TRLaZ9cD/w8PVh93nsPXa1VrQ6jlwL5oN8l14QlcNfg=
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q=

View file

@ -113,7 +113,11 @@ func (m *RCT) CurrentPower() (float64, error) {
return 0, err
}
b, err := m.conn.QueryFloat32(rct.SolarGenBPowerW)
return float64(a + b), err
if err != nil {
return 0, err
}
c, err := m.conn.QueryFloat32(rct.S0ExternalPowerW)
return float64(a + b + c), err
case "battery":
res, err := m.conn.QueryFloat32(rct.BatteryPowerW)