Franck Nijhof 1833c32a2c Cleans up front matter (#9835)
* Sets front matter defaults

* Removes default front matter from section templates/pages

* Removes default front matter from addon pages

* Removes default front matter from integration pages

* Removes default front matter from posts

* Removes default front matter from docs pages

* Removes default front matter from other pages

* Fixes blog category pages
2019-07-11 14:35:08 -07:00

4.1 KiB

title, description, logo, ha_category, ha_release, ha_qa_scale
title description logo ha_category ha_release ha_qa_scale
Counter Instructions on how to integrate counters into Home Assistant. home-assistant.png
Automation
0.53 internal

The counter integration allows one to count occurrences fired by automations.

Configuration

To add a counter to your installation, add the following to your configuration.yaml file:

# Example configuration.yaml entry
counter:
  my_custom_counter:
    initial: 30
    step: 1

{% configuration %}

'alias' should be replaced by the user for their actual value.

"[alias]": description: Alias for the counter. Multiple entries are allowed. required: true type: map keys: name: description: Friendly name of the counter. required: false type: string initial: description: Initial value when Home Assistant starts or the counter is reset. required: false type: integer default: 0 restore: description: Try to restore the last known value when Home Assistant starts. required: false type: boolean default: true step: description: Incremental/step value for the counter. required: false type: integer default: 1 minimum: description: Minimum value the counter will have required: false type: integer maximum: description: Maximum value the counter will have required: false type: integer icon: description: Icon to display for the counter. required: false type: icon {% endconfiguration %}

Pick an icon that you can find on materialdesignicons.com to use for your input and prefix the name with mdi:. For example mdi:car, mdi:ambulance or mdi:motorbike.

Restore State

This integration will automatically restore the state it had prior to Home Assistant stopping as long as you your entity has restore set to true which is the default. To disable this feature, set restore to false.

If restore is set to false, the initial value will only be used when no previous state is found or when the counter is reset.

Services

Available services: increment, decrement, and reset.

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 the entity to take action, e.g., counter.my_custom_counter.

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 the entity to take action, e.g., counter.my_custom_counter.

Service counter.reset

With this service the counter is reset to its initial value.

Service data attribute Optional Description
entity_id no Name of the entity to take action, e.g., counter.my_custom_counter.

Service counter.configure

With this service the properties of the counter can be changed while running.

Service data attribute Optional Description
entity_id no Name of the entity to take action, e.g., counter.my_custom_counter.
minimum yes Set new value for minimum. None disables minimum.
maximum yes Set new value for maximum. None disables maximum.
step yes Set new value for step

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.

{
  "entity_id": "counter.my_custom_counter"
}