a group of bees is a swarm, A Group of Mycrofts is a MESH
Introducing my Mesh Skill
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)
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
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?).
Each Mycroft unit has itâs own Device Name (location_id) that can be set in the web interface.
The Mycroft unit will automatically subscribe to all messages sent to itâs own Device Name (location_id).
<base_topic>/RemoteDevices/<location_id>
When a message is sent from any Mycroft unit, the message will be published to âMycroft/RemoteDevices/location_idâ.
The destination location_id is specified in the skill dialog.
The message payload will contain the following âsampleâ JsonâŠ
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"}
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.
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)
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.
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
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.
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.
``
Since I do not have multiple units I have been doing all my testing with Home Assistant, so i can confirm that works too.