From 0427e5a3345c75bcac9c8b2e6e9bc03ecb3965ff Mon Sep 17 00:00:00 2001 From: Paul Bottein Date: Mon, 6 Feb 2023 16:10:14 +0000 Subject: [PATCH 1/4] Add documentation for entity and device filters --- source/_docs/blueprint/selectors.markdown | 82 ++++++++++++++++++++--- 1 file changed, 72 insertions(+), 10 deletions(-) diff --git a/source/_docs/blueprint/selectors.markdown b/source/_docs/blueprint/selectors.markdown index e4f0b6a9c124..17cf7ffb3156 100644 --- a/source/_docs/blueprint/selectors.markdown +++ b/source/_docs/blueprint/selectors.markdown @@ -162,8 +162,10 @@ entity: device_class: description: > Limits the list of areas to areas that have entities with a certain - device class, for example, `motion` or `window`. - type: device_class + device class(es), for example, `motion` or `window`. Can be either a string + with a single device_class, or a list of string device_class to limit + the selection to. + type: [device_class, list] required: false multiple: description: > @@ -397,8 +399,35 @@ entity: device_class: description: > Limits the list of entities to entities that have a certain device - class, for example, `motion` or `window`. - type: device_class + class(es), for example, `motion` or `window`. Can be either a string + with a single device_class, or a list of string device_class to limit + the selection to. + type: [device_class, list] + required: false +filter: + description: > + When filter options are provided, the list of devices is filtered by devices + that at least provide one entity that matches the given conditions. Can be either + a object or a list of object. + type: map + required: false + keys: + integration: + description: > + Can be set to an integration domain. Limits the list of devices to devices + provided by the set integration domain. + type: string + required: false + manufacturer: + description: > + When set, it limits the list of devices to devices provided by the set + manufacturer name. + type: string + required: false + model: + description: > + When set, it limits the list of devices to devices that have the set model. + type: string required: false multiple: description: > @@ -517,10 +546,42 @@ domain: required: false device_class: description: > - Limits the list of entities to entities that have a certain device class, - for example, `motion` or `window`. - type: device_class + Limits the list of entities to entities that have a certain device class(es), + for example, `motion` or `window`. Can be either a string with a single device_class, + or a list of string device_class to limit the selection to. + type: [device_class, list] required: false +filter: + description: > + When filter options are provided, the entities are limited by entities + that at least match the given conditions. Can be either a object or a list of object. + Can be either a object or a list of object. + type: map + required: false + keys: + integration: + description: > + Can be set to an integration domain. Limits the list of entities to entities + provided by the set integration domain, for example, + [`zha`](/integrations/zha). + type: string + required: false + domain: + description: > + Limits the list of entities to entities of a certain domain(s), for example, + [`light`](/integrations/light) or + [`binary_sensor`](/integrations/binary_sensor). Can be either a string + with a single domain, or a list of string domains to limit the selection + to. + type: [string, list] + required: false + device_class: + description: > + Limits the list of entities to entities that have a certain device class(es), + for example, `motion` or `window`. Can be either a string with a single device_class, + or a list of string device_class to limit the selection to. + type: [device_class, list] + required: false multiple: description: > Allows selecting multiple entities. If set to `true`, the resulting value of @@ -940,9 +1001,10 @@ entity: required: false device_class: description: > - Limits the targets to entities with a certain - device class, for example, `motion` or `window`. - type: device_class + Limits the targets to entities with a certain device class(es), for example, + `motion` or `window`. Can be either a string with a single device_class, + or a list of string device_class to limit the selection to. + type: [device_class, list] required: false {% endconfiguration %} From 85285777308f1c94564c0494938817357ad32d73 Mon Sep 17 00:00:00 2001 From: Paul Bottein Date: Mon, 6 Feb 2023 17:13:16 +0000 Subject: [PATCH 2/4] Allow array of entity or device options --- source/_docs/blueprint/selectors.markdown | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/source/_docs/blueprint/selectors.markdown b/source/_docs/blueprint/selectors.markdown index 17cf7ffb3156..f7c8ecaf4e24 100644 --- a/source/_docs/blueprint/selectors.markdown +++ b/source/_docs/blueprint/selectors.markdown @@ -115,7 +115,8 @@ area: device: description: > When device options are provided, the list of areas is filtered by areas - that at least provide one device that matches the given conditions. + that at least provide one device that matches the given conditions. Can be + either a object or a list of object. type: map keys: integration: @@ -140,7 +141,8 @@ device: entity: description: > When entity options are provided, the list of areas is filtered by areas - that at least provide one entity that matches the given conditions. + that at least provide one entity that matches the given conditions. Can be + either a object or a list of object. type: map required: false keys: @@ -376,7 +378,8 @@ model: entity: description: > When entity options are provided, the list of devices is filtered by devices - that at least provide one entity that matches the given conditions. + that at least provide one entity that matches the given conditions. Can be + either a object or a list of object. type: map required: false keys: @@ -956,7 +959,8 @@ target: device: description: > When device options are provided, the targets are limited by devices - that at least match the given conditions. + that at least match the given conditions. Can be either a object or a list + of object. type: map keys: integration: @@ -979,7 +983,8 @@ device: entity: description: > When entity options are provided, the targets are limited by entities - that at least match the given conditions. + that at least match the given conditions. Can be either a object or a list + of object. type: map required: false keys: From 43e8cb45ca01758f198653fbb27cb8497f3f3a4e Mon Sep 17 00:00:00 2001 From: Paul Bottein Date: Tue, 7 Feb 2023 09:34:36 +0000 Subject: [PATCH 3/4] Remove deprecated options --- source/_docs/blueprint/selectors.markdown | 54 ++++------------------- 1 file changed, 8 insertions(+), 46 deletions(-) diff --git a/source/_docs/blueprint/selectors.markdown b/source/_docs/blueprint/selectors.markdown index f7c8ecaf4e24..fd034bf2110f 100644 --- a/source/_docs/blueprint/selectors.markdown +++ b/source/_docs/blueprint/selectors.markdown @@ -358,23 +358,6 @@ device: ``` {% configuration device %} -integration: - description: > - Can be set to an integration domain. Limits the list of devices to devices - provided by the set integration domain. - type: string - required: false -manufacturer: - description: > - When set, it limits the list of devices to devices provided by the set - manufacturer name. - type: string - required: false -model: - description: > - When set, it limits the list of devices to devices that have the set model. - type: string - required: false entity: description: > When entity options are provided, the list of devices is filtered by devices @@ -465,9 +448,10 @@ And this is what is looks like in YAML: ```yaml device: - integration: deconz - manufacturer: Philips - model: RWL021 + filter: + integration: deconz + manufacturer: Philips + model: RWL021 entity: domain: sensor device_class: battery @@ -531,29 +515,6 @@ include_entities: description: List of entity IDs to limit the selectable list to. type: list required: false -integration: - description: > - Can be set to an integration domain. Limits the list of entities to entities - provided by the set integration domain, for example, - [`zha`](/integrations/zha). - type: string - required: false -domain: - description: > - Limits the list of entities to entities of a certain domain(s), for example, - [`light`](/integrations/light) or - [`binary_sensor`](/integrations/binary_sensor). Can be either a string - with a single domain, or a list of string domains to limit the selection - to. - type: [string, list] - required: false -device_class: - description: > - Limits the list of entities to entities that have a certain device class(es), - for example, `motion` or `window`. Can be either a string with a single device_class, - or a list of string device_class to limit the selection to. - type: [device_class, list] - required: false filter: description: > When filter options are provided, the entities are limited by entities @@ -620,9 +581,10 @@ And this is what it looks like in YAML: ```yaml entity: multiple: true - integration: zha - domain: binary_sensor - device_class: motion + filter: + integration: zha + domain: binary_sensor + device_class: motion ``` ## Icon selector From 096246c1a6470bf9a93f43c677a4610c3b981686 Mon Sep 17 00:00:00 2001 From: Paul Bottein Date: Thu, 9 Mar 2023 11:35:15 +0000 Subject: [PATCH 4/4] Convert to list --- source/_docs/blueprint/selectors.markdown | 47 +++++++++++------------ 1 file changed, 23 insertions(+), 24 deletions(-) diff --git a/source/_docs/blueprint/selectors.markdown b/source/_docs/blueprint/selectors.markdown index fd034bf2110f..f81b5e432a3e 100644 --- a/source/_docs/blueprint/selectors.markdown +++ b/source/_docs/blueprint/selectors.markdown @@ -117,7 +117,7 @@ device: When device options are provided, the list of areas is filtered by areas that at least provide one device that matches the given conditions. Can be either a object or a list of object. - type: map + type: list keys: integration: description: > @@ -143,7 +143,7 @@ entity: When entity options are provided, the list of areas is filtered by areas that at least provide one entity that matches the given conditions. Can be either a object or a list of object. - type: map + type: list required: false keys: integration: @@ -212,10 +212,9 @@ integration. Multiple areas can be selected. area: multiple: true device: - multiple: true - integration: deconz - manufacturer: IKEA of Sweden - model: TRADFRI remote control + - integration: deconz + manufacturer: IKEA of Sweden + model: TRADFRI remote control ``` ## Attribute selector @@ -363,7 +362,7 @@ entity: When entity options are provided, the list of devices is filtered by devices that at least provide one entity that matches the given conditions. Can be either a object or a list of object. - type: map + type: list required: false keys: integration: @@ -395,7 +394,7 @@ filter: When filter options are provided, the list of devices is filtered by devices that at least provide one entity that matches the given conditions. Can be either a object or a list of object. - type: map + type: list required: false keys: integration: @@ -449,12 +448,12 @@ And this is what is looks like in YAML: ```yaml device: filter: - integration: deconz - manufacturer: Philips - model: RWL021 + - integration: deconz + manufacturer: Philips + model: RWL021 entity: - domain: sensor - device_class: battery + - domain: sensor + device_class: battery ``` ## Duration selector @@ -520,7 +519,7 @@ filter: When filter options are provided, the entities are limited by entities that at least match the given conditions. Can be either a object or a list of object. Can be either a object or a list of object. - type: map + type: list required: false keys: integration: @@ -582,9 +581,9 @@ And this is what it looks like in YAML: entity: multiple: true filter: - integration: zha - domain: binary_sensor - device_class: motion + - integration: zha + domain: binary_sensor + device_class: motion ``` ## Icon selector @@ -923,7 +922,7 @@ device: When device options are provided, the targets are limited by devices that at least match the given conditions. Can be either a object or a list of object. - type: map + type: list keys: integration: description: > @@ -947,7 +946,7 @@ entity: When entity options are provided, the targets are limited by entities that at least match the given conditions. Can be either a object or a list of object. - type: map + type: list required: false keys: integration: @@ -996,8 +995,8 @@ or more lights, provided by the [ZHA](/integrations/zha) integration. ```yaml target: entity: - integration: zha - domain: light + - integration: zha + domain: light ``` Another example using the target selector, which only shows targets that @@ -1007,9 +1006,9 @@ provide one or more remote controls, provided by the ```yaml target: device: - integration: deconz - manufacturer: IKEA of Sweden - model: TRADFRI remote control + - integration: deconz + manufacturer: IKEA of Sweden + model: TRADFRI remote control ``` ## Template selector