Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support multiple web relays, provide dynamic status, and enable signal analyzer power cycling. #38

Merged
merged 75 commits into from
Sep 8, 2022

Conversation

dboulware
Copy link
Contributor

This pull request enables sensors to include multiple web-relays, provide dynamic status for any number of components, and enables power cycling of the signal analyzer. To allow for any number of web-relays, this PR adds a SWITCH_CONFIGS_DIR variable to the settings. The variable will default to None or the value of the SWITCH_CONFIGS_DIR in the environment and will be replaced with the value supplied by Django/scos-sensor if it is set. Any web relay config files placed in the specified directory will be loaded and added to a switches dictionary in the hardware package. A SIGAN_POWER_SWITCH setting is added to optionally hold the id of the web relay that controls power to the signal analyzer and a SIGAN_POWER_CYCLE_STATES setting was added to optionally store the sequence of preselector states to set to power cycle the sigan. To support dynamic status, a register_component_with_status signal and associated handler were added to allow components to be dynamically registered to provide status. The capabilities are moved into their own package to prevent the expensive loading with the settings that are frequently used. Finally, I removed the default usage of the MockSignalAnalyzer from the actions to prevent developers from accidentally using the mock sigan.

…s signal to allow things that can report status to be registered within scos-sensor. Adds configurable action to set switch states.
…s before anything that could provide status is created.
@aromanielloNTIA aromanielloNTIA added the enhancement New feature or request label Sep 6, 2022
Copy link
Member

@aromanielloNTIA aromanielloNTIA left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great! See minor comments/suggestions. I've also made a few commits which run the pre-commit hooks (we should always do this before merging into master) and swap out some string-formatting code to use the f-string syntax.

scos_actions/hardware/scos_sensor_exception.py Outdated Show resolved Hide resolved
scos_actions/hardware/sigan_iface.py Show resolved Hide resolved
scos_actions/hardware/utils.py Outdated Show resolved Hide resolved
Copy link
Member

@aromanielloNTIA aromanielloNTIA left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great!

@dboulware dboulware merged commit f523fcd into master Sep 8, 2022
@dboulware dboulware deleted the MultiSwitchStatus branch September 8, 2022 13:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants