diff --git a/api/globalconfig/types.go b/api/globalconfig/types.go index 0c4e2fb9a..03365666d 100644 --- a/api/globalconfig/types.go +++ b/api/globalconfig/types.go @@ -54,8 +54,8 @@ type Go struct { type ModbusProxy struct { Port int - ReadOnly string - modbus.Settings `mapstructure:",squash"` + ReadOnly string `yaml:",omitempty" json:",omitempty"` + modbus.Settings `mapstructure:",squash" yaml:",inline,omitempty" json:",omitempty"` } var _ api.Redactor = (*Hems)(nil) diff --git a/util/modbus/modbus.go b/util/modbus/modbus.go index d9852b3cf..52dcaae35 100644 --- a/util/modbus/modbus.go +++ b/util/modbus/modbus.go @@ -32,12 +32,12 @@ type TcpSettings struct { // Settings contains the ModBus settings type Settings struct { - ID uint8 - SubDevice int - URI, Device, Comset string - Baudrate int - UDP bool - RTU *bool // indicates RTU over TCP if true + ID uint8 `json:",omitempty" yaml:",omitempty"` + SubDevice int `json:",omitempty" yaml:",omitempty"` + URI, Device, Comset string `json:",omitempty" yaml:",omitempty"` + Baudrate int `json:",omitempty" yaml:",omitempty"` + UDP bool `json:",omitempty" yaml:",omitempty"` + RTU *bool `json:",omitempty" yaml:",omitempty"` } // Protocol identifies the wire format from the RTU setting