LG WebOS notifications not working through automation or script

I am completely lost here.

I am trying to send a notification to my LG WebOS TV (G5). I want to make an automation later on, that when someone is at the door, I get to see a message on my TV, when it’s turned on.

So, when using the HA interface I call the action: notify.lg_webos_tv_oled48g56ls_deuqljp. I set a message and voila, it appears on the tv.

When I set the same action in a script and set a message there, I get an error. The same action is now suddenly not available. “Action notify.lg_webos_tv_oled55g56ls_deuqljp not found.”. This has got me really puzzled.

How come it works through the interace of HA, but not when execution a script?

Please share your YAML.

Edit: Here working script for my TV. Please adapt tv name for your script.

      - if:
          - condition: template
            value_template: >
              {{ states('media_player.lg_webos_tv_oled55c7v_z') not in
              ['unavailable', 'off', 'unknown'] }}
        then:
          - action: notify.lg_webos_tv_oled55c7v_z
            data:
              message: >-
                {% set emoji_pattern = '[^\u0000-\u00FF]' %} {% set t = title |
                regex_replace(find=emoji_pattern, replace='') | trim %} {% set m
                = message | regex_replace(find=emoji_pattern, replace='') | trim
                %} {{ (t ~ ": " ~ m) | truncate(60) }}
            continue_on_error: true

It’s not the same action. The first notify refers to oled48 whereas the second notify refers to oled55.

Are both correct or is it possible that the second one is incorrect and would explain why it produced a “not found” error message?


EDIT

I corrected my original post because I had made a mistake. I thought PeterVanDerSanden’s example was Lifelogger’s reply to Sir_Goodenough’s request to post the script. My apologies to Lifelogger for any confusion I may have caused.

1 Like

Oh crap! :smiley: I see what you mean. I did not see that at all. :smiley:

This is the script I am using for testing:

global_media_player_notification:
  sequence:
    - if:
        - condition: state
          entity_id: media_player.lg_webos_tv_oled55g56ls_deuqljp
          state: "on"
      then:
        - action: notify.lg_webos_tv_oled55g56ls_deuqljp
          data_template:
            title: "{{ title }}"
            message: "{{ message }}"
            data:
              displaytime: 5000

Are you sending it variables to fill in the values for title and message??

Yeah. I call the script in an automation and send the message as data.

Look at the trace for the script, what is it doing?
To do that lookup the script in the script UI editor and click on the trace button at the top.

  • You tested this one, in the HA interface, and confirmed it works.
    notify.lg_webos_tv_oled48g56ls_deuqljp

  • You use a different notify command in the script and it produces an error.
    notify.lg_webos_tv_oled55g56ls_deuqljp

It’s unclear if you have two OLED TVs or if the second notify command, the one that produces an error, simply contains a typo (uses 55 instead of 48)

Yeah, Taras pointed me to it. :slight_smile: I had a typo indeed. :slight_smile: Thanks

You’re welcome!

Please consider marking my post above with the Solution tag. It will help other users find answers to similar problems.

Done. :slight_smile: Marked it. :slight_smile:

1 Like