Use huawei_lte integration to send SMS to ANY number

I’ve set up the Huawei LTE Router integration and added it as a notify option. What I’d like to do though is be able to specify the number at the time that notification is sent, so basically overriding the ‘recipient’ parameter. This obviously is not permitted out of the box.

I currently have a Python script running on another machine that waits for an MQTT message to send a SMS, I use this now for sending SMS’s. I’d like to move this into HA to remove the extra point.

So I guess I’m asking what my options are? Clearly there’s an available Python library installed (I’ve checked the code for the current integration). Do I need to go with App Daemon and write a custom automation?

Any pointers would be appreciated.

I’ve implemented this as an AppDaemon app using MQTT. Code is…

import appdaemon.plugins.mqtt.mqttapi as mqtt
import json
import huaweisms.api.user
import huaweisms.api.wlan
import huaweisms.api.sms

class SendSMS(mqtt.Mqtt):

  def initialize(self):
     self.log("SendSMS Ready")
     self.listen_event(self.mqtt_message, "MQTT_MESSAGE", namespace = "mqtt", topic = 'homeassistant/sms/test')


  def mqtt_message(self, event_name, data, kwargs):
      json_data = json.loads(data['payload'])

      self.log('Sending "' + json_data['message'] + '" to ' + json_data['number'])
      ctx = huaweisms.api.user.quick_login("username", "password")
      
      # sending sms
      huaweisms.api.sms.send_sms(
        ctx,
        json_data['number'],
        json_data['message']
      )

You need the huawei Python library, so my AppDaemon config looks like this (for now)

{
  "disable_auto_token": false,
  "system_packages": [],
  "python_packages": [
    "huawei-modem-api-client"
  ]
}