From fcb8bcb33b914b10acf400ff8150571f5029b870 Mon Sep 17 00:00:00 2001 From: Fabian Affolter Date: Sat, 26 Aug 2017 19:02:38 +0200 Subject: [PATCH 1/2] Add documentation for counter component --- source/_components/counter.markdown | 74 +++++++++++++++++++++++++++++ 1 file changed, 74 insertions(+) create mode 100644 source/_components/counter.markdown diff --git a/source/_components/counter.markdown b/source/_components/counter.markdown new file mode 100644 index 000000000000..412d2df3cbc6 --- /dev/null +++ b/source/_components/counter.markdown @@ -0,0 +1,74 @@ +--- +layout: page +title: "Counter" +description: "Instructions how to integrate counters into Home Assistant." +date: 2017-08-26 06:00 +sidebar: true +comments: false +sharing: true +footer: true +logo: home-assistant.png +ha_category: Automation +ha_release: 0.53 +--- + +The `counter` component allows one to count occurrences fired by automations. + +To add a counter to your installation, add the following to your `configuration.yaml` file: + +```yaml +# Example configuration.yaml entry +counter: + counter: + initial: 30 + step: 1 +``` + +Configuration variables: + +- **[alias]** (*Required*): Alias for the slider input. Multiple entries are allowed. + - **name** (*Optional*): Friendly name of the slider input. + - **initial** (*Optional*): Initial value when Home Assistant starts. Defaults to 0. + - **step** (*Optional*): Step value for the slider. Defaults to 1. + - **icon** (*Optional*): Icon for entry. + +## {% linkable_title Services %} + +### {% linkable_title Media control services %} +Available services: `increment`, `decrement`, and `reset`. + +#### {% linkable_title Service `counter/increment` %} + +Increments the counter with 1 or the given value for the steps. + +| Service data attribute | Optional | Description | +| ---------------------- | -------- | ----------- | +| `entity_id` | no | Name of entity to take the action, e.g. `counter.count0`. | + +#### {% linkable_title Service `counter/decrement` %} + +Decrements the counter with 1 or the given value for the steps. + +| Service data attribute | Optional | Description | +| ---------------------- | -------- | ----------- | +| `entity_id` | no | Name of entity to take the action, e.g. `counter.count0`. | + +#### {% linkable_title Service `counter/reset` %} + +With this service the counter is reset to its initial value. + +| Service data attribute | Optional | Description | +| ---------------------- | -------- | ----------- | +| `entity_id` | no | Name of entity to take the action, e.g. `counter.count0`. | + + +### {% linkable_title Use the service %} + +Select service developer tool icon **Services** from the **Developer Tools**. Choose **counter** from the list of **Domains**, select the **Service**, enter something like the sample below into the **Service Data** field, and hit **CALL SERVICE**. + +```json +{ + "entitiy": "counter.count0" +} +``` + From ff7524e4ebab4316f1ae0c74f8a2fbe1a79c9f7a Mon Sep 17 00:00:00 2001 From: Fabian Affolter Date: Sat, 26 Aug 2017 19:40:18 +0200 Subject: [PATCH 2/2] Fix typos --- source/_components/counter.markdown | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/source/_components/counter.markdown b/source/_components/counter.markdown index 412d2df3cbc6..7df1c2e6cf5b 100644 --- a/source/_components/counter.markdown +++ b/source/_components/counter.markdown @@ -32,6 +32,8 @@ Configuration variables: - **step** (*Optional*): Step value for the slider. Defaults to 1. - **icon** (*Optional*): Icon for entry. +Pick an icon that you can find on [materialdesignicons.com](https://materialdesignicons.com/) to use for your input and prefix the name with `mdi:`. For example `mdi:car`, `mdi:ambulance`, or `mdi:motorbike`. + ## {% linkable_title Services %} ### {% linkable_title Media control services %} @@ -43,7 +45,7 @@ Increments the counter with 1 or the given value for the steps. | Service data attribute | Optional | Description | | ---------------------- | -------- | ----------- | -| `entity_id` | no | Name of entity to take the action, e.g. `counter.count0`. | +| `entity_id` | no | Name of the entity to take action, e.g., `counter.count0`. | #### {% linkable_title Service `counter/decrement` %} @@ -51,7 +53,7 @@ Decrements the counter with 1 or the given value for the steps. | Service data attribute | Optional | Description | | ---------------------- | -------- | ----------- | -| `entity_id` | no | Name of entity to take the action, e.g. `counter.count0`. | +| `entity_id` | no | Name of the entity to take action, e.g., `counter.count0`. | #### {% linkable_title Service `counter/reset` %} @@ -59,7 +61,7 @@ With this service the counter is reset to its initial value. | Service data attribute | Optional | Description | | ---------------------- | -------- | ----------- | -| `entity_id` | no | Name of entity to take the action, e.g. `counter.count0`. | +| `entity_id` | no | Name of the entity to take action, e.g., `counter.count0`. | ### {% linkable_title Use the service %}