Skip to content

New switch input mode: Activation Once - #1353

Open
vadimpronin wants to merge 2 commits into
mongoose-os-apps:masterfrom
vadimpronin:input-activate-once
Open

New switch input mode: Activation Once#1353
vadimpronin wants to merge 2 commits into
mongoose-os-apps:masterfrom
vadimpronin:input-activate-once

Conversation

@vadimpronin

@vadimpronin vadimpronin commented Dec 29, 2023

Copy link
Copy Markdown

This PR introduces a new input mode called "Activation Once". This mode is designed to work with external timers or sensors, allowing the device to be turned on once and then automatically turned off after a pre-configured duration, regardless of further input changes.

The changes include:

  • Modifying the fs_src/index.html file to add the "Activation Once" option to the input mode selection in the device's web interface.
  • Updating the mos.yml configuration schema to include the new input mode option.
  • Extending the InMode enum in src/shelly_common.hpp to include the kActivationOnce value.
  • Implementing the behavior of the "Activation Once" mode in src/shelly_hap_light_bulb.cpp and src/shelly_switch.cpp to handle input events according to the new mode's logic.
  • Creating a new documentation file docs/input-modes.md that explains the different input modes available for Shelly devices, including the new "Activation Once" mode.

The "Activation Once" mode is useful for scenarios where a device needs to be turned on at a specific time (e.g., via an external timer) and then turned off automatically after a set period, without being affected by subsequent input changes. This can be beneficial for applications such as pool pumps, garden lights, or other timed events where manual override from the app is also desired.

As an example consider a pool pump, with an external timer to turn it on at 15:00 every day (a setting
of the external timer) and run for 2 hours (a setting of the internal auto-off timer), but you want to be able to
override the external timer from the app on demand (manually start early at 14:00) and when the external timer kicks in, you don't want it to restart the auto-off timer like in "Activation" mode.

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.

1 participant