Sharing configuration for sending notifications via SMS using ZTE dongle. I have a ZTE MF710 modem, the configuration might work with other dongles that appear as virtual ethernet adapters on the host (hassio in my case on raspberry pi).
The dongle has a web interface that can be accessed with a browser at http://192.168.0.1/
configuration.yaml
notify:
- platform: rest
name: sms
resource: http://192.168.0.1/goform/goform_set_cmd_process
method: POST
headers:
host: 192.168.0.1
referer: http://192.168.0.1/index.html
target_param_name: Number
message_param_name: MessageBody
title_param_name: encode_type
data_template:
goformId: 'SEND_SMS'
isTest: 'false'
notCallback: 'true'
ID: '-1'
sms_time: '{{now().year%100}}%3B{{now().month}}%3B{{now().day}}%3B{{now().hour}}%3B{{now().minute}}%3B{{now().second}}%3B%2B0'
encode_type: GSM7_default
At this point I can only send notification with GSM 7-bit encoding (https://www.developershome.com/sms/gsmAlphabet.asp) so it is restricted to predefined notifications. If somebody knows how to encode strings (with jinja?) or what other formats the dongle supports, please share here so that we can also send templated messages.
automations.yaml
action:
service: notify.sms
data:
target: '0123456789'
message: '00680061006C006C006F'
This sends an SMS to phone number 0123456789
with text hallo
.