From 0fd4d2f4a0372fa9c36c4f1a714cd223281ab90c Mon Sep 17 00:00:00 2001 From: Thierry DUVERNOY Date: Sat, 25 Jan 2025 15:04:53 +0100 Subject: [PATCH] Write pin inverted correction and switch state publishing correction --- esphome/components/dallas_pio/dallas_pio.cpp | 2 +- esphome/components/dallas_pio/switch.cpp | 5 +---- 2 files changed, 2 insertions(+), 5 deletions(-) diff --git a/esphome/components/dallas_pio/dallas_pio.cpp b/esphome/components/dallas_pio/dallas_pio.cpp index afae64b905..1a04af19da 100644 --- a/esphome/components/dallas_pio/dallas_pio.cpp +++ b/esphome/components/dallas_pio/dallas_pio.cpp @@ -371,7 +371,7 @@ void DallasPio::ds2406_write_state_(bool state, bool use_crc = false) { uint8_t channel_control_byte_2 = 0xFF; uint8_t channel_info_byte; uint16_t received_crc = 0; - uint8_t ds2406_write_state = state ? 0xFF : 0x00; + uint8_t ds2406_write_state = (state ^ this->pin_inverted_) ? 0xFF : 0x00; { InterruptLock lock; this->send_command_(DALLAS_DS2406_COMMAND_CHANNEL_ACCESS); diff --git a/esphome/components/dallas_pio/switch.cpp b/esphome/components/dallas_pio/switch.cpp index 613655ab02..8d0264fb06 100644 --- a/esphome/components/dallas_pio/switch.cpp +++ b/esphome/components/dallas_pio/switch.cpp @@ -62,10 +62,7 @@ void DallasPioSwitch::write_state(bool state) { return; } this->status_clear_warning(); - - if (!this->dallas_pio_->write_state(state, this->pin_, this->pin_inverted_)) { - return; - } + this->dallas_pio_->write_state(state, this->pin_, this->pin_inverted_); this->publish_state(state); // Set state in ESPHome }