forked from hacs/documentation
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
7 changed files
with
63 additions
and
26 deletions.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
--- | ||
id: automation | ||
title: Automation | ||
--- | ||
|
||
Here is a few simple automation examples of what you can do with the data that HACS gives you. | ||
|
||
## New repositories added | ||
|
||
![auto_ex_2](/img/automation_example2.PNG) | ||
|
||
_If you click the link here you will get to the page in HACS for that repository._ | ||
|
||
```yaml | ||
automation hacs_new_repo: | ||
- alias: Create a notification when somethig is added to HACS | ||
trigger: | ||
platform: event | ||
event_type: hacs/repository | ||
event_data: | ||
action: registration | ||
condition: | ||
condition: template | ||
value_template: "{{ trigger.event.data.repository is defined }}" | ||
action: | ||
service: persistent_notification.create | ||
data_template: | ||
title: New repository in HACS | ||
message: >- | ||
{% set repo = trigger.event.data.repository %} | ||
{% set id = trigger.event.data.repository_id %} | ||
[{{ repo }}](/hacs/repository/{{ id }}) | ||
was just added to HACS. | ||
``` | ||
|
||
## Updates pending | ||
|
||
![auto_ex_1](/img/automation_example1.PNG) | ||
|
||
```yaml | ||
automation hacs_updates: | ||
- alias: Create a notification when there is updates pending in HACS | ||
trigger: | ||
platform: state | ||
entity_id: sensor.hacs | ||
condition: | ||
- condition: template | ||
value_template: "{{ states(trigger.entity_id) != 'unknown'}}" | ||
- condition: template | ||
value_template: "{{ (states(trigger.entity_id) | float) != 0}}" | ||
action: | ||
service: persistent_notification.create | ||
data_template: | ||
title: Updates pending in HACS | ||
message: >- | ||
{% for repo in state_attr(trigger.entity_id, 'repositories') %} | ||
**{{ repo.display_name }}** _{{ repo["installed version"] }}_ -> _{{ repo["available version"] }}_ | ||
{% endfor %} | ||
``` |
This file contains 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
This file contains 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
This file contains 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
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.