Skip to content

Commit

Permalink
Update DeviceWorkarounds to new da.
Browse files Browse the repository at this point in the history
  • Loading branch information
pwood committed Jun 23, 2024
1 parent 5e9da94 commit 6a738c4
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 3 deletions.
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ go 1.22.0
require (
github.com/expr-lang/expr v1.16.9
github.com/shimmeringbee/callbacks v0.0.0-20240614104656-b56cd6b4b604
github.com/shimmeringbee/da v0.0.0-20240622202110-ccbf24700388
github.com/shimmeringbee/da v0.0.0-20240623195712-c921021ae9f9
github.com/shimmeringbee/logwrap v0.1.3
github.com/shimmeringbee/persistence v0.0.0-20240615183316-1a60e6781413
github.com/shimmeringbee/retry v0.0.0-20240614104711-064c2726a8b4
Expand Down
2 changes: 2 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ github.com/shimmeringbee/callbacks v0.0.0-20240614104656-b56cd6b4b604 h1:he/14/5
github.com/shimmeringbee/callbacks v0.0.0-20240614104656-b56cd6b4b604/go.mod h1:1AzT3lP4dAEaqWDdWsldhRtcl0+jyCGcZaBTHTjtA9w=
github.com/shimmeringbee/da v0.0.0-20240622202110-ccbf24700388 h1:opK7x4lWbylMm5PfCzixiG7s07FtinqNlbCat+Md7+c=
github.com/shimmeringbee/da v0.0.0-20240622202110-ccbf24700388/go.mod h1:jUKTa353LvJT3TAdwtmfGEbcxkYbG58h0gbASRf0FIs=
github.com/shimmeringbee/da v0.0.0-20240623195712-c921021ae9f9 h1:beGPxE5b7k6Pz7ND7Ii1S4zf01S5tmQQlW3eI6FW/z4=
github.com/shimmeringbee/da v0.0.0-20240623195712-c921021ae9f9/go.mod h1:jUKTa353LvJT3TAdwtmfGEbcxkYbG58h0gbASRf0FIs=
github.com/shimmeringbee/logwrap v0.1.3 h1:1PqPGdgbeQxACQqc6RUWERn7EnpA1jbiHzXVYFa7q2A=
github.com/shimmeringbee/logwrap v0.1.3/go.mod h1:NBAcZCUl6aFOGnWTs8m67EUAmWFZXRhoRQf5nknY8W0=
github.com/shimmeringbee/persistence v0.0.0-20240615183316-1a60e6781413 h1:0t4xEtg+kXXATiryn0m9p5OmsvDUvh2BPG+r7Vcpvy4=
Expand Down
11 changes: 9 additions & 2 deletions implcaps/generic/device_workarounds/impl.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,8 @@ func (i *Implementation) Load(ctx context.Context) (bool, error) {
for _, workaround := range i.workaroundsEnabled {
if err := i.loadWorkaround(ctx, workaround); err != nil {
return false, err
} else {
i.workaroundsEnabled = append(i.workaroundsEnabled, "ZCLReportingKeepAlive")
}
}

Expand Down Expand Up @@ -96,11 +98,11 @@ func (i *Implementation) ImplName() string {
return "GenericDeviceWorkarounds"
}

func (i *Implementation) Enabled(_ context.Context) []string {
func (i *Implementation) Enabled(_ context.Context) ([]string, error) {
i.m.RLock()
defer i.m.RUnlock()

return i.workaroundsEnabled
return i.workaroundsEnabled, nil
}

func (i *Implementation) loadWorkaround(ctx context.Context, workaround string) error {
Expand Down Expand Up @@ -135,5 +137,10 @@ func (i *Implementation) enumerateZCLReportingKeepAlive(ctx context.Context, m m

i.s.Section("Workarounds", "ZCLReportingKeepAlive")

i.m.Lock()
defer i.m.Unlock()

i.workaroundsEnabled = append(i.workaroundsEnabled, "ZCLReportingKeepAlive")

return nil
}

0 comments on commit 6a738c4

Please sign in to comment.