SolarNode Control Toggle

status pending from SolarNetwork...

This example demonstrates using the Control Toggler class to power a simple UI for turning a SolarNode switch on/off. Control Toggler uses the SolarNetwork Instruction API to request a SolarNode to set the value of a control to 1 (on) or 0 (off), and the SolarNetwork Datum Query API to track the value of the control.

To change the node ID, reload this page with a ?nodeId=X added to the URL, where X is the ID of the node you'd like to control.

The Instruction API is asynchronous and changing a control value requires the following steps:

  1. Enqueue instruction to set control value
  2. Wait for SolarNode to receive, execute, and update instruction status to Completed (or Rejected)
  3. Wait for SolarNode to post updated control value datum for confirmation

Control Toggler handles these steps through a simple API for setting the desired value and using a callback function to get notified when the value changes.

Some example SolarNode plugins that support on/off switching are:

Enter your SolarNetework credentials for node .