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

This commit is contained in:
Javier Peletier
2022-11-30 10:05:40 +13:00
committed by GitHub
parent a59ce7bfa2
commit c55e01ff3f
11 changed files with 114 additions and 144 deletions
@@ -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(
@@ -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) {