Using homeassistant.service notify in script with parameters do not pass the text message

I tried to use script with parameters to use notification service “notify.andrej” (Telegram) from HA:

script:

  • id: notify_am
    parameters:
    mess: string
    then:
    • homeassistant.service:
      service: notify.andrej
      data_template:
      message: !lambda return ‘mess’;

If I execute the script the script, the message received in the telegram contain only number with 10 digits:
- script.execute:
id: notify_am
mess: “Example Text”

Can anyone help?

Maybe try one of the Home Assistant forums. You took a wrong turn somewhere bud, this is the esphome forum.

Moved for you.

This is an ESPHome topic, not sure why @Fallingaway24 thought it wasn’t? I’ve moved it back.

@AndyP129please format your code correctly. There could be all sorts of indentation issues hiding.

I think you need to move the quotes:

message: !lambda 'return mess;'

If that doesn’t fix it, please post some code with a real string shown, and the response received.

Oh, you’re right. I think i just saw the notify service and jumped the gun so i missed the service call that triggers the notify. My bad

So, you send a notify of, “Example Text” and you recieve 10 digits(numbers) instead of letters?

I think the original code sends 'mess' as a string of four bytes plus terminator. At a wild guess, I think the notification might well be:

6d65737300

Oh man, i was hoping that wasnt thr case. Converting things back and forth from strings to int or float and vise versa… we dont get along very well. Im just going to bow out of this one.

Thank you, after moving the quotes it is working.
Thank you also for the link regarding correct formating of the code, for my next post I will use it.

1 Like