Hi! I am trying to build an automation that notifies me when a friend launches a game. To capture the game, I have created a template sensor:
Sensor:
- platform: template
sensors:
steam_<id>_game:
value_template: '{{ states.sensor.steam_<id>.attributes.game }}'
friendly_name: '<player name>'
I then created an automation which notifies me when the template sensor changes:
Automation:
- alias: "STEAM: Notify"
hide_entity: false
initial_state: True
trigger:
- platform: state
entity_id: sensor.steam_<id>_game
action:
- service: notify.telegram
data:
message: "STEAM: <player name> plays {{ states.sensor.steam_<id>_game.state }}"
Now, this works fine, except it notifies if the attribute changes from “Game XYZ” to NULL. I tried to insert a “from: ‘unknown’” to the state trigger, but that throws errors and does not work right, too.
Any ideas? Also, I am unsure if I even need the additional template sensor. Maybe there is a way to trigger the automation directly form the steam sensor?
Thanks!