Mycroft Notifications

I would like to implement a Mycroft skill that can notify users when some external event occurs. For example, when the clothes are done drying, Mycroft will “speak” the notification “Clothes are ready”.
Is something like this possible? If so, what protocol is recommended for sending/broadcasting messages which mycroft can process?
Any other guidance to point me in the right direction for developing such a skill would be greatly appreciated (e.g. useful mycroft APIs/libraries).

Thanks.
Ben

You are going to want to familiarize yourself with the message bus. This will have what you want.
https://mycroft-ai.gitbook.io/docs/mycroft-technologies/mycroft-core/message-bus

I am also working on an MQTT skill that would do exactly what you are looking for.
Early preview here (untested)…

2 Likes

Thanks for the info. This is exactly what I need.

1 Like

Your welcome, and welcome to the forum :+1:

1 Like

@pcwii, what is the current status of your skill? I have installed it, however, I am not able to successfully see any mqtt message handled by the skill.

In settingsmeta.json, I have:
base_topic = Mycroft,
broker_address = 127.0.0.1 (broker installed on same pi as my one picroft)
location_id = basement

On the picroft terminal, I execute
mosquitto_pub -f ~/mesh_message.txt -t “Mycroft/Re
moteDevices/basement/” -d

where mesh_message.txt is
{
“source”:“basement”,
“command”:“speak hello”
}

mosquitto output:
(.venv) pi@picroft:~/mycroft-core/skills/mesh-skill.pcwii $ mosquitto_pub -f ~/mesh_message.txt -t “Mycroft/RemoteDevices/basement/” -d
Client mosqpub|4786-picroft sending CONNECT
Client mosqpub|4786-picroft received CONNACK (0)
Client mosqpub|4786-picroft sending PUBLISH (d0, q0, r0, m1, ‘Mycroft/RemoteDevices/basement/’, … (65 bytes)
)
Client mosqpub|4786-picroft sending DISCONNECT

But it does not appear that the mesh-skill is picking up the message. I see no output in skills.log. Should I? Any thoughts on how I might debug this further?

Thanks.
Ben

1 Like

@screamnAbdab, Welcome to Alpha testing :wink: I only installed the skill myself for the first time last evening and did quite a few updates to the repo to get it to run at all. I plan on doing more tonight if I find the time. Once I give it a passing grade I will officially release it to the community in a new post.
A few things to test.

  1. You definitely should have something in the skills log.
  2. Make sure you have the mqtt enabled in the skill settings web gui
  3. Make sure you are using a valid port
  4. every mycroft request and response should be published to a topic
 22:04:30.986 | INFO     |   670 | mesh-skill_pcwii:handle_utterances:139 | what time is it
 22:04:31.030 | INFO     |   670 | mesh-skill_pcwii:send_MQTT:171 | MQTT: Mycroft/RemoteDevices/b827eb534955/request, what time is it
 22:04:31.191 | INFO     |   670 | mesh-skill_pcwii:send_MQTT:173 | address: 192.168.0.43, Port: 1883
 22:04:31.551 | INFO     |   670 | mesh-skill_pcwii:handle_speak:148 | Mycroft/RemoteDevices/b827eb534955/response
 22:04:31.570 | INFO     |   670 | mesh-skill_pcwii:handle_speak:152 | It is five oh four
 22:04:31.594 | INFO     |   670 | mesh-skill_pcwii:send_MQTT:171 | MQTT: Mycroft/RemoteDevices/b827eb534955/response, It is five oh four
 22:04:31.606 | INFO     |   670 | mesh-skill_pcwii:send_MQTT:173 | address: 192.168.0.43, Port: 1883
  1. If the skill loaded properly you should be able to issue the following command…
    Hey mycroft…Send a remote message
    and it will walk you through the dialog.

when the skill loaded it should have created the following log entries

2020-01-03 02:23:30.444 | INFO     |   670 | mesh-skill_pcwii:on_websettings_changed:110 | Websettings Changed! 192.168.0.43, 1883
2020-01-03 02:23:30.451 | INFO     |   670 | mesh-skill_pcwii:get_mac_address:129 | MQTT using UUID: b827eb534955
2020-01-03 02:23:30.467 | INFO     |   670 | mesh-skill_pcwii:mqtt_init:114 | MQTT Is Enabled
2020-01-03 02:23:30.472 | INFO     |   670 | mesh-skill_pcwii:mqtt_init:116 | Connecting to host: 192.168.0.43, on port: 1883
2020-01-03 02:23:30.480 | INFO     |   670 | mesh-skill_pcwii:mqtt_init:119 | MQTT Loop Started Successfully
2020-01-03 02:23:30.503 | INFO     |   670 | mycroft.skills.skill_loader:_communicate_load_status:278 | Skill mesh-skill.pcwii loaded successfully
2020-01-03 02:23:30.510 | INFO     |   670 | mycroft.skills.skill_manager:put:73 | Updating settings meta during runtime...
2020-01-03 02:23:30.514 | INFO     |   670 | mesh-skill_pcwii:on_connect:59 | Connection Verified
2020-01-03 02:23:30.522 | INFO     |   670 | mesh-skill_pcwii:on_connect:63 | Mesh-Skill Subscribing to: Mycroft/RemoteDevices/basement

If i get a chance I will do more testing on my end.

@screamnAbdab
Here is my settings for reference…

Testing and Feedback for Mesh-Skill

Working well for me now, thanks! I am having issues with skill settings so I made a small local modification, setting MQTT_Enabled to True by default in code.
I think this is going to be a very useful skill. Great job!
-Ben

1 Like

Glad it is working. I have to add a bit of error proofing but should provide most of the desired functionality for now. Thanks for testing :+1:

1 Like