Hey folks, thanks in advance for your advice and help - much appreciated!
I sometimes send notifications to my LG TVs.
The problem is, I get an error (understandably) when the TV is off.
2022-03-03 09:11:00 ERROR (MainThread) [homeassistant.components.webostv.notify] TV unreachable
I thought I would be clever and use a script that checks the TV is on, before sending the notification. In my mind that would hopefully mean no more errors.
My script looks like this ā¦
notification_to_lounge_tv:
alias: "Send a Notification to the Lounge TV"
mode: restart
sequence:
- choose:
- conditions:
- condition: state
entity_id: media_player.lounge_tv
state: "on"
sequence:
- service: notify.lounge_tv
data:
message: "{{ message }}"
title: "{{ title }}"
ā¦ and the action from the automation triggering it (it triggers fine) looks like ā¦
action:
- service: script.notification_to_lounge_tv
data:
variables:
title: "TITLE"
message: "Vehicle Detected"
Now it seems to work in that I still get the notifications, but I also get the below error in addition to my TV unreachable that I had before.
2022-03-03 08:15:34 WARNING (MainThread) [homeassistant.helpers.template] Template variable warning: 'message' is undefined when rendering '{{ message }}'
2022-03-03 08:15:34 WARNING (MainThread) [homeassistant.helpers.template] Template variable warning: 'title' is undefined when rendering '{{ title }}'
2022-03-03 08:15:34 ERROR (MainThread) [homeassistant.components.webostv.notify] TV unreachable
I went through the documentation and even found a few similar(ish) code samples from the forums, but the solution is just eluding me.
Has anyone managed similar to get this working, and can you see what Iām missing please?
Thank you as always!