Ok, so as soon as I put in the regex the yaml is invalid.
service: notify.mobile_app_myphone
data:
title: "A new Epic free game has arrived!"
data:
# iOS - not used url: "{{ state_attr("calendar.epic_games_store_free_games", "description") | regex_findall("https?://[^\s]+") | join }}"
clickAction: "{{ state_attr("calendar.epic_games_store_free_games", "description") | regex_findall("https?://[^\s]+") | join }}"
For reference as you dont have the integration:
{{ state_attr('calendar.epic_games_store_free_games', 'description')
| regex_findall('https?://[^\s]+')
| join(', ') }}
Returns this in developer console
CLEAR
Result type: string
https://store.epicgames.com/en-US/p/circus-electrique
This template listens for the following state changed events:
- Entity: calendar.epic_games_store_free_games
One of my concerns is that Jinja2 will apparently only parse regex on one feild in an automation. If this wasnt a restriction I would also use it to set the title to say what game was actually free. When this is working it would need both the URI for iOS and the clickAction for Android to run the regex.
Is there a way of running an action before to set variables to be used in the notification?
variables:
game: "New free game: {{ state_attr('calendar.epic_games_store_free_games', 'message') }}"
url: "{{ state_attr('calendar.epic_games_store_free_games', 'description') | regex_findall('https?://[^\s]+') | join(', ') }}"
Same issue - looks like maybe it doesn’t like the pipes, which means I cant trim the long description down to just the url. The whole entity looks like this for reference:
message: Circus Electrique
all_day: false
start_time: 2024-05-10 01:00:00
end_time: 2024-05-17 01:00:00
location:
description: Circus Electrique is part story-driven RPG, part tactics, part circus management, and completely enthralling. When everyday Londoners mysteriously turn into vicious killers, only the show’s talented performers possess the skills necessary to save the city.
https://store.epicgames.com/en-US/p/circus-electrique
friendly_name: Epic Games Store Free games