SMS Notification: reply to sender

Hello!

I managed to get SMS Notification work by using a SIN800C USB board.
But how can I make an automation answer to the sms sender?
For example, if I send “Light off”, it triggers an automation that shuts off all the lights, and I would to send back something like “all light are off”. I can do it.
But if my wife do the the same, all I know, for now, is to put our 2 phone numbers so we will both be notified. What I want if my automation grab the sms.incoming_sms phone number and respond to it.

Is there a way to do it?

Thanks!

Do you get the phone number in the event?

If you listen for the event and then send an sms, do you get the phone number there?
Developer tools → events

Hello,

this is what you have in the event:

event_type: sms.incoming_sms
data:
phone: “+33XXXXXX”
date: “2023-03-15 13:43:53”
text: TEST
origin: LOCAL
time_fired: “2023-03-15T12:44:15.742369+00:00”
context:
id: blablabla
parent_id: null
user_id: null

So yes, the sender’s phone number is here :slight_smile:

In that case I believe

{{ trigger.event.data.phone }}

should be the phone number you can use to send a reply

if you set up an automation to trigger on sms.incoming_sms

There is were I put your command:

And it’s not working :frowning:

Remove any sensitive data and post the automation in yaml. inside a code block </> sign in forum

There it is:

> alias: TEST
> description: ""
> trigger:
>   - platform: event
>     event_type: sms.incoming_sms
>     event_data:
>       text: TEST
> condition: []
> action:
>   - type: turn_off
>     device_id: *************
>     entity_id: light.cuisinebulb
>     domain: light
>   - service: notify.sms
>     data:
>       message: >-
>         Eteindre toutes les lumières : lumiere all off  /  mode absent : absent
>         [on/off]
>       target:
>         "[object Object]": null
> mode: single

Target is bot reflecting what is type in the cell in graphical automation !

Replacing the target with:

target: {{ trigger.event.data.phone }}

Don’t work either :frowning:

Try and surround it with “” like this:

   target: "{{ trigger.event.data.phone }}"

And please use the correct formatting, it makes reading the code hard when you use blockquote

It’s working very well, thanks a lot !