Skip to content

WesleyMConner/Hubitat-PushbuttonSwitches

Repository files navigation

Pushbutton Switches

Pushbutton Switches is a custom Hubitat Application delivered in two components.

PushbuttonSwitches.groovy

A Hubitat Parent App which DOES NOT enforce application behavior, but DOES collects child instances visually in the Hubitat GUI.

PushbuttonSwitchInstance.groovy

A Hubitat Child App which implements core behavior - "mutual exclusion", "default switch" (optional).

Mutual Exclusion

The primary focus of a PushbuttonSwitchInstance is to collect a group of devices (which implement the "Switch" capability, see Capability List) and ensure that only one device is "on" at a time.

Pushbutton Switch Example

Old car radios are a great example of a simple pushbutton switch group. A single button is enabled at any one time. When a new station is enabled, all other stations are disabled.

AM Pushbutton Car Radio
Mutual-Exclusion Example
Given
  • Four devices are added to a PushButton Switch instance, with initial state:
    switch1 - off
    dimmer27 - off
    switch18 - off
    virtualSwitch2 - on

Event 0
  • dimmer27 is turned "on" (by whatever means)

  • The Pushbutton Switch instance enforces mutual exclusion.

  • The resulting switch states are:
    switch1 - off
    dimmer27 - on
    switch18 - off
    virtualSwitch2 - off

Default Switch Option

Optionally, a PushButton Switch instance can identify one participating switch as the Default Switch. If all switches in a Pushbutton Switch instance are turned "off", the Default Switch is automatically turned on.

Default Switch Example
Given
  • Five devices are added to a PushButton Switch instance:
    switch10, switch12, dimmer3, dimmer8 and switch15.

  • dimmer8 is selected as the Default Switch.

  • Initially switch states are:
    switch10 - off
    switch12 - on
    dimmer3 - off
    dimmer8 (default) - off
    switch15 - off

Event 1
  • switch10 is turned "on" (by whatever means)

  • The Pushbutton Switch takes no automatic action.

  • The resulting switch states are:
    switch10 - on
    switch12 - off
    dimmer3 - off
    dimmer8 (default) - off
    switch15 - off

Event 2
  • switch10 is turned "off" (by whatever means)

  • The Pushbutton Switch enables the Default Switch.

  • The resulting switch states are:
    switch10 - off
    switch12 - off
    dimmer3 - off
    dimmer8 (default) - on
    switch15 - off

Example Use Cases

Mode Selection using Virtual Switches

Hubitat Modes are mutual exclusive by their nature.

Modes can be adjusted externally (using Amazon Alexa, Google Assistant, …​) by:

  • Associating each mode with a Hubitat Virtual Switch

  • Changing modes via the associated virtual switches exclusively.

  • Using rules (or a Pushbutton Switch instance) to ensure a single mode switch is enabled at a time.

  • Exposing the mode virtual switches externally.

Room Lighting Scene Selection

While the built-in Room Lighting application can facilitate per-room scene creation, it does not ensure a single scene is operating per room at any one time.

A per-room Pushbutton Switch instance can be used as the basis for developing mutually-exclusive per-room scenes.

About

Make a group of Switches mutually-exclusive.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages