Use Power as default reading for modbus plugin

This commit is contained in:
andig 2020-07-19 17:31:47 +02:00
parent f2c607ac58
commit 985a16a91d

View file

@ -50,6 +50,11 @@ func NewModbusFromConfig(log *util.Logger, other map[string]interface{}) *Modbus
log.FATAL.Fatalf("config: modbus cannot have value and register both")
}
if cc.Value == "" && cc.Register.Decode == "" {
log.WARN.Println("config: missing modbus value or register - assuming Power")
cc.Value = "Power"
}
// model + value configured
if cc.Value != "" {
if err := modbus.ParseOperation(device, cc.Value, &op); err != nil {