1
0
mirror of https://github.com/esphome/esphome.git synced 2025-10-26 12:43:48 +00:00

FIX: Unnecessary flash writes by ModbusSwitch component (#3648)

This commit is contained in:
Javier Peletier
2022-11-29 22:05:40 +01:00
committed by GitHub
parent a59ce7bfa2
commit c55e01ff3f
11 changed files with 114 additions and 144 deletions

View File

@@ -32,7 +32,7 @@ ModbusSwitch = modbus_controller_ns.class_(
)
CONFIG_SCHEMA = cv.All(
switch.switch_schema(ModbusSwitch)
switch.switch_schema(ModbusSwitch, default_restore_mode="DISABLED")
.extend(cv.COMPONENT_SCHEMA)
.extend(ModbusItemBaseSchema)
.extend(

View File

@@ -6,11 +6,7 @@ namespace modbus_controller {
static const char *const TAG = "modbus_controller.switch";
void ModbusSwitch::setup() {
// value isn't required
// without it we crash on save
this->get_initial_state();
}
void ModbusSwitch::setup() {}
void ModbusSwitch::dump_config() { LOG_SWITCH(TAG, "Modbus Controller Switch", this); }
void ModbusSwitch::parse_and_publish(const std::vector<uint8_t> &data) {