hansmbakker / nuimo-mqtt-manager

Publishes Nuimo events over MQTT so that apps written in different languages running on different devices can interact with Nuimo at the same time
10 stars 1 forks source link

Introduction

This application is meant as a proof of concept to let multiple Nuimos work with multiple apps running on multiple devices. It removes the limitation of not being able to control the music on your phone while your computer is connected to it.

Demonstration

A demo video can be seen at https://vimeo.com/162261040.

Multiple Nuimos

This is not worked out in the application yet since I had no devices to test with, but the protocol is prepared for it.

Use cases

Note: these are ideas, but not all use cases are implemented

Technical solution

User interface

A proposal for a user interface is shown below:

User interface proposal

System diagram

A system overview is shown below.

Nuimo-MQTT system overview

Protocol

There are three types of channels (MQTT topics):

MQTT topic: nuimo

register

Command sent by an app to let the nuimo-mqtt daemon

{
    "command": "register",
    "id": "idOftheApp",
    "name": "Display name of the app",
    "icon": "string of 81 characters representing an icon"
}

unregister

Command sent by an app to let the nuimo-mqtt daemon

Format:

{
    "command": "unregister",
    "id": "idOfTheAppThatWantsToBeUnregistered"
} 

MQTT topic: nuimo/<nuimo-uuid>/<appId>

Nuimo events are only sent to the app that is currently 'active' on a Nuimo so that there will not be unintended input to other apps. Apps can still request to become active by publishing a listenPlease command on their channel.

listenPlease

The listenPlease message is to tell an app that the user selected it so that the app is expected to start listening. The app's icon will be shown shortly.

(Not implemented yet)

showIcon

Command to shortly show an icon, for example to respond to user input or to show some notification.

Format:

{
    "command": "showIcon",
    "icon": "string, array of strings or array of numbers representing an icon",
    "brightness": 0.3,
    "duration": 0.3
} 

showNamedIcon

Command to shortly show an icon, for example to respond to user input or to show some notification.

Format:

{
    "command": "showNamedIcon",
    "iconName": "iconName",
    "brightness": 0.3,
    "duration": 0.3
} 

showProgressBarIcon

Command to shortly show a progress bar icon, for example to respond to user input or to show some notification.

Format:

{
    "command": "showProgressBarIcon",
    "value":0.77,
    "style": "VerticalBar",
    "brightness": 0.3,
    "duration": 0.3
} 

nuimoEvent

Gesture event from Nuimo. The apps should listen to this event.

Nuimo events are only sent to the app that is currently 'active' on a Nuimo so that there will not be unintended input to other apps.

Format:

{
    "command": "nuimoEvent",
    "gesture": "RotateRight", //one of the gesture types like ButtonPress etc
    "value": 24 //depends on gesture type
}