Skip to content

Latest commit

 

History

History
96 lines (71 loc) · 3.81 KB

MQTT.md

File metadata and controls

96 lines (71 loc) · 3.81 KB

PIXELIX

PIXELIX

License

Plugin development

MQTT

Pixelix is a MQTT client which can be connected to a MQTT broker. The MQTT broker URL is configued in the settings via webinterface.

Format: [mqtt://][<USER>:<PASSWORD>@]<URI>

Examples:

Overview Mindmap

topic-handling-minmap

MQTT Topics

Birth and last will

Pixelix supports birth and last will messages.

After the successful connection establishment to the MQTT broker, Pixelix will send "online" to the <HOSTNAME>/status topic. In any disconnect case, "offline" will be sent to the <HOSTNAME>/status topic.

Plugin topic path

The base topic path to access plugin related topics can be setup with the plugin UID or the plugin alias:

  • <HOSTNAME>/display/uid/<PLUGIN-UID>/...
  • <HOSTNAME>/display/alias/<PLUGIN-ALIAS>/...

Topic name

The complete topic name can be derived from the REST API documentation.

Example: JustTextPlugin

The REST API URL looks like the following: http://<HOSTNAME>/rest/api/v1/display/uid/<PLUGIN-UID>/text?text=<TEXT>

  1. Replace the http://<HOSTNAME>/rest/api/v1/ part with <HOSTNAME> --> <HOSTNAME>/display/uid/<PLUGIN-UID>/text?text=<TEXT>
  2. Every URL parameter, which is in this case show=<TEXT> must be sent in JSON format.
{
    "text": "<text>"
}

Sending a bitmap

The JSON data must have two keys:

  • fileName: The name of the file which to upload.
  • file: The file itself in BASE64 encoded.

Example: IconTextPlugin

{
    "fileName": "hacker.bmp",
    "file": "Qk32AAAAAAAAADYAAAAoAAAACAAAAAgAAAABABgAAAAAAMAAAAAAAAAAAAAAAAAAAAAAAAAAzEg/AAAAAAAAAAAAzEg/zEg/AAAAAAAAAAAAzEg/zEg/zEg/zEg/AAAAAAAAAAAAAAAAzEg/AAAAAAAAAAAAAAAAJBztJBztAAAAzEg/AAAAzEg/zEg/zEg/AAAAJBztAAAAAAAAzEg/AAAAAAAAAAAAAAAAJBztAAAAAAAAAAAAzEg/zEg/AAAAAAAAJBztAAAAAAAAAAAAzEg/zEg/AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"
}

Sensors

The sensor topic path is valid if the sensor is available!

  • Temperature in °C: <HOSTNAME>/sensors/0/temperature/state
  • Humidity in %: <HOSTNAME>/sensors/1/humidity/state
  • Illuminance in lx: <HOSTNAME>/sensors/2/illuminance/state
  • Battery SOC in %: <HOSTNAME>/sensors/3/soc/state

Issues, Ideas And Bugs

If you have further ideas or you found some bugs, great! Create a issue or if you are able and willing to fix it by yourself, clone the repository and create a pull request.

License

The whole source code is published under the MIT license. Consider the different licenses of the used third party libraries too!

Contribution

Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, shall be licensed as above, without any additional terms or conditions.