baddy-0
(Baddy 0)
1
Hello everybody
I need do send back an SMS to someone that send a SMS to my modem
I created this automation
trigger:
- platform: event
event_type: sms.incoming_sms
action:
service: notify.sms
data:
target: "{{trigger.event.data.phone}}"
message: >-
Unknown command '{{trigger.event.data.text}}' from
{{trigger.event.data.phone}}. Please send BASKET or TENNIS command
The problem is the modem don’t send back sms because the number don’t have the plus sign before
This is extrat from trace
params:
domain: notify
service: sms
service_data:
target: 393356026***
message: >-
Unknown command 'Prova 17' from +393356026***. Please send BASKET or TENNIS command
target: {}
running_script: false
limit: 10
If I put static number instead of template the plus sign is not removed and sms is delivered
Someone can help me?
tom_l
2
Try this:
data:
target: "{{'+' ~ trigger.event.data.phone}}"
Though you may still have issues with leading zeros being dropped.
So maybe try this:
data:
target: "{{ trigger.event.data.phone|string }}"
Can you show the (sanitised) event data?
baddy-0
(Baddy 0)
3
Does not work
First one: the output has two plus sign
Second one: no plus sign
I don’t kwon how extract sanitised eventa data
Can you help me?
Thank you
This is the output whith
data:
target: "{{'+' ~ trigger.event.data.phone}}"
params:
domain: notify
service: sms
service_data:
target: ++393356026***
message: >-
Comando sconosciuto 'Prova 24' da +393356026***. I comandi ammessi sono
BASKET PALLAVOLO SINISTRA
target: {}
running_script: false
limit: 10
and that the output with
data:
target: "{{ trigger.event.data.phone|string }}"
params:
domain: notify
service: sms
service_data:
target: 393356026***
message: >-
Comando sconosciuto 'Prova 23' da +393356026***. I comandi ammessi sono
BASKET PALLAVOLO SINISTRA
target: {}
running_script: false
limit: 10
tom_l
4
Ok, try these:
data:
target: "{{' ' ~ trigger.event.data.phone}}"
or
data:
target: "{{'' ~ trigger.event.data.phone}}"
baddy-0
(Baddy 0)
5
No way
params:
domain: notify
service: sms
service_data:
target: 393356026***
message: >-
Comando sconosciuto 'Prova 28' da +393356026***. I comandi ammessi sono
BASKET PALLAVOLO SINISTRA
target: {}
running_script: false
limit: 10
service: notify.sms
data:
target: '{{ '' '' ~ trigger.event.data.phone }}'
message: >-
Comando sconosciuto '{{trigger.event.data.text}}' da
{{trigger.event.data.phone}}. I comandi ammessi sono BASKET PALLAVOLO
SINISTRA
baddy-0
(Baddy 0)
6
Seems we need an escape sequence to avoid parsing of plus sign
baddy-0
(Baddy 0)
7
I found a dirty solution that works: using 00 instead of plus sign
service: notify.sms
data:
target: "{{ trigger.event.data.phone|replace('+','00') }}"
message: >-
Comando sconosciuto '{{trigger.event.data.text}}' da
{{trigger.event.data.phone}}. I comandi ammessi sono BASKET PALLAVOLO
SINISTRA
But I suppose that’s a bug