fra
(francesco)
November 4, 2020, 11:02pm
1
hi at all!
i’ve a rest command to send sms in this format:
alarm_door:
url: http://172.10.10.1/cgi-bin/sms_send?username=XXX&password=YYY&number=0000000text=Alarm door open
this rest command works great in automations but now i need to insert it in my alert to use
all the functions of HA alert system
alert:
garage_door:
name: Garage is open
done_message: Garage is closed
entity_id: sensor.door
state: 'on'
repeat:
- 3
can_acknowledge: false
skip_first: false
notifiers:
- notify_email
After notify_email i need to execute my rest command alarm_door
I tried with this code in my configuration.yaml under notify section…
- name: fra-phone
platform: rest
resource: http://172.10.10.1/cgi-bin/sms_send?username=XXX&password=YYY&number=0000000text=Alarm door open
but it doesn’t works
Someone could help me??
Thanks a lot
jocnnor
(Jim O'Connor)
November 4, 2020, 11:04pm
2
Alert is looking for “notification” type entities.
Did you set up your rest alert as a notify? Or as a rest command?
You can have both. Just create a notify element for your rest command and use this one in your alert.
The arguments only want the object_id. For example, if you have a notify.fra-phone, you would only put “-fra-phone” in this section.
… wait, nevermind, you did this.
What didn’t work? Can you call the notify.fra-phone directly from the services menu?
fra
(francesco)
November 4, 2020, 11:10pm
3
Yes, man but i must specify title and message… now how to add this values in my notify section ???
thanks
jocnnor
(Jim O'Connor)
November 4, 2020, 11:16pm
4
Since you hardcoded everything into the command, you can send an empty request and it should pop up a message. The data parameters are all optional. Erase them.
If you want it to be more dynamic, you should just have to specify the text that goes in for message, title, and target.
notify:
- name: fra-phone
platform: rest
resource: http://172.10.10.1/cgi-bin/sms_send
username: "XXX"
password: "YYY"
message_param_name: "text"
target_param_name: "number"
Now to use it, specify message and target.
- service: notify.fra-phone
data:
message: "Garage Door Open"
target: "000000"
fra
(francesco)
November 4, 2020, 11:27pm
5
thanks man, i put this code in my notify section:
notify:
- name: fra-phone
platform: rest
resource: http://172.10.10.1/cgi-bin/sms_send
username: "XXX"
password: "YYY"
message_param_name: "text"
target_param_name: "number"
but i don’t understand wher insert the second part of your code…
thanks
jocnnor
(Jim O'Connor)
November 5, 2020, 1:27am
6
Wherever you want. In an automation typically.
Try the service tab and pick notify.fra-phone
in the box, type
message: "TEST"
target: <your phone number>