exred_node_aws_iot_daemon v0.2.1 Exred.Node.AwsIotDaemon

This is a daemon node that sets up a connection to the AWS IoT service.

####Setup in AWS IoT Cloud

It needs a device (thing) set up in the AWS cloud per instruction. see:AWS IOT Getting Started

Proper certificates need to be generate and attached to the Thing and policies set up so that this node can access the Thing Shadow using the certs and private key.

The cert, private key and CA cert needs to be downloaded from AWS and placed somewhere in the local file system where the Elixir runtime can access it.

Configure these locations in the application config file.

Example:

# ssl options for the MQTT client
# these get passed to the Erlang ssl module
# see ssl_option() here: http://erlang.org/doc/man/ssl.html
config :exred_node_aws_iot_daemon, :ssl,
  keyfile: "/exred_data/certs/private.pem.key",
  certfile: "/exred_data/certs/certificate.pem.crt",
  cacertfile: "/exred_data/certs/symantec_ca_root.pem"

####Node Configuration

host: aws iot endpoint for MQTT connections; see:AWS IoT

port: MQTT connection port

client_id: client id provided to the MQTT client (can be any string identifying this client)

Link to this section Summary

Functions

Returns a specification to start this module under a supervisor

fire/1 is called when the user clicks on the play button on a node in the UI (and with that triggers a 'fire' event). It should return a new_state

handle_msg/2 is called whenever the node receives a message from another node. It should return an {outgoing_msg, new_state} tuple

node_init/1 initializes the node process. This is called as the last step of the node's init function. Needs to return a new state or a {state, timeout} tuple. (see GenServer documentation)

Link to this section Functions

Link to this function

add_out_node(pid, new_out)

Link to this function

child_spec(arg)

Returns a specification to start this module under a supervisor.

See Supervisor.

fire/1 is called when the user clicks on the play button on a node in the UI (and with that triggers a 'fire' event). It should return a new_state.

Since this has access to the node's state it can be used to implement user triggered actions like logging the state, sending messages from the node or creating debug events that are displayed in the debug tab in the UI.

For an example of how to use it see the Trigger node.

Callback implementation for Exred.NodePrototype.fire/1.

Link to this function

get_default_config()

Link to this function

handle_msg(msg, state)

handle_msg/2 is called whenever the node receives a message from another node. It should return an {outgoing_msg, new_state} tuple.

Callback implementation for Exred.NodePrototype.handle_msg/2.

Link to this function

node_init(state)

node_init/1 initializes the node process. This is called as the last step of the node's init function. Needs to return a new state or a {state, timeout} tuple. (see GenServer documentation)

Callback implementation for Exred.NodePrototype.node_init/1.

Link to this function

set_out_nodes(pid, out_nodes)

Link to this function

start_link(list)