-
Notifications
You must be signed in to change notification settings - Fork 23
Settings: add "Function" dropdown option to allow user to set relay purpose #2751
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
base: main
Are you sure you want to change the base?
Conversation
5caeba6 to
bbae31e
Compare
bbae31e to
da2775b
Compare
blammit
left a comment
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.
PR looks good. My comments are mostly about disregarding "relays" in the code and commit message. Previously, the "Settings/Function" value was only relevant to system relays (i.e. the two relays on the GX, which are also accessible via the switchable output API) but now this value is available generically for all switchable outputs.
In regards to the test failure that may be caused by this condition in SwitchableOutput::updateAllowedInGroupModel():
&& (!m_relayFunctionItem || m_relayFunctionItem->getValue().toInt() == Enums::Relay_Function_Manual);
The updateAllowedInGroupModel() function returns true if the output is allowed in the group model, i.e. the model that is presented in the Switch Pane. This condition is there because system relays should only be shown in the Switch Pane if they are set to the "manual" function - i.e. if they should be manually turned on/off by the user, rather than being automatically controlled by the generator, or by an alarm, etc.
Perhaps the test is failing now because any output (regardless of whether it comes from a system relay or not) is disallowed from the group model if it has a manual function. We should continue to check that the function value is "manual", but only for the case where the output comes from the system service (see the BaseDevice::serviceTypeFromUid() check removed from switchableoutput.cpp line 117 in this PR).
pages/settings/devicelist/switchable-outputs/PageSwitchableOutput.qml
Outdated
Show resolved
Hide resolved
adccf2b to
0420602
Compare
A switch can also have valid functions when type is not set to manual. The only requirement for showing the dropdown should be that It will be up to the driver or even the hardware to determine what functions are allowed for a type, or to always allow all functions and set the type to something if a function is selected, if necessary. |
1d8060f to
842ce15
Compare
842ce15 to
cceff18
Compare
…function Add a "Function" to switchable output that defines the function of the output. Only display function dropdown when the valid functions have options other than manual. The list of valid functions from the settings is used to allow user selection. Add various examples to smartswitch. Fixes #2731
cceff18 to
d456fda
Compare
Add a "Function" to switchable output that defines the purpose of the relay.
Only display function dropdown when type is set to toggle switch and when the
valid functions have options other than manual. The list of valid functions
from the settings is used to allow user selection.
Use existing Relay_Function options; add opportunity load to list of
available purposes.
Add various examples to smartswitch, they are only accessible when setting
the switch type value to toggle. Examples include error states and intentionally
limiting display, in the case of manual function or non toggle type switch.
Fixes #2731