mirror of
https://github.com/esphome/esphome.git
synced 2025-09-06 21:32:21 +01:00
Light & Switch Inverted Restore mode (#1810)
This commit is contained in:
@@ -18,6 +18,12 @@ void GPIOSwitch::setup() {
|
||||
case GPIO_SWITCH_RESTORE_DEFAULT_ON:
|
||||
initial_state = this->get_initial_state().value_or(true);
|
||||
break;
|
||||
case GPIO_SWITCH_RESTORE_INVERTED_DEFAULT_OFF:
|
||||
initial_state = !this->get_initial_state().value_or(true);
|
||||
break;
|
||||
case GPIO_SWITCH_RESTORE_INVERTED_DEFAULT_ON:
|
||||
initial_state = !this->get_initial_state().value_or(false);
|
||||
break;
|
||||
case GPIO_SWITCH_ALWAYS_OFF:
|
||||
initial_state = false;
|
||||
break;
|
||||
@@ -49,6 +55,12 @@ void GPIOSwitch::dump_config() {
|
||||
case GPIO_SWITCH_RESTORE_DEFAULT_ON:
|
||||
restore_mode = "Restore (Defaults to ON)";
|
||||
break;
|
||||
case GPIO_SWITCH_RESTORE_INVERTED_DEFAULT_ON:
|
||||
restore_mode = "Restore inverted (Defaults to ON)";
|
||||
break;
|
||||
case GPIO_SWITCH_RESTORE_INVERTED_DEFAULT_OFF:
|
||||
restore_mode = "Restore inverted (Defaults to OFF)";
|
||||
break;
|
||||
case GPIO_SWITCH_ALWAYS_OFF:
|
||||
restore_mode = "Always OFF";
|
||||
break;
|
||||
|
Reference in New Issue
Block a user