-
Notifications
You must be signed in to change notification settings - Fork 15
Preselector Support
SCOS Sensor can be configured to support preselectors. This page provides details about preselector support and an example configuration of using a WebRelayPreselector
from the NTIA/ITS Preselector API.
SCOS Sensor's preselector handling is determined by the values of the environment variables PRESELECTOR_MODULE
and PRESELECTOR_CLASS
. At present, the only supported preselector module is the default, the NTIA/ITS Preselector API. The default preselector class is the WebRelayPreselector
, defined in that module. If you wish to replace this with another module, modify the environment variables such that PRESELECTOR_MODULE
is the name of a Python module which implements the preselector as a class with the name defined by PRESELECTOR_CLASS
.
To use a preselector with the NTIA/ITS Preselector API, you must create and populate a JSON preselector configuration file. This file defines the various states, sensors, inputs, and control URLs for a given preselector. By default, SCOS Sensor looks in the configs
directory for the file preselector_config.json
. However, the location of this file is configurable using the PRESELECTOR_CONFIG
environment variable. An example is provided below for a WebRelayPreselector
.
The following example defines a WebRelayPreselector
with three controllable relay states and a variety of sensors. Specifically, this preselector includes multiple temperature sensors, a humidity sensor, voltage monitors, and a "door-open" sensor. Digital inputs to the preselector web relay also provide status flags for the onboard Uninterruptible Power Supply (UPS).
{
"name": "preselector",
"base_url" : "http://192.168.1.2/state.xml",
"control_states": {
"noise_diode_on" : "1State=1,2State=1,3State=0,4State=0",
"noise_diode_off" : "1State=1,2State=0,3State=0,4State=0",
"antenna" : "1State=0,2State=0,3State=0,4State=0"
},
"status_states": {
"noise diode powered" : "relay2=1",
"antenna path enabled": "relay1=0",
"noise diode path enabled": "relay1=1"
},
"sensors": {
"internal_temp": 1,
"internal_humidity": 2,
"tec_intake_temp": 3,
"tec_exhaust_temp": 4
},
"digital_inputs": {
"ups_power": 1,
"ups_battery_level": 2,
"ups_trouble": 3,
"ups_battery_replace": 4
},
"analog_inputs": {
"door_sensor": 1,
"5vdc_monitor": 2,
"28vdc_monitor": 3,
"15vdc_monitor": 4,
"24vdc_monitor": 5
}
}