Try to send the mqtt payload as a message to notify.mobile_app in iOS

I generate mqtt messages outside home assistant but want home assistant to listen for that topic. My problem is how to configure the automation notify.mobile_app so the payload is pushed to the device.

I’m using mosquito_pub -t “mess/name” -m “this text should be visible on my phone.” …

One way would be to create a MQTT sensor.

Then on state change of that sensor or whenever you want to push to your phone, that notification can be done via an automation.

Here is an example of an automation that reacts to any state change of a sensor. Then the state of that sensor is passed in the message sent to my phone using a template.

Thanks for answer so quick :slight_smile: Yes this is one way, I’ve already has it with my hygrometers and it’s working but it’s stored in db then. I would love to go directly from mqtt payload into messages. Google around a lot but no luck for me there. I also tried to specify messages: in the mosquito messages but still no luck.

1 Like

This automation should do it.

  - alias: mqtt_notifier
    trigger:
      platform: mqtt
      topic: my_ha/mqtt_notifier
    action:
      service: persistent_notification.create
      data_template:
        title: From mqtt_notifier
        message: "{{ trigger.payload }}"
mosquitto_pub -t "my_ha/mqtt_notifier" -m "Hello from MQTT"

20200205_16:32:18_001

2 Likes

Get error as seen in red of the trigger. But so far as I understand this is exactly what I want to do. :smile:
I have an mqtt as trigger and this as an action correct so far? :

Grrr!! UI Automations! :rofl:

EDIT: You need to switch the Actions Editor to yaml mode
20200205_17:08:10_001

image

Little tricky but it’s working now!!! Thanks Now I know what the persistent_notification is :+1: I have only changed the service to mobile_app and now is it working as I want many thanks!!! :grinning: :grinning: