Skip to the content.

Back

User Management

This section describes the topics that deal with user management. That being said, the core functionality of this module is to add, delete or update users inside a one MQTT2GO smart-home (which does not necessarily mean one SH-GW). We distinguish between three user roles: (i) Administrator, who has full access to all features and therefore can control whole household without any restrictions, (ii) family member, who can control the whole smart-home but cannot manage users, and guest, who can control only utility home devices, such as lights nad smart TVs.

User Role Administrator Family member Guest
User management 🗙 🗙
Security device control 🗙
Utility home device control

Topics Structure

The base topic for user management is defined as:

<home_id>/users/<command_type>/<msg_direction>

Inside this topic, the MQTT2GO commands are sent if any user-related operation is to be performed.

MQTT Commands

The MQTT commands for user management are based on the commands template from MQTT Commands, where the MQTT command_type will be one of the following:

The JSON body for add_user two commands will be:

<home_id>/users/add_usr/<msg_direction>
{
    "user_id": "id",
    "email": "email",
    "user_name": "name",
    "role": "role",
    "language": "language"
}

The JSON body for updt_user two commands will be:

<home_id>/users/updt_usr/<msg_direction>
{
    "user_id": "id",
    "email": "email",
    "user_name": "name",
    "role": "role",
    "language": "language"
}

and for the deletion operation:

<home_id>/users/del_usr/<msg_direction>
{
	"value": "id"
}

The concrete value of each parameter depends on the specific use-case.

MQTT Reports

The MQTT reports for the user management are based on the commands template from MQTT Reports, where the MQTT report_type corresponds to the commands from: MQTT Commands, with the JSON body containing the operation results:

<home_id>/users/<command_type>/<msg_direction>
{
	"value": "result_value"
}

The result itself can be:

Examples

The example of a user add operation can look like:

<home_id>/users/add_usr/in
{
    "user_id": 123456789,
    "email": "john.doe@mail.com",
    "user_name": "John Doe",
    "role": "adult",
    "language": "en"
}

and the response will be:

<home_id>/users/add_usr/out
{
	"value": "ok" 
}

Back