flowthings.io Agent


The flowthings.io Agent is self-contained executable that runs on low-powered gateway devices, and facilitates communication between the device and flowthings.io. Using the agent makes it easier to get devices connected to flowthings.io.

The following architectures are currently supported:

  • 386
  • AMD64
  • ARM6
  • ARM7
  • Darwin

Device setup and Installation


The flowthings.io Agent requires a Device object be created first. This will facilitate bi-directional communication between the agent and flowthings.io, create a unique Token for the device, and allow the status of the agent to be reported.

Log in to the flowthings.io Developer Site. Navigate to the "Devices" section, and create a new Device:

image

Once the Device is created, choose the required architecture and download the executable. The "configuration" will be needed in order to start the agent - they can be set as environment variables, or passed as options on the command line.

image

Agent Configuration and Execution


Executing the Flow Agent program with the --help parameter will show usage and configuration options. Ensure you supply the configuration options as given when creating the Device (see previous section).

By default, the agent will connect to flowthings.io and begin reporting its status. Furthermore, it will open a bi-directional Unix Domain Socket (a TCP socket can be configured if preferred) upon which the agent will listen for input, and write output Drops.

To send Drops to flowthings.io, valid JSON must be written to the socket, followed by an EOL character. The Drop will then be created under <device path>/default, where <device path> is the path of the Device object created in the previous section.

For example:

$ socat - UNIX-CONNECT:/tmp/ftagent
{"temperature" : {"val" : 28.1, "unit" : "C"}}

The JSON written to the socket can either be the full Drop definition:

{"path" : "/alice/device/tv", "elems" : {"channel" : 123}}

... or simply at the "elems" level:

{"channel" : 123}

The agent will also receive Drops written to the Flow <device path>/command. These Drops are written to the same socket.

Special commands can be sent to the agent to instruct it to perform an action:

{"command" : "mute"}    ## Instructs the agent not to send messages
{"command" : "unmute"}  ## Instructs the agent to resume sending messages

Whilst the agent is running and connected to flowthings.io, the status of the Device can be seen in the flowthings.io Developer Site, or by querying the device using the HTTP REST API