Skip to content

Commit

Permalink
Update to latest persistence.
Browse files Browse the repository at this point in the history
  • Loading branch information
pwood committed Jun 15, 2024
1 parent 5b8793e commit 9fe9721
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 14 deletions.
5 changes: 1 addition & 4 deletions enumerate_device.go
Original file line number Diff line number Diff line change
Expand Up @@ -412,10 +412,7 @@ func (e enumerateDevice) enumerateCapabilityOnDevice(ctx context.Context, d *dev
}

section := e.gw.sectionForDevice(d.address).Section("capability", capabilities.StandardNames[cF])
if err := section.Set("implementation", capImplName); err != nil {
e.logger.LogError(ctx, "Failed to set value on capability persistence.", logwrap.Err(err))
return false, []error{fmt.Errorf("failed to find set value on persistence: %w", err)}
}
section.Set("implementation", capImplName)

c.Init(d, section.Section("data"))
}
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ require (
github.com/shimmeringbee/callbacks v0.0.0-20221001135028-b85b5f89d5d6
github.com/shimmeringbee/da v0.0.0-20240510193548-c78db0273744
github.com/shimmeringbee/logwrap v0.1.3
github.com/shimmeringbee/persistence v0.0.0-20240614163143-a99424e4d61c
github.com/shimmeringbee/persistence v0.0.0-20240615120714-a567d1ac9349
github.com/shimmeringbee/retry v0.0.0-20221006193055-2ce01bf139c2
github.com/shimmeringbee/zcl v0.0.0-20240614085730-dc48ec71c312
github.com/shimmeringbee/zigbee v0.0.0-20240614103911-3a30074e1528
Expand Down
4 changes: 4 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,10 @@ github.com/shimmeringbee/logwrap v0.1.3 h1:1PqPGdgbeQxACQqc6RUWERn7EnpA1jbiHzXVY
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/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/zcl v0.0.0-20240614085730-dc48ec71c312 h1:OoFxM9W299ESRnPSR3NoK4+AmWz5PzcJ4gJFZ62nkZ0=
Expand Down
8 changes: 4 additions & 4 deletions implcaps/generic/product_information.go
Original file line number Diff line number Diff line change
Expand Up @@ -64,16 +64,16 @@ func (g *ProductInformation) Enumerate(_ context.Context, m map[string]any) (boo
switch k {
case "Name":
newPI.Name = stringV
_ = g.s.Set("Name", stringV)
g.s.Set("Name", stringV)
case "Manufacturer":
newPI.Manufacturer = stringV
_ = g.s.Set("Manufacturer", stringV)
g.s.Set("Manufacturer", stringV)
case "Version":
newPI.Version = stringV
_ = g.s.Set("Version", stringV)
g.s.Set("Version", stringV)
case "Serial":
newPI.Serial = stringV
_ = g.s.Set("Serial", stringV)
g.s.Set("Serial", stringV)
}
}

Expand Down
10 changes: 5 additions & 5 deletions provider_load_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,13 @@ func Test_gateway_providerLoad(t *testing.T) {
dS := g.sectionForDevice(id)

cS := dS.Section("capability", "ProductInformation")
_ = cS.Set("implementation", "GenericProductInformation")
cS.Set("implementation", "GenericProductInformation")

daS := cS.Section("data")
_ = daS.Set("Name", "NEXUS-7")
_ = daS.Set("Manufacturer", "Tyrell Corporation")
_ = daS.Set("Serial", "N7FAA52318")
_ = daS.Set("Version", "1.0.0")
daS.Set("Name", "NEXUS-7")
daS.Set("Manufacturer", "Tyrell Corporation")
daS.Set("Serial", "N7FAA52318")
daS.Set("Version", "1.0.0")

g.providerLoad()

Expand Down

0 comments on commit 9fe9721

Please sign in to comment.