Mycroft Community Forum

Testing and Feedback for Mesh Skill (Mycroft to Mycroft Communicator)


What do you call a group of Mycrofts?

  • a group of Lions is a Pride,
  • a group of birds is a flock,
  • a group of bees is a swarm,
    A Group of Mycrofts is a MESH
    Introducing my Mesh Skill :partying_face:

Mesh

send MQTT messages and commands between multiple mycroft.ai devices.

About

This skill utilizes the lightweight MQTT messaging protocol to connect a group (“mesh”) of Mycroft units together. The skill has the ability to send messages (intercom) and commands (messagebus) to one or more remote Mycroft units. (or other MQTT enabled devices, eg. HA)

  1. Each Mycroft unit has the ability to publish both Mycroft requests and responses to the the MQTT broker.
    The MQTT Topics for this communication is…
    • <base_topic>/RemoteDevices/deviceUUID/request
    • <base_topic>/RemoteDevices/deviceUUID/response
  2. The deviceUUID is a unique ID created from the MAC of the sending Mycroft unit.
    *This is intended to be a general MQTT broadcast and can be subscribed to by any MQTT client (ie. Home Assistant?).
  3. Each Mycroft unit has it’s own Device Name (location_id) that can be set in the web interface.
  4. The Mycroft unit will automatically subscribe to all messages sent to it’s own Device Name (location_id).
    • <base_topic>/RemoteDevices/<location_id>
  5. When a message is sent from any Mycroft unit, the message will be published to “Mycroft/RemoteDevices/location_id”.
  6. The destination location_id is specified in the skill dialog.
  7. The message payload will contain the following “sample” Json…
    • {"source":"<source_location_id>", "message":"is dinner ready yet"}

Examples

  • “Send a message”
  • “Send a command”

Overview

Conversational Context

  • Example 1 (from basement to kitchen)
hey mycroft...
    send a message...
where would you like to send the message?...
    kitchen...
what would you like the message to be?...
    Is dinner ready yet?
I am preparing to send a, message, to the, kitchen, device.
mycroft publishes...
"<base_topic>/RemoteDevices/kitchen/{"source":"basement", "message":"is dinner ready yet"}
  • Example 2 (from kitchen to basement)
hey mycroft...
    send a command...
where would you like to send the command?...
    basement...
what would you like the command to be?...
    set a timer for 5 minutes?
Sending command, to the basement.
mycroft publishes...
"<base_topic>/RemoteDevices/basement/{"source":"kitchen", "command":"set a timer for 5 minutes"}

Installation Notes

  • ensure you have a working MQTT Broker. how to install mqtt broker.
  • SSH and run: msm install https://github.com/pcwii/mesh-skill.git
  • Configure home.mycroft.ai
    • Ensure MQTT is enabled.
    • Create a custom base topic name <base_topic>.
    • Set IP Address of your broker
    • Set the websocket Port of your broker.
    • Set the location ID of this mycroft unit <location_id>.
    • This skill must be installed, and configured for each unit in your "mesh"
    • MQTT paths are case sensitive

Requirements

6 Likes

Does this use TLS for comunication?

Currently unencrypted. I am investigating what is required for this. I am interested in making this an option so i can possibly utilize a public broker to communicate to multiple remote locations, not just in a local lan.

1 Like

Excellent! great job!

1 Like

AWESOME I was waiting a skill like this to communicate between my Home Assistant and other Mycroft devices!

I can’t wait to test it, but I need to wait to complete my move on the new flat :triumph:

1 Like

If you develop any HA scripts or automations, I would be interested in checking them out. I am looking to annunciate some of my HA events with Mycroft.

You can already do that, although one Mycroft instance. But then again, you could possibly also setup multiple MycroftOS within HASS as TTS output. (Did that before)

Probably better anyway, that way you can add room presence to only speak when someone is in the room. (Not tried yet)

1 Like

For those who are interested, i have added broker authentication to the mesh-skill for those who require it.

2 Likes

I can confirm this working with FHEM’s MQTT2_DEVICE - I can see requests and responses from my Picroft and Mark-I. I like that a lot. :+1:

This does not work for me - I have only one setting for my two Mycroft devices (Mark-1, PiCroft). So I can only set location_id for both devices at the same time. I tried changing location_id manually by editing settings.json - but this gets overwritten with the value from home.mycroft.ai after restart of skills-service.

Thanks for testing, i am definitely puzzled by the web settings issue. Does not each Mycroft unit have it’s own web configuration instance? I don’t understand how the configuration instance of one unit gets passed to the other. Truth is i only currently have one unit so i have not seen this. If there is other tests on this you could do it would be helpful. In the meantime i will see if i have another pi laying around.

Not each unit is having its own skill instance. Skills settings are applied to all units, cannot be set per unit. I run into the same problem.
Each unit though is having its own parameters, including a ‘placement’ parameter (kitchen, livingroom etc). If this placement parameter is accessible to individual skills (I don’t know), then that might be the solution for this…

this is one of the things i dislike about the backend, settings are global, not per device

personally i think this sucks, if i have more than 1 device i likely am doing different things, no sense in sharing settings for skills, not sure if the marketplace installs globally also

you probably want to set the name some other way, maybe on first run ask the user to name the device? either do it by intents or use a custom file per device

1 Like

I agree with you, i have always been under the impression the skill settings were per device. I will rethink my implementation.

For some skills I have two tabs with settings per device.

Home assistance for instance I can select my laptop and RPI?

Interesting. I will look into that skill and see what the settings difference is.

This looks like a possible easy solution since each device already has a placement parameters.
It looks like it is accessible via the skill. Good idea, thanks for the suggestion.

Hi there - this sounds like a great idea, thanks @pcwii for your work.

QQ:
Should it be possible to use this with one instance of Mycroft or do I need more than one?
Should I be able to send a message from my office to my office?

In theory one Mycroft would be capable of sending a message or command to it’s own mqtt topic but i am not sure the value in this. You could use this easily with only one mycroft and some other mqtt enabled system or device.

I think there is some value in testing the setup - and maybe playing around with it - before having to set up a 2nd Mycroft device. I tried to have my PiCroft send a message to itself but couldn’t get it to work.

I can see that the MQTT message is sent to the MQTT Broker but it is not repeated on the PiCroft.

@j1nx, @JarbasAl, @Dominik, @rstdelange,
I have updated the skill so that it automagically grabs the location_id from the device websettings “Placement” value.
image
This simplifies the setup a bit, and should correct the issue in the websettings for multiple devices.

@chairstacker,
I confirmed that sending messages to the same device does work. If you tell mycroft to send a message and then specify it’s own device_id it will infact receive the message from the broker.

Thanks all for the input and testing. :partying_face:
``
Since I do not have multiple units I have been doing all my testing with Home Assistant, so i can confirm that works too.

2 Likes