Skip to content

Commit

Permalink
Rework device workarounds.
Browse files Browse the repository at this point in the history
  • Loading branch information
pwood committed Jun 23, 2024
1 parent 3043385 commit 5e9da94
Show file tree
Hide file tree
Showing 21 changed files with 316 additions and 393 deletions.
4 changes: 2 additions & 2 deletions device_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import (
"github.com/shimmeringbee/da/capabilities"
"github.com/shimmeringbee/da/mocks"
"github.com/shimmeringbee/zda/implcaps"
"github.com/shimmeringbee/zda/implcaps/generic"
"github.com/shimmeringbee/zda/implcaps/generic/product_information"
"github.com/shimmeringbee/zigbee"
"github.com/stretchr/testify/assert"
"sync"
Expand Down Expand Up @@ -42,7 +42,7 @@ func Test_device(t *testing.T) {
})

t.Run("Device returns the stored capability", func(t *testing.T) {
c := &generic.ProductInformation{}
c := &product_information.Implementation{}

d := device{
capabilities: map[da.Capability]implcaps.ZDACapability{capabilities.ProductInformationFlag: c},
Expand Down
10 changes: 5 additions & 5 deletions enumerate_device_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import (
"github.com/shimmeringbee/zcl/commands/local/basic"
"github.com/shimmeringbee/zda/implcaps"
"github.com/shimmeringbee/zda/implcaps/factory"
"github.com/shimmeringbee/zda/implcaps/generic"
"github.com/shimmeringbee/zda/implcaps/generic/product_information"
"github.com/shimmeringbee/zda/rules"
"github.com/shimmeringbee/zigbee"
"github.com/stretchr/testify/assert"
Expand Down Expand Up @@ -496,7 +496,7 @@ func Test_enumerateDevice_updateCapabilitiesOnDevice(t *testing.T) {
}

mdm.On("attachCapabilityToDevice", d, mock.Anything).Run(func(args mock.Arguments) {
pic := args.Get(1).(*generic.ProductInformation)
pic := args.Get(1).(*product_information.Implementation)
pi, _ := pic.Get(context.Background())
assert.Equal(t, "NEXUS-7", pi.Name)
})
Expand All @@ -513,7 +513,7 @@ func Test_enumerateDevice_updateCapabilitiesOnDevice(t *testing.T) {
mdm := &mockDeviceManager{}
defer mdm.AssertExpectations(t)
ed := enumerateDevice{logger: logwrap.New(discard.Discard()), capabilityFactory: factory.Create, dm: mdm}
opi := generic.NewProductInformation()
opi := product_information.NewProductInformation()
d := &device{m: &sync.RWMutex{}, deviceId: 1, capabilities: map[da.Capability]implcaps.ZDACapability{capabilities.ProductInformationFlag: opi}}
opi.Init(d, memory.New())
_, _ = opi.Enumerate(context.Background(), map[string]any{
Expand All @@ -536,7 +536,7 @@ func Test_enumerateDevice_updateCapabilitiesOnDevice(t *testing.T) {
}

mdm.On("attachCapabilityToDevice", d, mock.Anything).Run(func(args mock.Arguments) {
pic := args.Get(1).(*generic.ProductInformation)
pic := args.Get(1).(*product_information.Implementation)
pi, _ := pic.Get(context.Background())
assert.Equal(t, "NEXUS-7", pi.Name)
})
Expand All @@ -553,7 +553,7 @@ func Test_enumerateDevice_updateCapabilitiesOnDevice(t *testing.T) {
mdm := &mockDeviceManager{}
defer mdm.AssertExpectations(t)
ed := enumerateDevice{logger: logwrap.New(discard.Discard()), capabilityFactory: factory.Create, dm: mdm}
opi := generic.NewProductInformation()
opi := product_information.NewProductInformation()
d := &device{m: &sync.RWMutex{}, deviceId: 1, capabilities: map[da.Capability]implcaps.ZDACapability{capabilities.ProductInformationFlag: opi}}
opi.Init(d, memory.New())
_, _ = opi.Enumerate(context.Background(), map[string]any{
Expand Down
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-20240621202518-c4ba1b61593d
github.com/shimmeringbee/da v0.0.0-20240622202110-ccbf24700388
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
31 changes: 2 additions & 29 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -9,48 +9,21 @@ github.com/lucasb-eyer/go-colorful v1.2.0 h1:1nnpGOrhyZZuNyfu1QjKiUICQ74+3FNCN69
github.com/lucasb-eyer/go-colorful v1.2.0/go.mod h1:R4dSotOR9KMtayYi1e77YzuveK+i7ruzyGqttikkLy0=
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
github.com/shimmeringbee/bytecodec v0.0.0-20210228205504-1e9e0677347b h1:8q7X6JQwYKjnl+Absfv9m+LbDSBBllqTDDKzmtZ1ybY=
github.com/shimmeringbee/bytecodec v0.0.0-20210228205504-1e9e0677347b/go.mod h1:WYnxfxTJ45UQ+xeAuuTSIalcEepgP8Rb7T/OhCaDdgo=
github.com/shimmeringbee/bytecodec v0.0.0-20240614104652-9d31c74dcd13 h1:GiNQq9XzoQerCE/eI8/NEPJ7W+iy0FRSn6whgnPlb3w=
github.com/shimmeringbee/bytecodec v0.0.0-20240614104652-9d31c74dcd13/go.mod h1:WYnxfxTJ45UQ+xeAuuTSIalcEepgP8Rb7T/OhCaDdgo=
github.com/shimmeringbee/callbacks v0.0.0-20221001135028-b85b5f89d5d6 h1:A1t2A3OrXEEdZqMw+zmwe6r7LbeZWP256es5TY9/k3Y=
github.com/shimmeringbee/callbacks v0.0.0-20221001135028-b85b5f89d5d6/go.mod h1:1AzT3lP4dAEaqWDdWsldhRtcl0+jyCGcZaBTHTjtA9w=
github.com/shimmeringbee/callbacks v0.0.0-20240614104656-b56cd6b4b604 h1:he/14/56+C/b7y57sHfU/IqyB4gSyexfHkMuq3egcJg=
github.com/shimmeringbee/callbacks v0.0.0-20240614104656-b56cd6b4b604/go.mod h1:1AzT3lP4dAEaqWDdWsldhRtcl0+jyCGcZaBTHTjtA9w=
github.com/shimmeringbee/da v0.0.0-20240510193548-c78db0273744 h1:71a3cbHePCjYYH5ki+RqMVteeHiFKVP7VlwFi451fys=
github.com/shimmeringbee/da v0.0.0-20240510193548-c78db0273744/go.mod h1:jUKTa353LvJT3TAdwtmfGEbcxkYbG58h0gbASRf0FIs=
github.com/shimmeringbee/da v0.0.0-20240614104703-d8efc964b76a h1:gqBGoPcDjCzttr8n1nVFORHv3YFOPCNrfcFbu6P4X8A=
github.com/shimmeringbee/da v0.0.0-20240614104703-d8efc964b76a/go.mod h1:jUKTa353LvJT3TAdwtmfGEbcxkYbG58h0gbASRf0FIs=
github.com/shimmeringbee/da v0.0.0-20240615193906-993b4195d59e h1:Abre4czD9AJseZEL5CZplaZBQtr8Ztglj6elZofylyY=
github.com/shimmeringbee/da v0.0.0-20240615193906-993b4195d59e/go.mod h1:jUKTa353LvJT3TAdwtmfGEbcxkYbG58h0gbASRf0FIs=
github.com/shimmeringbee/da v0.0.0-20240615210808-95a0a3f8f08a h1:e6YUEZ4ljwrNG2So0QJnRvxLQVTKh5uHP9MuzNV1/Vc=
github.com/shimmeringbee/da v0.0.0-20240615210808-95a0a3f8f08a/go.mod h1:jUKTa353LvJT3TAdwtmfGEbcxkYbG58h0gbASRf0FIs=
github.com/shimmeringbee/da v0.0.0-20240620203531-59614abd3e28 h1:rXtMUoERVyQ+lzXSiQbFy7HRNMu9sE3rvRupLTH1zbA=
github.com/shimmeringbee/da v0.0.0-20240620203531-59614abd3e28/go.mod h1:jUKTa353LvJT3TAdwtmfGEbcxkYbG58h0gbASRf0FIs=
github.com/shimmeringbee/da v0.0.0-20240621202518-c4ba1b61593d h1:b0pgl4liNcXKi07Y3nVuzZ1uLKPJdkFA6/Y7hsUNSzM=
github.com/shimmeringbee/da v0.0.0-20240621202518-c4ba1b61593d/go.mod h1:jUKTa353LvJT3TAdwtmfGEbcxkYbG58h0gbASRf0FIs=
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/logwrap v0.1.3 h1:1PqPGdgbeQxACQqc6RUWERn7EnpA1jbiHzXVYFa7q2A=
github.com/shimmeringbee/logwrap v0.1.3/go.mod h1:NBAcZCUl6aFOGnWTs8m67EUAmWFZXRhoRQf5nknY8W0=
github.com/shimmeringbee/persistence v0.0.0-20240614163143-a99424e4d61c h1:c86y9DJNOsvZHZ/XAwfzdIxmvPPRPsWhqylF8Ok6xfg=
github.com/shimmeringbee/persistence v0.0.0-20240614163143-a99424e4d61c/go.mod h1:Ob1eKGYM7+9P3LkB9vB9nr15d3trtS4D9KOnGoxOkp8=
github.com/shimmeringbee/persistence v0.0.0-20240615120347-680c4a887f1b h1:TD++F59YAdQCD7xeEmUDlX2nPmyP5LgVoD6IiaVgD1c=
github.com/shimmeringbee/persistence v0.0.0-20240615120347-680c4a887f1b/go.mod h1:Ob1eKGYM7+9P3LkB9vB9nr15d3trtS4D9KOnGoxOkp8=
github.com/shimmeringbee/persistence v0.0.0-20240615120714-a567d1ac9349 h1:IQ2JhhUVsATqnGav6KOJRqLFDZ80wCYYG3yawTVlylI=
github.com/shimmeringbee/persistence v0.0.0-20240615120714-a567d1ac9349/go.mod h1:Ob1eKGYM7+9P3LkB9vB9nr15d3trtS4D9KOnGoxOkp8=
github.com/shimmeringbee/persistence v0.0.0-20240615141034-6414db99d48e h1:hxB9Zczd27kKbOMoiK56CaHgFKDyIYQLVCD1WV+LlgA=
github.com/shimmeringbee/persistence v0.0.0-20240615141034-6414db99d48e/go.mod h1:Ob1eKGYM7+9P3LkB9vB9nr15d3trtS4D9KOnGoxOkp8=
github.com/shimmeringbee/persistence v0.0.0-20240615183316-1a60e6781413 h1:0t4xEtg+kXXATiryn0m9p5OmsvDUvh2BPG+r7Vcpvy4=
github.com/shimmeringbee/persistence v0.0.0-20240615183316-1a60e6781413/go.mod h1:Ob1eKGYM7+9P3LkB9vB9nr15d3trtS4D9KOnGoxOkp8=
github.com/shimmeringbee/retry v0.0.0-20221006193055-2ce01bf139c2 h1:HxpPz7w7SxVf1GmcM5oTK1JK64TGpK1UflweYRSOwC4=
github.com/shimmeringbee/retry v0.0.0-20221006193055-2ce01bf139c2/go.mod h1:KYvVq5b7/BSSlWng+AKB5jwNGpc0D7eg8ySWrdPAlms=
github.com/shimmeringbee/retry v0.0.0-20240614104711-064c2726a8b4 h1:YU77guV/6/9nJymm4K1JH6MIx6yE/NfUnFX//yo3GfM=
github.com/shimmeringbee/retry v0.0.0-20240614104711-064c2726a8b4/go.mod h1:KYvVq5b7/BSSlWng+AKB5jwNGpc0D7eg8ySWrdPAlms=
github.com/shimmeringbee/zcl v0.0.0-20240614085730-dc48ec71c312 h1:OoFxM9W299ESRnPSR3NoK4+AmWz5PzcJ4gJFZ62nkZ0=
github.com/shimmeringbee/zcl v0.0.0-20240614085730-dc48ec71c312/go.mod h1:1WBb6RqMCVEukSmLY4fN/F5p3YYZrm6PTYn2TBnHwis=
github.com/shimmeringbee/zcl v0.0.0-20240614104719-4eee02c0ffd1 h1:19JMz+jKs8poUPlmF769Z2e+zZjmACS+aLB2BHFTKHE=
github.com/shimmeringbee/zcl v0.0.0-20240614104719-4eee02c0ffd1/go.mod h1:DeGINQ0C9S61qBON9Zm2RArEBX4ap1LyHClfUgSUTEM=
github.com/shimmeringbee/zigbee v0.0.0-20221016122511-6c2328db0d94/go.mod h1:GMA6rVpzvUK16cZwi8uW11JUTx8xUGOk5DbkXYWvm/8=
github.com/shimmeringbee/zigbee v0.0.0-20240614103911-3a30074e1528 h1:D5jQVQ/kMjiVp4bYYmuWdKvW81+1tv2arSTgiXKkWmM=
github.com/shimmeringbee/zigbee v0.0.0-20240614103911-3a30074e1528/go.mod h1:BDCm9qtlJANPiLY+YRQac/0awPxeUd3FUxUFPh+1w/s=
github.com/shimmeringbee/zigbee v0.0.0-20240614104723-f4c0c0231568 h1:DnZ/kbXJZtihjqB7mz92hhUeP0+v0jYl5DJIznWdlL4=
github.com/shimmeringbee/zigbee v0.0.0-20240614104723-f4c0c0231568/go.mod h1:BDCm9qtlJANPiLY+YRQac/0awPxeUd3FUxUFPh+1w/s=
Expand Down
24 changes: 12 additions & 12 deletions implcaps/factory/mapping.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ import (
"github.com/shimmeringbee/da"
"github.com/shimmeringbee/da/capabilities"
"github.com/shimmeringbee/zda/implcaps"
"github.com/shimmeringbee/zda/implcaps/generic"
"github.com/shimmeringbee/zda/implcaps/proprietary/tirouter/device_workaround"
"github.com/shimmeringbee/zda/implcaps/generic/device_workarounds"
"github.com/shimmeringbee/zda/implcaps/generic/product_information"
"github.com/shimmeringbee/zda/implcaps/zcl/humidity_sensor"
"github.com/shimmeringbee/zda/implcaps/zcl/identify"
"github.com/shimmeringbee/zda/implcaps/zcl/power_supply"
Expand All @@ -19,22 +19,22 @@ const ZCLHumiditySensor = "ZCLHumiditySensor"
const ZCLPressureSensor = "ZCLPressureSensor"
const ZCLIdentify = "ZCLIdentify"
const ZCLPowerSupply = "ZCLPowerSupply"
const ProprietaryTiRouterDeviceWorkaround = "ProprietaryTiRouterDeviceWorkaround"
const GenericDeviceWorkarounds = "GenericDeviceWorkarounds"

var Mapping = map[string]da.Capability{
GenericProductInformation: capabilities.ProductInformationFlag,
ZCLTemperatureSensor: capabilities.TemperatureSensorFlag,
ZCLHumiditySensor: capabilities.RelativeHumiditySensorFlag,
ZCLPressureSensor: capabilities.PressureSensorFlag,
ZCLIdentify: capabilities.IdentifyFlag,
ZCLPowerSupply: capabilities.PowerSupplyFlag,
ProprietaryTiRouterDeviceWorkaround: capabilities.DeviceWorkaroundFlag,
GenericProductInformation: capabilities.ProductInformationFlag,
ZCLTemperatureSensor: capabilities.TemperatureSensorFlag,
ZCLHumiditySensor: capabilities.RelativeHumiditySensorFlag,
ZCLPressureSensor: capabilities.PressureSensorFlag,
ZCLIdentify: capabilities.IdentifyFlag,
ZCLPowerSupply: capabilities.PowerSupplyFlag,
GenericDeviceWorkarounds: capabilities.DeviceWorkaroundsFlag,
}

func Create(name string, iface implcaps.ZDAInterface) implcaps.ZDACapability {
switch name {
case GenericProductInformation:
return generic.NewProductInformation()
return product_information.NewProductInformation()
case ZCLTemperatureSensor:
return temperature_sensor.NewTemperatureSensor(iface)
case ZCLHumiditySensor:
Expand All @@ -45,7 +45,7 @@ func Create(name string, iface implcaps.ZDAInterface) implcaps.ZDACapability {
return identify.NewIdentify(iface)
case ZCLPowerSupply:
return power_suply.NewPowerSupply(iface)
case ProprietaryTiRouterDeviceWorkaround:
case GenericDeviceWorkarounds:
return device_workaround.NewDeviceWorkaround(iface)
default:
return nil
Expand Down
139 changes: 139 additions & 0 deletions implcaps/generic/device_workarounds/impl.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,139 @@
package device_workaround

import (
"context"
"github.com/shimmeringbee/da"
"github.com/shimmeringbee/da/capabilities"
"github.com/shimmeringbee/persistence"
"github.com/shimmeringbee/zcl"
"github.com/shimmeringbee/zcl/commands/local/basic"
"github.com/shimmeringbee/zda/implcaps"
"github.com/shimmeringbee/zigbee"
"strings"
"sync"
)

var _ implcaps.ZDACapability = (*Implementation)(nil)
var _ capabilities.DeviceWorkarounds = (*Implementation)(nil)

func NewDeviceWorkaround(zi implcaps.ZDAInterface) *Implementation {
return &Implementation{zi: zi, m: &sync.RWMutex{}}
}

type Implementation struct {
s persistence.Section
d da.Device
zi implcaps.ZDAInterface

m *sync.RWMutex
workaroundsEnabled []string
}

func (i *Implementation) Capability() da.Capability {
return capabilities.DeviceWorkaroundsFlag
}

func (i *Implementation) Name() string {
return capabilities.StandardNames[capabilities.DeviceWorkaroundsFlag]
}

func (i *Implementation) Init(d da.Device, s persistence.Section) {
i.d = d
i.s = s
}

func (i *Implementation) Load(ctx context.Context) (bool, error) {
i.m.Lock()
defer i.m.Unlock()

i.workaroundsEnabled = i.s.Section("Workarounds").SectionKeys()

for _, workaround := range i.workaroundsEnabled {
if err := i.loadWorkaround(ctx, workaround); err != nil {
return false, err
}
}

return true, nil
}

func (i *Implementation) Enumerate(ctx context.Context, m map[string]any) (bool, error) {
var workarounds []string

for k, _ := range m {
if strings.HasPrefix(k, "Enable") {
workarounds = append(workarounds, k)
}
}

i.m.Lock()
i.workaroundsEnabled = workarounds
i.m.Unlock()

for _, workaround := range workarounds {
if err := i.enumerateWorkaround(ctx, m, workaround); err != nil {
return false, err
}
}

return true, nil
}

func (i *Implementation) Detach(ctx context.Context, detachType implcaps.DetachType) error {
i.m.Lock()
defer i.m.Unlock()

for _, workaround := range i.workaroundsEnabled {
if err := i.detachWorkaround(ctx, detachType, workaround); err != nil {
return err
}
}

return nil
}

func (i *Implementation) ImplName() string {
return "GenericDeviceWorkarounds"
}

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

return i.workaroundsEnabled
}

func (i *Implementation) loadWorkaround(ctx context.Context, workaround string) error {
return nil
}

func (i *Implementation) detachWorkaround(ctx context.Context, detachType implcaps.DetachType, workaround string) error {
return nil
}

func (i *Implementation) enumerateWorkaround(ctx context.Context, m map[string]any, workaround string) error {
switch workaround {
case "EnableZCLReportingKeepAlive":
return i.enumerateZCLReportingKeepAlive(ctx, m)
}

return nil
}

func (i *Implementation) enumerateZCLReportingKeepAlive(ctx context.Context, m map[string]any) error {
remoteEndpoint := implcaps.Get(m, "ZigbeeEndpoint", zigbee.Endpoint(1))

ieeeAddress, localEndpoint, ack, seq := i.zi.TransmissionLookup(i.d, zigbee.ProfileHomeAutomation)

if err := i.zi.NodeBinder().BindNodeToController(ctx, ieeeAddress, localEndpoint, remoteEndpoint, zcl.BasicId); err != nil {
return err
}

if err := i.zi.ZCLCommunicator().ConfigureReporting(ctx, ieeeAddress, ack, zcl.BasicId, zigbee.NoManufacturer, localEndpoint, remoteEndpoint, seq, basic.ZCLVersion, zcl.TypeUnsignedInt8, uint16(60), uint16(240), 0); err != nil {
return err
}

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

return nil
}
63 changes: 63 additions & 0 deletions implcaps/generic/device_workarounds/impl_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
package device_workaround

import (
"github.com/shimmeringbee/da/capabilities"
"github.com/shimmeringbee/da/mocks"
"github.com/shimmeringbee/persistence/impl/memory"
"github.com/shimmeringbee/zcl"
"github.com/shimmeringbee/zcl/commands/local/basic"
"github.com/shimmeringbee/zda/implcaps"
mocks2 "github.com/shimmeringbee/zda/mocks"
"github.com/shimmeringbee/zigbee"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/mock"
"testing"
)

func TestImplementation_BaseFunctions(t *testing.T) {
t.Run("basic static functions respond correctly", func(t *testing.T) {
i := NewDeviceWorkaround(nil)

assert.Equal(t, capabilities.DeviceWorkaroundsFlag, i.Capability())
assert.Equal(t, capabilities.StandardNames[capabilities.DeviceWorkaroundsFlag], i.Name())
assert.Equal(t, "GenericDeviceWorkarounds", i.ImplName())
})
}

func TestImplementation_EnableZCLReportingKeepAlive(t *testing.T) {
t.Run("configures reporting for ZCLVersion on Enumeration", func(t *testing.T) {
mzi := &implcaps.MockZDAInterface{}
defer mzi.AssertExpectations(t)

mnb := &zigbee.MockProvider{}
defer mnb.AssertExpectations(t)

md := &mocks.MockDevice{}
defer md.AssertExpectations(t)

mzc := &mocks2.MockZCLCommunicator{}
defer mzc.AssertExpectations(t)

mzi.On("NodeBinder").Return(mnb)
mzi.On("ZCLCommunicator").Return(mzc)

ieee := zigbee.GenerateLocalAdministeredIEEEAddress()

mzi.On("TransmissionLookup", md, zigbee.ProfileHomeAutomation).Return(ieee, zigbee.Endpoint(2), false, 4)

mnb.On("BindNodeToController", mock.Anything, ieee, zigbee.Endpoint(2), zigbee.Endpoint(3), zcl.BasicId).Return(nil)

mzc.On("ConfigureReporting", mock.Anything, ieee, false, zcl.BasicId, zigbee.NoManufacturer, zigbee.Endpoint(2), zigbee.Endpoint(3), uint8(4), basic.ZCLVersion, zcl.TypeUnsignedInt8, uint16(60), uint16(240), 0).Return(nil)

s := memory.New()
i := NewDeviceWorkaround(mzi)
i.Init(md, s)

attached, err := i.Enumerate(nil, map[string]any{"EnableZCLReportingKeepAlive": true, "ZigbeeEndpoint": zigbee.Endpoint(3)})
assert.NoError(t, err)
assert.True(t, attached)

ws := s.Section("Workarounds")
assert.Contains(t, ws.SectionKeys(), "ZCLReportingKeepAlive")
})
}
Loading

0 comments on commit 5e9da94

Please sign in to comment.