Forked from sbyx/low-battery-level-detection-notification-for-all-battery-sensors.yaml
Last active
July 16, 2022 00:45
-
-
Save rdbahm/9a6180ddfcb206848eeeab368e5772c4 to your computer and use it in GitHub Desktop.
Home Assistant Blueprint: Notify when Steam Friends are playing a game
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
| blueprint: | |
| name: Notify when Steam friends are playing a game | |
| description: Take an action when friends are playing a Steam game | |
| domain: automation | |
| input: | |
| time: | |
| name: Game Check Frequency | |
| description: Time Pattern, minutes (see HA documentation) for how often to check for the target game. | |
| default: /5 | |
| selector: | |
| text: | |
| type: text | |
| game: | |
| name: Game to Notify | |
| description: Trigger the actions when this game is detected. | |
| default: Factorio | |
| selector: | |
| text: | |
| type: text | |
| exclude: | |
| name: Excluded Friends | |
| description: Steam Friends to exclude. | |
| selector: | |
| entity: | |
| domain: sensor | |
| actions: | |
| name: Actions | |
| description: | |
| Notifications or similar to be run. {{sensors}} is replaced with | |
| the names of friends playing the game. | |
| selector: | |
| action: {} | |
| source_url: https://gist.github.com/rdbahm/9a6180ddfcb206848eeeab368e5772c4/edit | |
| variables: | |
| exclude: !input "exclude" | |
| game: !input "game" | |
| sensors: >- | |
| {% set result = namespace(sensors=[]) %} | |
| {% for state in states.sensor | selectattr('attributes.attribution', '==', 'Data provided by Steam') %} | |
| {% if is_state_attr(state.entity_id, 'game', game) and not state.entity_id in exclude.entity_id %} | |
| {% set result.sensors = result.sensors + [state.name] %} | |
| {% endif %} | |
| {% endfor %} | |
| {{result.sensors|join(', ')}} | |
| trigger: | |
| - platform: time_pattern | |
| minutes: !input "time" | |
| condition: | |
| - "{{ sensors != '' }}" | |
| action: | |
| - choose: [] | |
| default: !input "actions" | |
| mode: single |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment