Skip to content
rstrouse edited this page Aug 24, 2020 · 6 revisions

Configuring relayEquipmentManager (REM)

REM can be easily configured through an interactive web interface. This interface is designed to simplify the configuration of your controller and manage connections to applications that are used to trigger relays.

IMPORTANT: Changes made to the configuration will only be applied after you have clicked on the Reset Server button or restarting REM. This allows you to get your pin configurations right before they are applied.

Set the Board Type

The first thing you must do is identify the type of board you have. This will allow REM to provide simple mapping between the GPIO pin layouts and the chip mapping for triggers you defined. Once you have selected the correct board type, press the Save Settings button to commit your changes.

image

Configure Connections

Connections are used to marry external programs to GPIO control on your Raspberry Pi or BeagleBone. To configure a connection, press the + icon on the connections list. This will open up a connection editor for creating the connection.

NOTE: As of this writing the only connection type that is complete is nodejs-PoolController. Once you have selected the Conn Type the screen will change, allowing you to enter the details for the connection. For the connection to be valid you must provide the Name of the connection and the Server url. If you are connecting to nodejs-PoolController you can simply click Find Server if SSDP is enabled on your PoolController. This will find any running instances of njspc on your network. Alternatively, you can enter the url manually in the fields provided. Once you have completed defining your connection, press the Save button to commit it to your configuration. image

You may come back later to edit or delete the connection using the icons in the Connections list.

Define Triggers

Once you have identified your board and defined your connections, you can begin matching GPIO pins to triggers from the source. This process will take events that occur in the source application, then trigger the GPIO pins to power leds or relays. To being defining triggers, select the GPIO - Pinouts tab at the top of the screen. Once you do a picture of the GPIO header(s) will be displayed.

imageimage

Headers displayed on this page are interactive in that when you click on one of the pins it will show its configuration to the right of the header. The color of the pins represent the type of pin associated with the board. If you hover over the pin it will give details regarding the pin assignment from the board. The pin color coding is as follows.

  • Light Red = 3v3 volt power
  • Red = 5v power
  • Gray = Ground
  • Brown = System Pins
  • Maroon = Analog Inputs
  • Green = GPIO Pins

NOTE: REM configures only GPIO pins (the green ones), all other pin types are read only.

See the documentation for your relay to determine which pins activate which relay. For instance, on the Waveshare 3-relay hat, the pins that control the relay are pins 37, 38, and 39 for relays 1,2,and 3 respectively.

In this instance, we are going to configure Pin #37 that is attached to relay 1 to trigger when REM gets a valve change from nodejs-PoolController. Once you click Pin #37 it will highlight blue and the pin configuration will be displayed to the right.

image

The first thing you must do is make the pin Active by clicking the Is Active checkbox. This will tell REM that we want to control the pin and apply any triggers that we have added.

The Direction dropdown defines whether the pin is an input or an output. Currently only output pins are supported but in the future selecting input will allow you to create data feeds to external applications. For instance, sending temperature settings to nodejs-PoolController or your Home Automation system.

The Inverted checkbox allows you to reverse the pin operation. This is handy when you want to easily flip the relay state without re-wiring it.

To get Pin #37 to do something we need to add some triggers to it. We are going to tell the pin what should turn it on and what should turn it off. First, we will add the on trigger for the valve by clicking the + icon in the triggers list.

Step 1 - Assign the connection

In the previous section we defined a connection to nodejs-PoolController. Select this connection from the dropdown to display the options for configuring a trigger on this connection. Once we have selected Pool Controller as the desired connection, another dropdown will be added to the display for the Event Name that will be monitored for the trigger. After you have selected the connection, set the Desired State to on since we want to turn the pin on with this trigger. We will add another trigger to turn the pin off after we have saved this one.

Step 2 - Define the trigger event

From the Event Name dropdown select the valve option. Additional options will then appear in the dialog to further refine the filter for the trigger. The valve event is sent from nodejs-PoolController whenever the state of the valve changes. In this case the payload contains a property called isDiverted that is either true or false. This will be automatically selected as this is the only defined binding for valves at the moment.

Triggers can be defined for valves that are controlled by your Outdoor Control Panel (OCP)(e.g. IntelliCenter, IntelliTouch, EasyTouch...etc) as well as virtual ones defined in the dashPanel application. When you define a virtual valve in dashPanel you define the pin # associated with it. We are defining a trigger on a virtual valve in this instance so we will leave the Id field blank. Because we have left this field blank, it will use the Pin Id defined in dashPanel to determine if this is the valve we mean. In this case you would set Pin # in dashPanel to 37 for this valve. If this were a trigger for the Valve A for instance you would set the Id field to 1.

Step 3 - Set up the Binding

In the previous step we defined which valve we are referring to. Now we need to tell the trigger what it should look at in order to fire. The binding is simply an expression so select the dropdowns on the binding line to reflect what should turn on the pin and trigger the relay to closed. When complete the screen should look like the following. If this were a word problem the answer would be... "Trigger Pin #37 to on when we get a valve event that has a pinId of 37 and the isDiverted value equals true." When you have finished press the Save button and this trigger will be added to the Triggers list for the pin. To close the window press Cancel or the X in the top right corner.

image

Step 4 - Add a Trigger to Turn it Off

Complete steps 1-3 to create a trigger that sets the state to off when the isDiverted value is false. image

Step 5 - Reset the Server

When you get here your Pin definition should look like the following.

image

Make sure the Is Active checkbox is checked and you have pressed the Save Pin button after checking it. Then click on the General Tab. From there press the Reset Server button to tell REM to start monitoring the pins we defined with new triggers. The node console will announce events as they come through to allow you to check your configuration.

image