add filtering to tags. E.g. Hue,Namrom+Gisle will return all with either of the former AND the latter. - will do the opposite.

This commit is contained in:
2021-09-21 17:51:28 +02:00
parent 38d777404b
commit 4fd49d0480
2 changed files with 58 additions and 1 deletions
+12
View File
@@ -99,6 +99,18 @@ func (d *Device) Validate() error {
return nil
}
func (d *Device) HasTag(tags ...string) bool {
for _, c := range d.Tags {
for _, c2 := range tags {
if c == c2 {
return true
}
}
}
return false
}
func (d *Device) HasCapability(capabilities ...DeviceCapability) bool {
for _, c := range d.Capabilities {
for _, c2 := range capabilities {