homie-sdk

1.1.0 • Public • Published

Homie SDK

SDK for managing devices and their states, it is based on extended protocol homieiot. The main idea was taken from Homie iot convention and contains extented features that are used in 2Smart products.

Extended features

  1. The device has a group of attributes $options, which in format repeats the $properties from the node. Used to store device settings, both editable and not. Example: sweet-home/device/$options/some-option.

  2. The device has a group of attributes $telemetry, which in format repeats the $properties from the node. Used to store various telemetry and statistics. $stats is not used. Example: sweet-home/device/$telemetry/some-telemetry.

  3. A node has a $state attribute, similar to a device. Example: sweet-home/device/node/$state.

  4. The node has a group of attributes $options, similar to the device. Example: sweet-home/device/node/$options/some-option.

  5. The node has a group of attributes $telemetry, similar to the device. Example: sweet-home/device/node/$telemetry/some-telemetry.

  6. A mechanism for validating the set values has been added to the application:

    • On the received message, in case of incorrect values, the error body should be sent to a topic like errors/sweet-home/device/node... The error body should be in the JSON format of the string
    { "code" : "<error_code>", "message": "<error message>" }
    

    For example, if an incorrect value has come to the topic sweet-home/device/node/sensor/set, then the error should be sent to the topic errors/sweet-home/device/node/sensor

    • Valid for any editable values ($properties, $options, $telemetry).
  7. Device and node indicators are taken from the following attributes:

    • Status (state) - $state.
    • Signal strength - $telemetry/signal.
    • Battery charge level - $telemetry/battery.

Device attribute $stats from the original protocol is not supported.

Required state for creating an entity in an application

  • For device: $homie, $name, $localip, $mac, $fw/name, $fw/version, $implementation, $state.
  • For node: $name, $state plus at least one property.
  • For properties: ($properties, $options, $telemetry): $name.

Structure

  1. Broker - supported transport protocols.
  2. Device - tool for device creation/control.
  3. Node - tool for node creation/control.
  4. Property - tool for property creation/control.
  5. Sensor - tool for sensor creation/control.
  6. ETL - set of rules for the data transformation.
  7. Homie - toolkit for managing devices and their states.
  8. Bridge - toolkit for bridge developers.
  9. Utils - set of utilities.

Readme

Keywords

Package Sidebar

Install

npm i homie-sdk

Weekly Downloads

65

Version

1.1.0

License

SEE LICENSE IN LICENSE.txt

Unpacked Size

824 kB

Total Files

149

Last publish

Collaborators

  • 2smart