Skip to content

Conversation

@ybott-qinetic
Copy link
Contributor

@ybott-qinetic ybott-qinetic commented Jan 6, 2026

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

@ybott-qinetic ybott-qinetic force-pushed the ttomkins/add-function-to-switchable-output branch 2 times, most recently from 5caeba6 to bbae31e Compare January 7, 2026 01:23
@ybott-qinetic ybott-qinetic changed the title Switches: add function setting to switches Settings: add "Function" dropdown option to allow user to set relay purpose Jan 7, 2026
@ybott-qinetic ybott-qinetic force-pushed the ttomkins/add-function-to-switchable-output branch from bbae31e to da2775b Compare January 7, 2026 01:24
@ybott-qinetic ybott-qinetic marked this pull request as ready for review January 7, 2026 01:25
Copy link
Contributor

@blammit blammit left a 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).

@ybott-qinetic ybott-qinetic force-pushed the ttomkins/add-function-to-switchable-output branch 2 times, most recently from adccf2b to 0420602 Compare January 21, 2026 00:57
@ReinvdZee
Copy link
Contributor

Only display function dropdown when type is set to toggle switch and when the
valid functions have options other than manual.

A switch can also have valid functions when type is not set to manual. The only requirement for showing the dropdown should be that /ValidFunctions has options other than just manual.

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.

@ybott-qinetic ybott-qinetic force-pushed the ttomkins/add-function-to-switchable-output branch 2 times, most recently from 1d8060f to 842ce15 Compare January 25, 2026 08:10
@blammit blammit force-pushed the ttomkins/add-function-to-switchable-output branch from 842ce15 to cceff18 Compare January 27, 2026 01:31
…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
@blammit blammit force-pushed the ttomkins/add-function-to-switchable-output branch from cceff18 to d456fda Compare January 27, 2026 03:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Switch configuration page: Add "Function" dropdown

4 participants