From b47bb8b929f466c26b3fc4a03c0d2c633d786b71 Mon Sep 17 00:00:00 2001 From: Ian Richardson Date: Sun, 20 Oct 2019 20:33:02 -0500 Subject: [PATCH 1/5] custom badges and state-badge actions --- .../_lovelace/_badges/entity-filter.markdown | 104 +++++++++++ source/_lovelace/_badges/state-label.markdown | 171 ++++++++++++++++++ source/_lovelace/picture-elements.markdown | 105 +++++++++++ source/lovelace/views.markdown | 23 --- 4 files changed, 380 insertions(+), 23 deletions(-) create mode 100644 source/_lovelace/_badges/entity-filter.markdown create mode 100644 source/_lovelace/_badges/state-label.markdown diff --git a/source/_lovelace/_badges/entity-filter.markdown b/source/_lovelace/_badges/entity-filter.markdown new file mode 100644 index 000000000000..cda92dd9325a --- /dev/null +++ b/source/_lovelace/_badges/entity-filter.markdown @@ -0,0 +1,104 @@ +--- +title: "Entity Filter Badge" +sidebar_label: Entity Filter +description: "This badge allows you to define a list of entities that you want to track only when in a certain state. Very useful for showing lights that you forgot to turn off or show a list of people only when they're at home. " +--- + +This badge allows you to define a list of entities that you want to track only when in a certain state. Very useful for showing lights that you forgot to turn off or show a list of people only when they're at home. + +{% configuration %} +type: + required: true + description: entity-filter + type: string +entities: + required: true + description: A list of entity IDs or `entity` objects, see below. + type: list +state_filter: + required: true + description: List of strings representing states or `filter` objects, see below. + type: list +{% endconfiguration %} + +## Options For Entities + +If you define entities as objects instead of strings (by adding `entity:` before entity ID), you can add more customization and configurations: + +{% configuration %} +type: + required: false + description: "Sets a custom badge type: `custom:my-custom-badge`" + type: string +entity: + required: true + description: Home Assistant entity ID. + type: string +name: + required: false + description: Overwrites friendly name. + type: string +icon: + required: false + description: Overwrites icon or entity picture. + type: string +image: + required: false + description: The URL of an image. + type: string +state_filter: + required: false + description: List of strings representing states or `filter` objects, see below. + type: list +{% endconfiguration %} + +## Options For state_filter + +If you define state_filter as objects instead of strings (by adding `value:` before your state value), you can add more customization to your filter: + +{% configuration %} +value: + required: true + description: String representing the state. + type: string +operator: + required: false + description: Operator to use in the comparison. Can be `==`, `<=`, `<`, `>=`, `>`, `!=` or `regex`. + type: string +attribute: + required: false + description: Attribute of the entity to use instead of the state. + type: string +{% endconfiguration %} + +### Examples + +Show only active switches or lights in the house +```yaml +type: entity-filter +entities: + - entity: light.bed_light + name: Bed + - light.kitchen_lights + - light.ceiling_lights +state_filter: + - "on" +``` + +Specify filter for a single entity + +```yaml +type: entity-filter +state_filter: + - "on" + - operator: ">" + value: 90 +entities: + - sensor.water_leak + - sensor.outside_temp + - entity: sensor.humidity_and_temp + state_filter: + - operator: ">" + value: 50 + attribute: humidity +``` diff --git a/source/_lovelace/_badges/state-label.markdown b/source/_lovelace/_badges/state-label.markdown new file mode 100644 index 000000000000..896d459404d5 --- /dev/null +++ b/source/_lovelace/_badges/state-label.markdown @@ -0,0 +1,171 @@ +--- +title: "State Label Badge" +sidebar_label: State Label +description: "The State Label badge allows you to dislay a state badge" +--- + +The State Label badge allows you to dislay a state badge + +```yaml +type: state-label +entity: light.living_room +``` + +{% configuration %} +type: + required: true + description: entity-button + type: string +entity: + required: true + description: Home Assistant entity ID. + type: string +name: + required: false + description: Overwrites friendly name. + type: string + default: Name of Entity +icon: + required: false + description: Overwrites icon or entity picture. + type: string + default: Entity Domain Icon +show_name: + required: false + description: Show name. + type: boolean + default: "true" +show_icon: + required: false + description: Show icon. + type: boolean + default: "true" +tap_action: + required: false + description: Action to take on tap + type: map + keys: + action: + required: true + description: "Action to perform (`more-info`, `toggle`, `call-service`, `navigate`, `url`, `none`)" + type: string + default: "`toggle`" + navigation_path: + required: false + description: "Path to navigate to (e.g. `/lovelace/0/`) when `action` defined as `navigate`" + type: string + default: none + url_path: + required: false + description: "Path to navigate to (e.g. `https://www.home-assistant.io`) when `action` defined as `url`" + type: string + default: none + service: + required: false + description: "Service to call (e.g. `media_player.media_play_pause`) when `action` defined as `call-service`" + type: string + default: none + service_data: + required: false + description: "Service data to include (e.g. `entity_id: media_player.bedroom`) when `action` defined as `call-service`" + type: string + default: none + confirmation: + required: false + description: "Present a confirmation dialog to confirm the action. See `confirmation` object below" + type: [boolean, map] + default: "false" +hold_action: + required: false + description: Action to take on tap-and-hold + type: map + keys: + action: + required: true + description: "Action to perform (`more-info`, `toggle`, `call-service`, `navigate`, `url`, `none`)" + type: string + default: "`more-info`" + navigation_path: + required: false + description: "Path to navigate to (e.g. `/lovelace/0/`) when `action` defined as `navigate`" + type: string + default: none + url_path: + required: false + description: "Path to navigate to (e.g. `https://www.home-assistant.io`) when `action` defined as `url`" + type: string + default: none + service: + required: false + description: "Service to call (e.g. `media_player.media_play_pause`) when `action` defined as `call-service`" + type: string + default: none + service_data: + required: false + description: "Service data to include (e.g. `entity_id: media_player.bedroom`) when `action` defined as `call-service`" + type: string + default: none + confirmation: + required: false + description: "Present a confirmation dialog to confirm the action. See `confirmation` object below" + type: [boolean, map] + default: "false" +double_tap_action: + required: false + description: Action to take on double tap + type: map + keys: + action: + required: true + description: "Action to perform (`more-info`, `toggle`, `call-service`, `navigate`, `url`, `none`)" + type: string + default: "`more-info`" + navigation_path: + required: false + description: "Path to navigate to (e.g. `/lovelace/0/`) when `action` defined as `navigate`" + type: string + default: none + url_path: + required: false + description: "Path to navigate to (e.g. `https://www.home-assistant.io`) when `action` defined as `url`" + type: string + default: none + service: + required: false + description: "Service to call (e.g. `media_player.media_play_pause`) when `action` defined as `call-service`" + type: string + default: none + service_data: + required: false + description: "Service data to include (e.g. `entity_id: media_player.bedroom`) when `action` defined as `call-service`" + type: string + default: none + confirmation: + required: false + description: "Present a confirmation dialog to confirm the action. See `confirmation` object below" + type: [boolean, map] + default: "false" +{% endconfiguration %} + +## Options For Confirmation + +If you define confirmation as an object instead of boolean, you can add more customization and configurations: +{% configuration %} +text: + required: false + description: Text to present in the confirmation dialog. + type: string +exemptions: + required: false + description: "List of `exemption` objects. See below" + type: list +{% endconfiguration %} + +## Options For Exemptions + +{% configuration badges %} +user: + required: true + description: User id that can see the view tab. + type: string +{% endconfiguration %} diff --git a/source/_lovelace/picture-elements.markdown b/source/_lovelace/picture-elements.markdown index 62feacd31db7..fdea3ed7d1fb 100644 --- a/source/_lovelace/picture-elements.markdown +++ b/source/_lovelace/picture-elements.markdown @@ -58,6 +58,111 @@ title: required: false description: State badge tooltip. Set to null to hide. type: string +tap_action: + required: false + description: Action to take on tap + type: map + keys: + action: + required: true + description: "Action to perform (`more-info`, `toggle`, `call-service`, `navigate`, `url`, `none`)" + type: string + default: "`toggle`" + navigation_path: + required: false + description: "Path to navigate to (e.g. `/lovelace/0/`) when `action` defined as `navigate`" + type: string + default: none + url_path: + required: false + description: "Path to navigate to (e.g. `https://www.home-assistant.io`) when `action` defined as `url`" + type: string + default: none + service: + required: false + description: "Service to call (e.g. `media_player.media_play_pause`) when `action` defined as `call-service`" + type: string + default: none + service_data: + required: false + description: "Service data to include (e.g. `entity_id: media_player.bedroom`) when `action` defined as `call-service`" + type: string + default: none + confirmation: + required: false + description: "Present a confirmation dialog to confirm the action. See `confirmation` object below" + type: [boolean, map] + default: "false" +hold_action: + required: false + description: Action to take on tap-and-hold + type: map + keys: + action: + required: true + description: "Action to perform (`more-info`, `toggle`, `call-service`, `navigate`, `url`, `none`)" + type: string + default: "`more-info`" + navigation_path: + required: false + description: "Path to navigate to (e.g. `/lovelace/0/`) when `action` defined as `navigate`" + type: string + default: none + url_path: + required: false + description: "Path to navigate to (e.g. `https://www.home-assistant.io`) when `action` defined as `url`" + type: string + default: none + service: + required: false + description: "Service to call (e.g. `media_player.media_play_pause`) when `action` defined as `call-service`" + type: string + default: none + service_data: + required: false + description: "Service data to include (e.g. `entity_id: media_player.bedroom`) when `action` defined as `call-service`" + type: string + default: none + confirmation: + required: false + description: "Present a confirmation dialog to confirm the action. See `confirmation` object below" + type: [boolean, map] + default: "false" +double_tap_action: + required: false + description: Action to take on double tap + type: map + keys: + action: + required: true + description: "Action to perform (`more-info`, `toggle`, `call-service`, `navigate`, `url`, `none`)" + type: string + default: "`more-info`" + navigation_path: + required: false + description: "Path to navigate to (e.g. `/lovelace/0/`) when `action` defined as `navigate`" + type: string + default: none + url_path: + required: false + description: "Path to navigate to (e.g. `https://www.home-assistant.io`) when `action` defined as `url`" + type: string + default: none + service: + required: false + description: "Service to call (e.g. `media_player.media_play_pause`) when `action` defined as `call-service`" + type: string + default: none + service_data: + required: false + description: "Service data to include (e.g. `entity_id: media_player.bedroom`) when `action` defined as `call-service`" + type: string + default: none + confirmation: + required: false + description: "Present a confirmation dialog to confirm the action. See `confirmation` object below" + type: [boolean, map] + default: "false" {% endconfiguration %} ### Icon representing an entity state diff --git a/source/lovelace/views.markdown b/source/lovelace/views.markdown index 1d5f4d1107cb..611df455b721 100644 --- a/source/lovelace/views.markdown +++ b/source/lovelace/views.markdown @@ -57,29 +57,6 @@ views: default: true {% endconfiguration %} -## Options For Badges - -If you define badges as objects instead of strings (by adding `entity:` before entity ID), allowing you to add more customizations: - -{% configuration badges %} -entity: - required: true - description: Home Assistant entity ID. - type: string -name: - required: false - description: Overwrites friendly name. - type: string -icon: - required: false - description: Overwrites icon or entity picture. - type: string -image: - required: false - description: The URL of an image. - type: string -{% endconfiguration %} - ## Options For Visible If you define `visible` as objects instead of a boolean to specify conditions for displaying the view tab: From 177d9dbba976dc36ae78442623e57228b0e85b31 Mon Sep 17 00:00:00 2001 From: Ian Richardson Date: Wed, 23 Oct 2019 12:06:45 -0500 Subject: [PATCH 2/5] address comments --- .../_lovelace/_badges/entity-filter.markdown | 104 ----- source/_lovelace/_badges/state-label.markdown | 171 -------- source/lovelace/views.markdown | 366 +++++++++++++++--- 3 files changed, 319 insertions(+), 322 deletions(-) delete mode 100644 source/_lovelace/_badges/entity-filter.markdown delete mode 100644 source/_lovelace/_badges/state-label.markdown diff --git a/source/_lovelace/_badges/entity-filter.markdown b/source/_lovelace/_badges/entity-filter.markdown deleted file mode 100644 index cda92dd9325a..000000000000 --- a/source/_lovelace/_badges/entity-filter.markdown +++ /dev/null @@ -1,104 +0,0 @@ ---- -title: "Entity Filter Badge" -sidebar_label: Entity Filter -description: "This badge allows you to define a list of entities that you want to track only when in a certain state. Very useful for showing lights that you forgot to turn off or show a list of people only when they're at home. " ---- - -This badge allows you to define a list of entities that you want to track only when in a certain state. Very useful for showing lights that you forgot to turn off or show a list of people only when they're at home. - -{% configuration %} -type: - required: true - description: entity-filter - type: string -entities: - required: true - description: A list of entity IDs or `entity` objects, see below. - type: list -state_filter: - required: true - description: List of strings representing states or `filter` objects, see below. - type: list -{% endconfiguration %} - -## Options For Entities - -If you define entities as objects instead of strings (by adding `entity:` before entity ID), you can add more customization and configurations: - -{% configuration %} -type: - required: false - description: "Sets a custom badge type: `custom:my-custom-badge`" - type: string -entity: - required: true - description: Home Assistant entity ID. - type: string -name: - required: false - description: Overwrites friendly name. - type: string -icon: - required: false - description: Overwrites icon or entity picture. - type: string -image: - required: false - description: The URL of an image. - type: string -state_filter: - required: false - description: List of strings representing states or `filter` objects, see below. - type: list -{% endconfiguration %} - -## Options For state_filter - -If you define state_filter as objects instead of strings (by adding `value:` before your state value), you can add more customization to your filter: - -{% configuration %} -value: - required: true - description: String representing the state. - type: string -operator: - required: false - description: Operator to use in the comparison. Can be `==`, `<=`, `<`, `>=`, `>`, `!=` or `regex`. - type: string -attribute: - required: false - description: Attribute of the entity to use instead of the state. - type: string -{% endconfiguration %} - -### Examples - -Show only active switches or lights in the house -```yaml -type: entity-filter -entities: - - entity: light.bed_light - name: Bed - - light.kitchen_lights - - light.ceiling_lights -state_filter: - - "on" -``` - -Specify filter for a single entity - -```yaml -type: entity-filter -state_filter: - - "on" - - operator: ">" - value: 90 -entities: - - sensor.water_leak - - sensor.outside_temp - - entity: sensor.humidity_and_temp - state_filter: - - operator: ">" - value: 50 - attribute: humidity -``` diff --git a/source/_lovelace/_badges/state-label.markdown b/source/_lovelace/_badges/state-label.markdown deleted file mode 100644 index 896d459404d5..000000000000 --- a/source/_lovelace/_badges/state-label.markdown +++ /dev/null @@ -1,171 +0,0 @@ ---- -title: "State Label Badge" -sidebar_label: State Label -description: "The State Label badge allows you to dislay a state badge" ---- - -The State Label badge allows you to dislay a state badge - -```yaml -type: state-label -entity: light.living_room -``` - -{% configuration %} -type: - required: true - description: entity-button - type: string -entity: - required: true - description: Home Assistant entity ID. - type: string -name: - required: false - description: Overwrites friendly name. - type: string - default: Name of Entity -icon: - required: false - description: Overwrites icon or entity picture. - type: string - default: Entity Domain Icon -show_name: - required: false - description: Show name. - type: boolean - default: "true" -show_icon: - required: false - description: Show icon. - type: boolean - default: "true" -tap_action: - required: false - description: Action to take on tap - type: map - keys: - action: - required: true - description: "Action to perform (`more-info`, `toggle`, `call-service`, `navigate`, `url`, `none`)" - type: string - default: "`toggle`" - navigation_path: - required: false - description: "Path to navigate to (e.g. `/lovelace/0/`) when `action` defined as `navigate`" - type: string - default: none - url_path: - required: false - description: "Path to navigate to (e.g. `https://www.home-assistant.io`) when `action` defined as `url`" - type: string - default: none - service: - required: false - description: "Service to call (e.g. `media_player.media_play_pause`) when `action` defined as `call-service`" - type: string - default: none - service_data: - required: false - description: "Service data to include (e.g. `entity_id: media_player.bedroom`) when `action` defined as `call-service`" - type: string - default: none - confirmation: - required: false - description: "Present a confirmation dialog to confirm the action. See `confirmation` object below" - type: [boolean, map] - default: "false" -hold_action: - required: false - description: Action to take on tap-and-hold - type: map - keys: - action: - required: true - description: "Action to perform (`more-info`, `toggle`, `call-service`, `navigate`, `url`, `none`)" - type: string - default: "`more-info`" - navigation_path: - required: false - description: "Path to navigate to (e.g. `/lovelace/0/`) when `action` defined as `navigate`" - type: string - default: none - url_path: - required: false - description: "Path to navigate to (e.g. `https://www.home-assistant.io`) when `action` defined as `url`" - type: string - default: none - service: - required: false - description: "Service to call (e.g. `media_player.media_play_pause`) when `action` defined as `call-service`" - type: string - default: none - service_data: - required: false - description: "Service data to include (e.g. `entity_id: media_player.bedroom`) when `action` defined as `call-service`" - type: string - default: none - confirmation: - required: false - description: "Present a confirmation dialog to confirm the action. See `confirmation` object below" - type: [boolean, map] - default: "false" -double_tap_action: - required: false - description: Action to take on double tap - type: map - keys: - action: - required: true - description: "Action to perform (`more-info`, `toggle`, `call-service`, `navigate`, `url`, `none`)" - type: string - default: "`more-info`" - navigation_path: - required: false - description: "Path to navigate to (e.g. `/lovelace/0/`) when `action` defined as `navigate`" - type: string - default: none - url_path: - required: false - description: "Path to navigate to (e.g. `https://www.home-assistant.io`) when `action` defined as `url`" - type: string - default: none - service: - required: false - description: "Service to call (e.g. `media_player.media_play_pause`) when `action` defined as `call-service`" - type: string - default: none - service_data: - required: false - description: "Service data to include (e.g. `entity_id: media_player.bedroom`) when `action` defined as `call-service`" - type: string - default: none - confirmation: - required: false - description: "Present a confirmation dialog to confirm the action. See `confirmation` object below" - type: [boolean, map] - default: "false" -{% endconfiguration %} - -## Options For Confirmation - -If you define confirmation as an object instead of boolean, you can add more customization and configurations: -{% configuration %} -text: - required: false - description: Text to present in the confirmation dialog. - type: string -exemptions: - required: false - description: "List of `exemption` objects. See below" - type: list -{% endconfiguration %} - -## Options For Exemptions - -{% configuration badges %} -user: - required: true - description: User id that can see the view tab. - type: string -{% endconfiguration %} diff --git a/source/lovelace/views.markdown b/source/lovelace/views.markdown index 611df455b721..4c4e00de25f3 100644 --- a/source/lovelace/views.markdown +++ b/source/lovelace/views.markdown @@ -12,49 +12,49 @@ To display cards on the UI you have to define them in views. Views sort cards in {% configuration views %} views: - required: true - description: A list of view configurations. - type: list - keys: - title: - required: true - description: The title or name. - type: string - badges: - required: false - description: List of entities IDs or `badge` objects to display as badges. - type: list - cards: - required: false - description: Cards to display in this view. - type: list - path: - required: false - description: Paths are used in the URL, more info below. - type: string - default: view index - icon: - required: false - description: Icon-name from Material Design Icons. - type: string - panel: - required: false - description: Renders the view in panel mode, more info below. - type: boolean - default: false - background: - required: false - description: Style the background using CSS, more info below. - type: string - theme: - required: false - description: Themes view and cards, more info below. - type: string - visible: - required: false - description: "Hide/show the view tab from all users or a list of individual `visible` objects." - type: [boolean, list] - default: true +required: true +description: A list of view configurations. +type: list +keys: +title: +required: true +description: The title or name. +type: string +badges: +required: false +description: List of entities IDs or `badge` objects to display as badges. +type: list +cards: +required: false +description: Cards to display in this view. +type: list +path: +required: false +description: Paths are used in the URL, more info below. +type: string +default: view index +icon: +required: false +description: Icon-name from Material Design Icons. +type: string +panel: +required: false +description: Renders the view in panel mode, more info below. +type: boolean +default: false +background: +required: false +description: Style the background using CSS, more info below. +type: string +theme: +required: false +description: Themes view and cards, more info below. +type: string +visible: +required: false +description: "Hide/show the view tab from all users or a list of individual `visible` objects." +type: [boolean, list] +default: true {% endconfiguration %} ## Options For Visible @@ -63,12 +63,182 @@ If you define `visible` as objects instead of a boolean to specify conditions fo {% configuration badges %} user: - required: true - description: User id that can see the view tab. - type: string +required: true +description: User id that can see the view tab. +type: string {% endconfiguration %} -### Example +## Badges + +### State Label Badge + +The State Label badge allows you to dislay a state badge + +```yaml +type: state-label +entity: light.living_room +``` + +{% configuration %} +type: +required: true +description: entity-button +type: string +entity: +required: true +description: Home Assistant entity ID. +type: string +name: +required: false +description: Overwrites friendly name. +type: string +default: Name of Entity +icon: +required: false +description: Overwrites icon or entity picture. +type: string +default: Entity Domain Icon +show_name: +required: false +description: Show name. +type: boolean +default: "true" +show_icon: +required: false +description: Show icon. +type: boolean +default: "true" +tap_action: +required: false +description: Action to take on tap +type: map +keys: +action: +required: true +description: "Action to perform (`more-info`, `toggle`, `call-service`, `navigate`, `url`, `none`)" +type: string +default: "`toggle`" +navigation_path: +required: false +description: "Path to navigate to (e.g. `/lovelace/0/`) when `action` defined as `navigate`" +type: string +default: none +url_path: +required: false +description: "Path to navigate to (e.g. `https://www.home-assistant.io`) when `action` defined as `url`" +type: string +default: none +service: +required: false +description: "Service to call (e.g. `media_player.media_play_pause`) when `action` defined as `call-service`" +type: string +default: none +service_data: +required: false +description: "Service data to include (e.g. `entity_id: media_player.bedroom`) when `action` defined as `call-service`" +type: string +default: none +confirmation: +required: false +description: "Present a confirmation dialog to confirm the action. See `confirmation` object below" +type: [boolean, map] +default: "false" +hold_action: +required: false +description: Action to take on tap-and-hold +type: map +keys: +action: +required: true +description: "Action to perform (`more-info`, `toggle`, `call-service`, `navigate`, `url`, `none`)" +type: string +default: "`more-info`" +navigation_path: +required: false +description: "Path to navigate to (e.g. `/lovelace/0/`) when `action` defined as `navigate`" +type: string +default: none +url_path: +required: false +description: "Path to navigate to (e.g. `https://www.home-assistant.io`) when `action` defined as `url`" +type: string +default: none +service: +required: false +description: "Service to call (e.g. `media_player.media_play_pause`) when `action` defined as `call-service`" +type: string +default: none +service_data: +required: false +description: "Service data to include (e.g. `entity_id: media_player.bedroom`) when `action` defined as `call-service`" +type: string +default: none +confirmation: +required: false +description: "Present a confirmation dialog to confirm the action. See `confirmation` object below" +type: [boolean, map] +default: "false" +double_tap_action: +required: false +description: Action to take on double tap +type: map +keys: +action: +required: true +description: "Action to perform (`more-info`, `toggle`, `call-service`, `navigate`, `url`, `none`)" +type: string +default: "`more-info`" +navigation_path: +required: false +description: "Path to navigate to (e.g. `/lovelace/0/`) when `action` defined as `navigate`" +type: string +default: none +url_path: +required: false +description: "Path to navigate to (e.g. `https://www.home-assistant.io`) when `action` defined as `url`" +type: string +default: none +service: +required: false +description: "Service to call (e.g. `media_player.media_play_pause`) when `action` defined as `call-service`" +type: string +default: none +service_data: +required: false +description: "Service data to include (e.g. `entity_id: media_player.bedroom`) when `action` defined as `call-service`" +type: string +default: none +confirmation: +required: false +description: "Present a confirmation dialog to confirm the action. See `confirmation` object below" +type: [boolean, map] +default: "false" +{% endconfiguration %} + +#### Options For Confirmation + +If you define confirmation as an object instead of boolean, you can add more customization and configurations: +{% configuration %} +text: +required: false +description: Text to present in the confirmation dialog. +type: string +exemptions: +required: false +description: "List of `exemption` objects. See below" +type: list +{% endconfiguration %} + +#### Options For Exemptions + +{% configuration badges %} +user: +required: true +description: User id that can see the view tab. +type: string +{% endconfiguration %} + +#### Example View config: @@ -83,6 +253,108 @@ View config: image: /local/lights.png ``` +### Entity Filter Badge + +This badge allows you to define a list of entities that you want to track only when in a certain state. Very useful for showing lights that you forgot to turn off or show a list of people only when they're at home. + +{% configuration %} +type: +required: true +description: entity-filter +type: string +entities: +required: true +description: A list of entity IDs or `entity` objects, see below. +type: list +state_filter: +required: true +description: List of strings representing states or `filter` objects, see below. +type: list +{% endconfiguration %} + +#### Options For Entities + +If you define entities as objects instead of strings (by adding `entity:` before entity ID), you can add more customization and configurations: + +{% configuration %} +type: +required: false +description: "Sets a custom badge type: `custom:my-custom-badge`" +type: string +entity: +required: true +description: Home Assistant entity ID. +type: string +name: +required: false +description: Overwrites friendly name. +type: string +icon: +required: false +description: Overwrites icon or entity picture. +type: string +image: +required: false +description: The URL of an image. +type: string +state_filter: +required: false +description: List of strings representing states or `filter` objects, see below. +type: list +{% endconfiguration %} + +#### Options For state_filter + +If you define state_filter as objects instead of strings (by adding `value:` before your state value), you can add more customization to your filter: + +{% configuration %} +value: +required: true +description: String representing the state. +type: string +operator: +required: false +description: Operator to use in the comparison. Can be `==`, `<=`, `<`, `>=`, `>`, `!=` or `regex`. +type: string +attribute: +required: false +description: Attribute of the entity to use instead of the state. +type: string +{% endconfiguration %} + +#### Examples + +Show only active switches or lights in the house + +```yaml +type: entity-filter +entities: + - entity: light.bed_light + name: Bed + - light.kitchen_lights + - light.ceiling_lights +state_filter: + - "on" +``` + +Specify filter for a single entity + +```yaml +type: entity-filter +state_filter: + - "on" + - operator: ">" + value: 90 +entities: + - sensor.water_leak + - sensor.outside_temp + - entity: sensor.humidity_and_temp + state_filter: + - operator: ">" + value: 50 + attribute: humidity +``` + ## Paths You can link to one view from another view by its path. For this use cards that support navigation (`navigation_path`). Do not use special characters in paths. From 034476b28721f3cd5afe05b4aaa710fbd4b70a3a Mon Sep 17 00:00:00 2001 From: Ian Richardson Date: Wed, 23 Oct 2019 12:09:22 -0500 Subject: [PATCH 3/5] format --- source/lovelace/views.markdown | 430 ++++++++++++++++----------------- 1 file changed, 215 insertions(+), 215 deletions(-) diff --git a/source/lovelace/views.markdown b/source/lovelace/views.markdown index 4c4e00de25f3..9bf7e905269d 100644 --- a/source/lovelace/views.markdown +++ b/source/lovelace/views.markdown @@ -12,49 +12,49 @@ To display cards on the UI you have to define them in views. Views sort cards in {% configuration views %} views: -required: true -description: A list of view configurations. -type: list -keys: -title: -required: true -description: The title or name. -type: string -badges: -required: false -description: List of entities IDs or `badge` objects to display as badges. -type: list -cards: -required: false -description: Cards to display in this view. -type: list -path: -required: false -description: Paths are used in the URL, more info below. -type: string -default: view index -icon: -required: false -description: Icon-name from Material Design Icons. -type: string -panel: -required: false -description: Renders the view in panel mode, more info below. -type: boolean -default: false -background: -required: false -description: Style the background using CSS, more info below. -type: string -theme: -required: false -description: Themes view and cards, more info below. -type: string -visible: -required: false -description: "Hide/show the view tab from all users or a list of individual `visible` objects." -type: [boolean, list] -default: true + required: true + description: A list of view configurations. + type: list + keys: + title: + required: true + description: The title or name. + type: string + badges: + required: false + description: List of entities IDs or `badge` objects to display as badges. + type: list + cards: + required: false + description: Cards to display in this view. + type: list + path: + required: false + description: Paths are used in the URL, more info below. + type: string + default: view index + icon: + required: false + description: Icon-name from Material Design Icons. + type: string + panel: + required: false + description: Renders the view in panel mode, more info below. + type: boolean + default: false + background: + required: false + description: Style the background using CSS, more info below. + type: string + theme: + required: false + description: Themes view and cards, more info below. + type: string + visible: + required: false + description: "Hide/show the view tab from all users or a list of individual `visible` objects." + type: [boolean, list] + default: true {% endconfiguration %} ## Options For Visible @@ -63,9 +63,9 @@ If you define `visible` as objects instead of a boolean to specify conditions fo {% configuration badges %} user: -required: true -description: User id that can see the view tab. -type: string + required: true + description: User id that can see the view tab. + type: string {% endconfiguration %} ## Badges @@ -81,138 +81,138 @@ entity: light.living_room {% configuration %} type: -required: true -description: entity-button -type: string + required: true + description: entity-button + type: string entity: -required: true -description: Home Assistant entity ID. -type: string + required: true + description: Home Assistant entity ID. + type: string name: -required: false -description: Overwrites friendly name. -type: string -default: Name of Entity + required: false + description: Overwrites friendly name. + type: string + default: Name of Entity icon: -required: false -description: Overwrites icon or entity picture. -type: string -default: Entity Domain Icon + required: false + description: Overwrites icon or entity picture. + type: string + default: Entity Domain Icon show_name: -required: false -description: Show name. -type: boolean -default: "true" + required: false + description: Show name. + type: boolean + default: "true" show_icon: -required: false -description: Show icon. -type: boolean -default: "true" + required: false + description: Show icon. + type: boolean + default: "true" tap_action: -required: false -description: Action to take on tap -type: map -keys: -action: -required: true -description: "Action to perform (`more-info`, `toggle`, `call-service`, `navigate`, `url`, `none`)" -type: string -default: "`toggle`" -navigation_path: -required: false -description: "Path to navigate to (e.g. `/lovelace/0/`) when `action` defined as `navigate`" -type: string -default: none -url_path: -required: false -description: "Path to navigate to (e.g. `https://www.home-assistant.io`) when `action` defined as `url`" -type: string -default: none -service: -required: false -description: "Service to call (e.g. `media_player.media_play_pause`) when `action` defined as `call-service`" -type: string -default: none -service_data: -required: false -description: "Service data to include (e.g. `entity_id: media_player.bedroom`) when `action` defined as `call-service`" -type: string -default: none -confirmation: -required: false -description: "Present a confirmation dialog to confirm the action. See `confirmation` object below" -type: [boolean, map] -default: "false" + required: false + description: Action to take on tap + type: map + keys: + action: + required: true + description: "Action to perform (`more-info`, `toggle`, `call-service`, `navigate`, `url`, `none`)" + type: string + default: "`toggle`" + navigation_path: + required: false + description: "Path to navigate to (e.g. `/lovelace/0/`) when `action` defined as `navigate`" + type: string + default: none + url_path: + required: false + description: "Path to navigate to (e.g. `https://www.home-assistant.io`) when `action` defined as `url`" + type: string + default: none + service: + required: false + description: "Service to call (e.g. `media_player.media_play_pause`) when `action` defined as `call-service`" + type: string + default: none + service_data: + required: false + description: "Service data to include (e.g. `entity_id: media_player.bedroom`) when `action` defined as `call-service`" + type: string + default: none + confirmation: + required: false + description: "Present a confirmation dialog to confirm the action. See `confirmation` object below" + type: [boolean, map] + default: "false" hold_action: -required: false -description: Action to take on tap-and-hold -type: map -keys: -action: -required: true -description: "Action to perform (`more-info`, `toggle`, `call-service`, `navigate`, `url`, `none`)" -type: string -default: "`more-info`" -navigation_path: -required: false -description: "Path to navigate to (e.g. `/lovelace/0/`) when `action` defined as `navigate`" -type: string -default: none -url_path: -required: false -description: "Path to navigate to (e.g. `https://www.home-assistant.io`) when `action` defined as `url`" -type: string -default: none -service: -required: false -description: "Service to call (e.g. `media_player.media_play_pause`) when `action` defined as `call-service`" -type: string -default: none -service_data: -required: false -description: "Service data to include (e.g. `entity_id: media_player.bedroom`) when `action` defined as `call-service`" -type: string -default: none -confirmation: -required: false -description: "Present a confirmation dialog to confirm the action. See `confirmation` object below" -type: [boolean, map] -default: "false" + required: false + description: Action to take on tap-and-hold + type: map + keys: + action: + required: true + description: "Action to perform (`more-info`, `toggle`, `call-service`, `navigate`, `url`, `none`)" + type: string + default: "`more-info`" + navigation_path: + required: false + description: "Path to navigate to (e.g. `/lovelace/0/`) when `action` defined as `navigate`" + type: string + default: none + url_path: + required: false + description: "Path to navigate to (e.g. `https://www.home-assistant.io`) when `action` defined as `url`" + type: string + default: none + service: + required: false + description: "Service to call (e.g. `media_player.media_play_pause`) when `action` defined as `call-service`" + type: string + default: none + service_data: + required: false + description: "Service data to include (e.g. `entity_id: media_player.bedroom`) when `action` defined as `call-service`" + type: string + default: none + confirmation: + required: false + description: "Present a confirmation dialog to confirm the action. See `confirmation` object below" + type: [boolean, map] + default: "false" double_tap_action: -required: false -description: Action to take on double tap -type: map -keys: -action: -required: true -description: "Action to perform (`more-info`, `toggle`, `call-service`, `navigate`, `url`, `none`)" -type: string -default: "`more-info`" -navigation_path: -required: false -description: "Path to navigate to (e.g. `/lovelace/0/`) when `action` defined as `navigate`" -type: string -default: none -url_path: -required: false -description: "Path to navigate to (e.g. `https://www.home-assistant.io`) when `action` defined as `url`" -type: string -default: none -service: -required: false -description: "Service to call (e.g. `media_player.media_play_pause`) when `action` defined as `call-service`" -type: string -default: none -service_data: -required: false -description: "Service data to include (e.g. `entity_id: media_player.bedroom`) when `action` defined as `call-service`" -type: string -default: none -confirmation: -required: false -description: "Present a confirmation dialog to confirm the action. See `confirmation` object below" -type: [boolean, map] -default: "false" + required: false + description: Action to take on double tap + type: map + keys: + action: + required: true + description: "Action to perform (`more-info`, `toggle`, `call-service`, `navigate`, `url`, `none`)" + type: string + default: "`more-info`" + navigation_path: + required: false + description: "Path to navigate to (e.g. `/lovelace/0/`) when `action` defined as `navigate`" + type: string + default: none + url_path: + required: false + description: "Path to navigate to (e.g. `https://www.home-assistant.io`) when `action` defined as `url`" + type: string + default: none + service: + required: false + description: "Service to call (e.g. `media_player.media_play_pause`) when `action` defined as `call-service`" + type: string + default: none + service_data: + required: false + description: "Service data to include (e.g. `entity_id: media_player.bedroom`) when `action` defined as `call-service`" + type: string + default: none + confirmation: + required: false + description: "Present a confirmation dialog to confirm the action. See `confirmation` object below" + type: [boolean, map] + default: "false" {% endconfiguration %} #### Options For Confirmation @@ -220,22 +220,22 @@ default: "false" If you define confirmation as an object instead of boolean, you can add more customization and configurations: {% configuration %} text: -required: false -description: Text to present in the confirmation dialog. -type: string + required: false + description: Text to present in the confirmation dialog. + type: string exemptions: -required: false -description: "List of `exemption` objects. See below" -type: list + required: false + description: "List of `exemption` objects. See below" + type: list {% endconfiguration %} #### Options For Exemptions {% configuration badges %} user: -required: true -description: User id that can see the view tab. -type: string + required: true + description: User id that can see the view tab. + type: string {% endconfiguration %} #### Example @@ -259,17 +259,17 @@ This badge allows you to define a list of entities that you want to track only w {% configuration %} type: -required: true -description: entity-filter -type: string + required: true + description: entity-filter + type: string entities: -required: true -description: A list of entity IDs or `entity` objects, see below. -type: list + required: true + description: A list of entity IDs or `entity` objects, see below. + type: list state_filter: -required: true -description: List of strings representing states or `filter` objects, see below. -type: list + required: true + description: List of strings representing states or `filter` objects, see below. + type: list {% endconfiguration %} #### Options For Entities @@ -278,29 +278,29 @@ If you define entities as objects instead of strings (by adding `entity:` before {% configuration %} type: -required: false -description: "Sets a custom badge type: `custom:my-custom-badge`" -type: string + required: false + description: "Sets a custom badge type: `custom:my-custom-badge`" + type: string entity: -required: true -description: Home Assistant entity ID. -type: string + required: true + description: Home Assistant entity ID. + type: string name: -required: false -description: Overwrites friendly name. -type: string + required: false + description: Overwrites friendly name. + type: string icon: -required: false -description: Overwrites icon or entity picture. -type: string + required: false + description: Overwrites icon or entity picture. + type: string image: -required: false -description: The URL of an image. -type: string + required: false + description: The URL of an image. + type: string state_filter: -required: false -description: List of strings representing states or `filter` objects, see below. -type: list + required: false + description: List of strings representing states or `filter` objects, see below. + type: list {% endconfiguration %} #### Options For state_filter @@ -309,17 +309,17 @@ If you define state_filter as objects instead of strings (by adding `value:` bef {% configuration %} value: -required: true -description: String representing the state. -type: string + required: true + description: String representing the state. + type: string operator: -required: false -description: Operator to use in the comparison. Can be `==`, `<=`, `<`, `>=`, `>`, `!=` or `regex`. -type: string + required: false + description: Operator to use in the comparison. Can be `==`, `<=`, `<`, `>=`, `>`, `!=` or `regex`. + type: string attribute: -required: false -description: Attribute of the entity to use instead of the state. -type: string + required: false + description: Attribute of the entity to use instead of the state. + type: string {% endconfiguration %} #### Examples From 8bf9385b0bff274b751f0da45d3384ce22817954 Mon Sep 17 00:00:00 2001 From: Ian Richardson Date: Wed, 23 Oct 2019 12:11:22 -0500 Subject: [PATCH 4/5] image option for state-label --- source/lovelace/views.markdown | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/source/lovelace/views.markdown b/source/lovelace/views.markdown index 9bf7e905269d..d0510deb9540 100644 --- a/source/lovelace/views.markdown +++ b/source/lovelace/views.markdown @@ -98,6 +98,10 @@ icon: description: Overwrites icon or entity picture. type: string default: Entity Domain Icon +image: + required: false + description: The URL of an image. + type: string show_name: required: false description: Show name. From 53e215dc8a89c68983dbec8db5f9e2445572f4c9 Mon Sep 17 00:00:00 2001 From: Franck Nijhof Date: Wed, 23 Oct 2019 20:36:22 +0200 Subject: [PATCH 5/5] Fix build --- source/lovelace/views.markdown | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/source/lovelace/views.markdown b/source/lovelace/views.markdown index d0510deb9540..46c170810479 100644 --- a/source/lovelace/views.markdown +++ b/source/lovelace/views.markdown @@ -79,7 +79,7 @@ type: state-label entity: light.living_room ``` -{% configuration %} +{% configuration state_label %} type: required: true description: entity-button @@ -222,7 +222,7 @@ double_tap_action: #### Options For Confirmation If you define confirmation as an object instead of boolean, you can add more customization and configurations: -{% configuration %} +{% configuration confirmation %} text: required: false description: Text to present in the confirmation dialog. @@ -261,7 +261,7 @@ View config: This badge allows you to define a list of entities that you want to track only when in a certain state. Very useful for showing lights that you forgot to turn off or show a list of people only when they're at home. -{% configuration %} +{% configuration filter_badge %} type: required: true description: entity-filter @@ -280,7 +280,7 @@ state_filter: If you define entities as objects instead of strings (by adding `entity:` before entity ID), you can add more customization and configurations: -{% configuration %} +{% configuration entities %} type: required: false description: "Sets a custom badge type: `custom:my-custom-badge`" @@ -311,7 +311,7 @@ state_filter: If you define state_filter as objects instead of strings (by adding `value:` before your state value), you can add more customization to your filter: -{% configuration %} +{% configuration state_filter %} value: required: true description: String representing the state.