-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add input protection scripts for SEA sensors, update SCOS plugins (#256)
* Add input protection scripts * Update scos plugin branches for testing * Make input protection script executable * Update requirements files * Update scos-tekrsa and scos-actions * Update pre-commit hooks * Run pre-commit hooks * Modify log levels * Update pre-commit autoformatter * Run autoformatter * Update requirements --------- Co-authored-by: root <[email protected]>
- Loading branch information
1 parent
d8dabea
commit d652dcb
Showing
12 changed files
with
110 additions
and
27 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
import json | ||
|
||
from its_preselector.controlbyweb_web_relay import ControlByWebWebRelay | ||
from its_preselector.web_relay_preselector import WebRelayPreselector | ||
|
||
sensor_definition_file = "/opt/scos-sensor/configs/sensor_definition.json" | ||
preselector_json_file = "/opt/scos-sensor/configs/preselector_config.json" | ||
spu_relay_json_file = "/opt/scos-sensor/configs/switches/x410_config.json" | ||
|
||
# Load Preselector | ||
with open(sensor_definition_file) as f: | ||
sensor_definition_json = json.load(f) | ||
with open(preselector_json_file) as f: | ||
preselector_json = json.load(f) | ||
preselector = WebRelayPreselector(sensor_definition_json, preselector_json) | ||
|
||
# Load SPU Relay | ||
with open(spu_relay_json_file) as f: | ||
spu_json = json.load(f) | ||
spu_relay = ControlByWebWebRelay(spu_json) | ||
|
||
# Enable Preselector Power | ||
spu_relay.set_state("power_on_preselector") | ||
|
||
# Set Preselector to Antenna State | ||
preselector.set_state("antenna") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
import json | ||
|
||
from its_preselector.controlbyweb_web_relay import ControlByWebWebRelay | ||
from its_preselector.web_relay_preselector import WebRelayPreselector | ||
|
||
sensor_definition_file = "/opt/scos-sensor/configs/sensor_definition.json" | ||
preselector_json_file = "/opt/scos-sensor/configs/preselector_config.json" | ||
spu_relay_json_file = "/opt/scos-sensor/configs/switches/x410_config.json" | ||
|
||
# Load Preselector | ||
with open(sensor_definition_file) as f: | ||
sensor_definition_json = json.load(f) | ||
with open(preselector_json_file) as f: | ||
preselector_json = json.load(f) | ||
preselector = WebRelayPreselector(sensor_definition_json, preselector_json) | ||
|
||
# Load SPU Relay | ||
with open(spu_relay_json_file) as f: | ||
spu_json = json.load(f) | ||
spu_relay = ControlByWebWebRelay(spu_json) | ||
|
||
# Set Preselector to Noise Diode Off State | ||
preselector.set_state("noise_diode_off") | ||
|
||
# Disable Preselector Power | ||
spu_relay.set_state("power_off_preselector") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
#!/bin/bash | ||
|
||
# Usage: | ||
# - Activate a Python environment with the its_preselector | ||
# package installed | ||
# - Run this script with start and stop times for input | ||
# protection specified as command line arguments. | ||
|
||
# Example: Enable input protection from 10:00 to 12:00 | ||
# > sudo bash | ||
# > cd /opt/scos-sensor | ||
# > venv/bin/activate | ||
# > pip install git+https://github.com/NTIA/Preselector | ||
# > bash scripts/input_protection.sh 10:00 12:00 | ||
|
||
# This script sets the preselector state to "noise_diode_off" | ||
# then powers off the preselector, at START_TIME | ||
# Then, at STOP_TIME, the preselector is powered on and set to | ||
# the "antenna" state. | ||
|
||
|
||
START_TIME=$1 | ||
STOP_TIME=$2 | ||
|
||
SCRIPT_DIR=$(dirname "$0") | ||
|
||
echo "python3 $SCRIPT_DIR/_input_protection_enable.py" | at $START_TIME | ||
|
||
echo "python3 $SCRIPT_DIR/_input_protection_disable.py" | at $STOP_TIME |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -321,11 +321,11 @@ scipy==1.10.1 | |
# via | ||
# -r requirements.txt | ||
# scos-actions | ||
scos-actions @ git+https://github.com/NTIA/scos-actions@6.3.3 | ||
scos-actions @ git+https://github.com/NTIA/scos-actions@6.4.2 | ||
# via | ||
# -r requirements.txt | ||
# scos-tekrsa | ||
scos-tekrsa @ git+https://github.com/NTIA/[email protected].3 | ||
scos-tekrsa @ git+https://github.com/NTIA/[email protected].5 | ||
# via -r requirements.txt | ||
sigmf @ git+https://github.com/NTIA/SigMF@multi-recording-archive | ||
# via | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -13,8 +13,7 @@ psycopg2-binary>=2.0, <3.0 | |
pyjwt>=2.4.0, <3.0 | ||
requests-mock>=1.0, <2.0 | ||
requests_oauthlib>=1.0, <2.0 | ||
scos_actions @ git+https://github.com/NTIA/[email protected] | ||
scos_tekrsa @ git+https://github.com/NTIA/[email protected] | ||
scos_tekrsa @ git+https://github.com/NTIA/[email protected] | ||
|
||
# The following are sub-dependencies for which SCOS Sensor enforces a | ||
# higher minimum patch version than the dependencies which require them. | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -149,11 +149,9 @@ ruamel-yaml-clib==0.2.8 | |
# via ruamel-yaml | ||
scipy==1.10.1 | ||
# via scos-actions | ||
scos-actions @ git+https://github.com/NTIA/[email protected] | ||
# via | ||
# -r requirements.in | ||
# scos-tekrsa | ||
scos-tekrsa @ git+https://github.com/NTIA/[email protected] | ||
scos-actions @ git+https://github.com/NTIA/[email protected] | ||
# via scos-tekrsa | ||
scos-tekrsa @ git+https://github.com/NTIA/[email protected] | ||
# via -r requirements.in | ||
sigmf @ git+https://github.com/NTIA/SigMF@multi-recording-archive | ||
# via scos-actions | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters