valiran
(Valiran)
March 13, 2023, 10:13am
1
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!
Hellis81
(Hellis81)
March 13, 2023, 10:16am
2
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
valiran
(Valiran)
March 15, 2023, 12:45pm
3
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
Hellis81
(Hellis81)
March 15, 2023, 1:29pm
4
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
valiran
(Valiran)
March 15, 2023, 1:40pm
5
There is were I put your command:
And it’s not working
Hellis81
(Hellis81)
March 15, 2023, 1:41pm
6
Remove any sensitive data and post the automation in yaml. inside a code block </>
sign in forum
valiran
(Valiran)
March 15, 2023, 1:45pm
7
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
Hellis81
(Hellis81)
March 15, 2023, 1:50pm
8
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
valiran
(Valiran)
March 15, 2023, 2:34pm
9
It’s working very well, thanks a lot !