diff --git a/s_light.go b/s_light.go index 4b86b64..7809c5f 100644 --- a/s_light.go +++ b/s_light.go @@ -22,7 +22,7 @@ func createLightServices(dev *Device) (byte, []*service.S, []*ExposeMapping, err light := service.NewLightbulb() for _, feat := range exp.Features { - if !feat.IsStateSetGet() { + if !feat.IsStateSettable() { continue } diff --git a/z2m.go b/z2m.go index b16f24c..9ea650b 100644 --- a/z2m.go +++ b/z2m.go @@ -422,8 +422,10 @@ type ExposesEntry struct { func (e *ExposesEntry) Ignored() bool { return IgnoreProperties[e.Name] } // https://github.com/Koenkk/zigbee-herdsman-converters/blob/v15.0.0/lib/exposes.js#L458-L486 -func (e *ExposesEntry) IsStateSetGet() bool { return e.Access == 0b111 } -func (e *ExposesEntry) IsSettable() bool { return e.Access&0b10 == 0b10 } +func (e *ExposesEntry) IsStateSetGet() bool { return e.Access == 0b111 } +func (e *ExposesEntry) IsStateSettable() bool { return e.hasAccessBits(0b11) } +func (e *ExposesEntry) IsSettable() bool { return e.hasAccessBits(0b10) } +func (e *ExposesEntry) hasAccessBits(bits int) bool { return e.Access&bits == bits } // Updates MinVal, MaxVal and StepVal for the Characteristic func (e *ExposesEntry) CopyValueRanges(c *characteristic.C) error {