mirror of
https://github.com/esphome/esphome.git
synced 2025-01-03 19:31:46 +01:00
Fix restore (#4655)
* ALWAYS_OFF for fan * ALWAYS_OFF for light * ALWAYS_OFF for switch
This commit is contained in:
parent
0547f2a931
commit
4eb69d6af5
3 changed files with 3 additions and 3 deletions
|
@ -63,7 +63,7 @@ FanIsOffCondition = fan_ns.class_("FanIsOffCondition", automation.Condition.temp
|
||||||
FAN_SCHEMA = cv.ENTITY_BASE_SCHEMA.extend(cv.MQTT_COMMAND_COMPONENT_SCHEMA).extend(
|
FAN_SCHEMA = cv.ENTITY_BASE_SCHEMA.extend(cv.MQTT_COMMAND_COMPONENT_SCHEMA).extend(
|
||||||
{
|
{
|
||||||
cv.GenerateID(): cv.declare_id(Fan),
|
cv.GenerateID(): cv.declare_id(Fan),
|
||||||
cv.Optional(CONF_RESTORE_MODE, default="RESTORE_DEFAULT_OFF"): cv.enum(
|
cv.Optional(CONF_RESTORE_MODE, default="ALWAYS_OFF"): cv.enum(
|
||||||
RESTORE_MODES, upper=True, space="_"
|
RESTORE_MODES, upper=True, space="_"
|
||||||
),
|
),
|
||||||
cv.OnlyWith(CONF_MQTT_ID, "mqtt"): cv.declare_id(mqtt.MQTTFanComponent),
|
cv.OnlyWith(CONF_MQTT_ID, "mqtt"): cv.declare_id(mqtt.MQTTFanComponent),
|
||||||
|
|
|
@ -60,7 +60,7 @@ LIGHT_SCHEMA = cv.ENTITY_BASE_SCHEMA.extend(cv.MQTT_COMMAND_COMPONENT_SCHEMA).ex
|
||||||
{
|
{
|
||||||
cv.GenerateID(): cv.declare_id(LightState),
|
cv.GenerateID(): cv.declare_id(LightState),
|
||||||
cv.OnlyWith(CONF_MQTT_ID, "mqtt"): cv.declare_id(mqtt.MQTTJSONLightComponent),
|
cv.OnlyWith(CONF_MQTT_ID, "mqtt"): cv.declare_id(mqtt.MQTTJSONLightComponent),
|
||||||
cv.Optional(CONF_RESTORE_MODE, default="restore_default_off"): cv.enum(
|
cv.Optional(CONF_RESTORE_MODE, default="ALWAYS_OFF"): cv.enum(
|
||||||
RESTORE_MODES, upper=True, space="_"
|
RESTORE_MODES, upper=True, space="_"
|
||||||
),
|
),
|
||||||
cv.Optional(CONF_ON_TURN_ON): auto.validate_automation(
|
cv.Optional(CONF_ON_TURN_ON): auto.validate_automation(
|
||||||
|
|
|
@ -92,7 +92,7 @@ def switch_schema(
|
||||||
device_class: str = _UNDEF,
|
device_class: str = _UNDEF,
|
||||||
icon: str = _UNDEF,
|
icon: str = _UNDEF,
|
||||||
block_inverted: bool = False,
|
block_inverted: bool = False,
|
||||||
default_restore_mode: str = "RESTORE_DEFAULT_OFF",
|
default_restore_mode: str = "ALWAYS_OFF",
|
||||||
):
|
):
|
||||||
schema = _SWITCH_SCHEMA.extend(
|
schema = _SWITCH_SCHEMA.extend(
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in a new issue