-
Notifications
You must be signed in to change notification settings - Fork 2
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
Conversation
…s signal to allow things that can report status to be registered within scos-sensor. Adds configurable action to set switch states.
…th_status signal in constructor.
… added type to status.
…s before anything that could provide status is created.
…f MockSignalAnalyzer to discover to supply to test actions. Only register mock signal analyzer for status if running with mock sigan.
There was a problem hiding this 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.
…e in power_cycle.
…actions into MultiSwitchStatus
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks great!
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.