I’ve set up some sensors to set up a fixtures and tickets on sale group for my favourite football/soccer team. Example of the message attribute is:
Qarabag FK v Arsenal (A)
I’m trying to get rid of the (A) or (H) that appears after the message so that I can set up an automation to read the fixture using TTS to either alexa or google home. What’s the best way of doing this please?
I can’t test at the moment so this may not be completely correct, but it will look something like:
value_template: "{{states.sensor.YOURSENSORNAME.state.replace(" (A),"").replace(" (H),"")}}"
P.S. I hope for your sake your favourite team is Qarabag
Thanks for the pointer, I ended up using the following:
- platform: template
sensors:
next_fixture:
friendly_name: "Next Fixture"
value_template: "{{ states.calendar.arsenal_fixtures.attributes.message.replace('(A)','').replace('(H)','') }}"
Now I’ll never miss another Qarabag game again
Glad I could help