Created
February 6, 2024 16:43
-
-
Save Didgeridrew/442b77bf10473a6ded877922099699b0 to your computer and use it in GitHub Desktop.
HA - Times opened, like History stats but without time
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| template: | |
| - trigger: | |
| - platform: state | |
| entity_id: input_boolean.test_bool_1 | |
| to: "on" | |
| - platform: event | |
| event_type: custom_reset_times_opened | |
| - platform: event | |
| event_type: event_template_reloaded | |
| sensor: | |
| - name: times_opened | |
| state: | | |
| {% set current = this.state | int(0) if this is defined else 0 %} | |
| {% if trigger.id == 'reset' %} | |
| 0 | |
| {% else %} | |
| {{ current + 1 }} | |
| {% endif %} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment