Hub node

The Hub node is the central component of the DuloNode module. It is responsible for facilitating communication between Node-RED and the Alexa DuloNode Skill.

Hub node output payloads are generated whenever a device’s state changes, regardless of how the change is introduced. This could be through an Alexa voice command, the Alexa app, or an input payload sent to the Hub node.

Important

A flow must contain only one Hub node. Using multiple Hub nodes with the same account will cause devices to not register correctly. Remove any extra Hub nodes and redeploy if this occurs.

Device nodes can be connected to the Hub node directly or through Link In/Out nodes. When using Link In/Out nodes, device nodes must be connected directly to the Link In node.

On every deploy, the Hub node outputs a debug message listing all registered devices. This can be used to verify that devices are correctly connected and recognised.

Properties

To properly set up a working system, the DuloNode email and password must be configured in the node properties. This setup ensures secure communication between the devices and Alexa DuloNode Skill.

The properties section also allows managing the subscription, providing options to upgrade the plan, modify existing details, or cancel the subscription entirely.

Input

The Hub node can receive input payloads to manually trigger state changes or actions for the connected devices. Input payloads must conform to the expected JSON format for the devices connected to the Hub node.

Supported inputs

Output

The Hub node generates a detailed output payload whenever a state change occurs in any connected device. This output helps you track changes and synchronize the state of your hardware devices and virtual Node-RED devices, ensuring accurate application of Alexa commands to physical home automation appliances. The payload provides information about the device, its components, and both the current and previous states.

Supported outputs

Payload

Payload output properties:

  • name: The name of the device
  • type: The type of the device
  • components: A set containing the current state of each component associated with the device.
    A detailed list of all components and their properties can be found here.
  • metadata.previous.components: Contains the previous state of each component before the change occurred, enabling comparison and tracking.
  • metadata.context.source: Indicates the initiator of the device state change - either Alexa or Hub input
  • metadata.context.action: The Alexa directive that triggered the state change, in the format Controller.Action (e.g. PowerController.TurnOn, BrightnessController.SetBrightness). Only present when metadata.context.source is Alexa.
  • id: A unique identifier for the device.

Example Output

Here is an example of an output payload for the device “Reading lamp” of type light:

{
  "name": "Reading lamp",
  "type": "light",
  "components": {
    "PowerController": {
      "powerState": "ON"
    },
    "BrightnessController": {
      "brightness": 40
    },
    "ColorController": {
      "color": {
        "hue": 0,
        "saturation": 0,
        "brightness": 1
      }
    },
    "ColorTemperatureController": {
      "colorTemperatureInKelvin": 4000
    },
    "ColorModeController": {
      "colorMode": "HUE"
    }
  },
  "metadata": {
    "context": {
      "source": "alexa",
      "action": "BrightnessController.SetBrightness"
    },
    "previous": {
      "components": { 
        "PowerController": {
          "powerState": "ON"
        },
        "BrightnessController": {
          "brightness": 50
        },
        "ColorController": {
          "color": {
            "hue": 0,
            "saturation": 0,
            "brightness": 1
          }
        },
        "ColorTemperatureController": {
          "colorTemperatureInKelvin": 4000
        },
        "ColorModeController": {
            "colorMode": "HUE"
        }
      }
    }
  },
  "id": "d36ef110f0630946"
}