Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/master'
Browse files Browse the repository at this point in the history
  • Loading branch information
weblate committed Sep 18, 2024
2 parents f4782a9 + 57e1de7 commit 48c5e44
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 11 deletions.
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ require (
github.com/BurntSushi/toml v1.4.0
github.com/PuerkitoBio/goquery v1.9.2
github.com/andig/go-powerwall v0.2.1-0.20230808194509-dd70cdb6e140
github.com/andig/gosunspec v0.0.0-20231205122018-1daccfa17912
github.com/andig/gosunspec v0.0.0-20240918203654-860ce51d602b
github.com/andig/mbserver v0.0.0-20230310211055-1d29cbb5820e
github.com/asaskevich/EventBus v0.0.0-20200907212545-49d423059eef
github.com/aws/aws-sdk-go v1.55.5
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@ github.com/alecthomas/units v0.0.0-20190717042225-c3de453c63f4/go.mod h1:ybxpYRF
github.com/alecthomas/units v0.0.0-20190924025748-f65c72e2690d/go.mod h1:rBZYJk541a8SKzHPHnH3zbiI+7dagKZ0cgpgrD7Fyho=
github.com/andig/go-powerwall v0.2.1-0.20230808194509-dd70cdb6e140 h1:C93T8vg7CN4Q4BBDbBMOvBoTYBA+CaBEvlY2SZF8aa0=
github.com/andig/go-powerwall v0.2.1-0.20230808194509-dd70cdb6e140/go.mod h1:Xk09mD+7RTCuuHMX5RxlqgEUeh9oZdIX0rL0qiY6l/4=
github.com/andig/gosunspec v0.0.0-20231205122018-1daccfa17912 h1:pphS+WUa9zK0ZH/Rt2JMEaOx0qz8dDzOzbr/W7BMiXQ=
github.com/andig/gosunspec v0.0.0-20231205122018-1daccfa17912/go.mod h1:c6P6szcR+ROkqZruOR4f6qbDKFjZX6OitPpj+yJ/r8k=
github.com/andig/gosunspec v0.0.0-20240918203654-860ce51d602b h1:81UMfM949I7StrRay7YDUZazY8M1u/JHkzwcFEjiilQ=
github.com/andig/gosunspec v0.0.0-20240918203654-860ce51d602b/go.mod h1:c6P6szcR+ROkqZruOR4f6qbDKFjZX6OitPpj+yJ/r8k=
github.com/andig/mbserver v0.0.0-20230310211055-1d29cbb5820e h1:m/NTP3JWpR7M0ljLxiQU4fzR25jjhe1LDtxLMNcoNJQ=
github.com/andig/mbserver v0.0.0-20230310211055-1d29cbb5820e/go.mod h1:4VtYzTm//oUipwvO3yh0g/udTE7pYJM+U/kyAuFDsgM=
github.com/andig/yaml v0.0.0-20240531135838-1ff5761ab467 h1:JqIoHxsQSV39xaemvVRu3HOkSf5AbhQ1YEENJa2cL3Q=
Expand Down
15 changes: 7 additions & 8 deletions provider/modbus_sunspec.go
Original file line number Diff line number Diff line change
Expand Up @@ -161,8 +161,6 @@ func (m *ModbusSunspec) blockPoint() (block sunspec.Block, point sunspec.Point,
return block, point, err
}

// TODO scale factors

var _ SetFloatProvider = (*Modbus)(nil)

// FloatSetter executes configured modbus write operation and implements SetFloatProvider
Expand Down Expand Up @@ -213,6 +211,7 @@ func (m *ModbusSunspec) IntSetter(_ string) (func(int64) error, error) {

val = int64(float64(val) * m.scale)

// SetValue is used to include the scale factor when writing
switch typ {
case typelabel.Bitfield16:
point.SetBitfield16(sunspec.Bitfield16(val))
Expand All @@ -223,17 +222,17 @@ func (m *ModbusSunspec) IntSetter(_ string) (func(int64) error, error) {
case typelabel.Enum32:
point.SetEnum32(sunspec.Enum32(val))
case typelabel.Int16:
point.SetInt16(int16(val))
point.SetValue(int16(val))
case typelabel.Int32:
point.SetInt32(int32(val))
point.SetValue(int32(val))
case typelabel.Int64:
point.SetInt64(val)
point.SetValue(val)
case typelabel.Uint16:
point.SetUint16(uint16(val))
point.SetValue(uint16(val))
case typelabel.Uint32:
point.SetUint32(uint32(val))
point.SetValue(uint32(val))
case typelabel.Uint64:
point.SetUint64(uint64(val))
point.SetValue(uint64(val))
default:
return fmt.Errorf("invalid point type: %s", typ)
}
Expand Down

0 comments on commit 48c5e44

Please sign in to comment.