My situation: I don’t have any smart devices yet, but I want to test if I can send a message from my phone via MQTT, like described here.
I have HASS (python-env) and embedded MQTT broker (I only added 1 line with password in configuration.yaml
)
I used the android app, from the topic which I linked above. I see there that connection to MQTT broker was established (“Connected to MQTT broker”).
Then I want to test that It really works. When I send a test message, nothing happens in HA web-interface, so I write an automation.
- id: '1543085016756'
alias: 'Alarm-clock #1'
initial_state: True
trigger:
- platform: mqtt
topic: 'android/broadcast/redmi-4'
condition:
condition: and
conditions:
- condition: template
value_template: '{{ trigger.payload_json.action == "com.android.alarmclock.ALARM_ALERT" }}'
action:
- entity_id: scene.awaken
service: scene.turn_on
action:
- service: notify.notify
data:
message: 'Alarm clock triggered'
Note, that (1) I have condition with and
and only 1 condition there, because otherwise I got some syntax error (will figure it out later), (2) I have two actions - one changes a scene, but I didn’t set up a scene yet, and I don’t have devices yet. The second one is - notification, which I was hoping to see. Is it the right way to get some message in HA web interface?
I can see this automation running in the web-interface, but it never got triggered.
So I wanted to ask:
- How can I check that my messages arrived at MQTT broker? I couldn’t find any log file for the embedded broker.
- How can I check that MQTT broker gave the information to HA? And do I need to do extra setup for that?
- If the first two steps work, what else do I need to do to trigger the automation action?
If that’s very simple questions, please tell me where I should look for answers, and what keywords to search?