mirror of
https://github.com/nikdoof/hapz2m.git
synced 2026-01-30 03:28:18 +00:00
Fix access check for light expose features
Some dimmers expose features with state|set instead of state|get|set. Relax the check to cater for more light/dimmers.
This commit is contained in:
@@ -22,7 +22,7 @@ func createLightServices(dev *Device) (byte, []*service.S, []*ExposeMapping, err
|
|||||||
light := service.NewLightbulb()
|
light := service.NewLightbulb()
|
||||||
|
|
||||||
for _, feat := range exp.Features {
|
for _, feat := range exp.Features {
|
||||||
if !feat.IsStateSetGet() {
|
if !feat.IsStateSettable() {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
4
z2m.go
4
z2m.go
@@ -423,7 +423,9 @@ 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
|
// 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) IsStateSetGet() bool { return e.Access == 0b111 }
|
||||||
func (e *ExposesEntry) IsSettable() bool { return e.Access&0b10 == 0b10 }
|
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
|
// Updates MinVal, MaxVal and StepVal for the Characteristic
|
||||||
func (e *ExposesEntry) CopyValueRanges(c *characteristic.C) error {
|
func (e *ExposesEntry) CopyValueRanges(c *characteristic.C) error {
|
||||||
|
|||||||
Reference in New Issue
Block a user