Sunspec: share block reads across values on the same connection (#33011)
This commit is contained in:
parent
1a0a05c9ad
commit
de0bac2bc8
3 changed files with 210 additions and 1 deletions
|
|
@ -73,7 +73,9 @@ func NewModbusSunspecFromConfig(ctx context.Context, other map[string]any) (Plug
|
|||
|
||||
devices := sunspecDevices.Get(conn)
|
||||
if devices == nil {
|
||||
devices, err = sunsdev.DeviceTree(conn)
|
||||
// the device tree captures the client gosunspec uses for all further
|
||||
// block reads and writes, hence wrap it in the deduplicating cache
|
||||
devices, err = sunsdev.DeviceTree(newSunspecCachedClient(conn))
|
||||
if err != nil && !errors.Is(err, meters.ErrPartiallyOpened) {
|
||||
return nil, err
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue