AC Controller Appears Crippled by ESPHome Update

The latest ESPHome update approx 48 hours ago appears to have crippled my air conditioner controller for my home lab.

No code changes have been made for months, and everything has been working fine. After the ESPHome update some 48 hours ago the following occurs… see logs below.

[14:30:59][D][sensor:094]: 'Studio AC Inside Temperature': Sending state 24.00000 °C with 1 decimals of accuracy
[14:31:29][D][dallas.sensor:153]: 'Studio AC Inside Temperature': Got Temperature=24.0°C
[14:31:29][D][sensor:094]: 'Studio AC Inside Temperature': Sending state 24.00000 °C with 1 decimals of accuracy
[14:31:59][D][dallas.sensor:153]: 'Studio AC Inside Temperature': Got Temperature=24.1°C
[14:31:59][D][sensor:094]: 'Studio AC Inside Temperature': Sending state 24.06250 °C with 1 decimals of accuracy
[14:31:59][D][binary_sensor:036]: 'Studio AC Climate': Sending state ON
[14:31:59][D][climate:011]: 'Aircon Studio' - Setting
[14:31:59][D][climate:015]:   Mode: COOL
[14:31:59][D][climate:024]:   Fan: AUTO
[14:31:59][D][climate:040]:   Target Temperature: 23.00
WARNING esp5-studio-ac @ 192.168.0.124: Connection error occurred: [Errno 104] Connection reset by peer
INFO Processing unexpected disconnect from ESPHome API for esp5-studio-ac @ 192.168.0.124
WARNING Disconnected from API
INFO Successfully connected to esp5-studio-ac @ 192.168.0.124 in 0.006s
INFO Successful handshake with esp5-studio-ac @ 192.168.0.124 in 0.029s
[14:32:43][D][esp32.preferences:114]: Saving 1 preferences to flash...
[14:32:43][D][esp32.preferences:143]: Saving 1 preferences to flash: 1 cached, 0 written, 0 failed
[14:33:00][D][dallas.sensor:153]: 'Studio AC Inside Temperature': Got Temperature=24.1°C
[14:33:00][D][sensor:094]: 'Studio AC Inside Temperature': Sending state 24.06250 °C with 1 decimals of accuracy
[14:33:00][W][script:060]: Script 'ac_timer' is already running! (mode: single)
[14:33:00][D][main:138]: Telling Climate to START
[14:33:00][W][component:237]: Component dallas took a long time for an operation (54 ms).
[14:33:00][W][component:238]: Components should block for at most 30 ms.
[14:33:30][D][dallas.sensor:153]: 'Studio AC Inside Temperature': Got Temperature=24.1°C
[14:33:30][D][sensor:094]: 'Studio AC Inside Temperature': Sending state 24.12500 °C with 1 decimals of accuracy
[14:33:30][W][script:060]: Script 'ac_timer' is already running! (mode: single)
[14:33:30][D][main:138]: Telling Climate to START
[14:33:30][W][component:237]: Component dallas took a long time for an operation (55 ms).
[14:33:30][W][component:238]: Components should block for at most 30 ms.
[14:34:00][D][dallas.sensor:153]: 'Studio AC Inside Temperature': Got Temperature=24.1°C
[14:34:00][D][sensor:094]: 'Studio AC Inside Temperature': Sending state 24.12500 °C with 1 decimals of accuracy
[14:34:00][W][script:060]: Script 'ac_timer' is already running! (mode: single)
[14:34:00][D][main:138]: Telling Climate to START
[14:34:00][W][component:237]: Component dallas took a long time for an operation (51 ms).
[14:34:00][W][component:238]: Components should block for at most 30 ms.
[14:34:30][D][dallas.sensor:153]: 'Studio AC Inside Temperature': Got Temperature=24.2°C
[14:34:30][D][sensor:094]: 'Studio AC Inside Temperature': Sending state 24.18750 °C with 1 decimals of accuracy
[14:34:30][W][script:060]: Script 'ac_timer' is already running! (mode: single)
[14:34:30][D][main:138]: Telling Climate to START
WARNING esp5-studio-ac @ 192.168.0.124: Connection error occurred: [Errno 104] Connection reset by peer
INFO Processing unexpected disconnect from ESPHome API for esp5-studio-ac @ 192.168.0.124
WARNING Disconnected from API
INFO Successfully connected to esp5-studio-ac @ 192.168.0.124 in 0.006s
INFO Successful handshake with esp5-studio-ac @ 192.168.0.124 in 0.033s
[14:35:34][D][dallas.sensor:153]: 'Studio AC Inside Temperature': Got Temperature=24.2°C
[14:35:34][D][sensor:094]: 'Studio AC Inside Temperature': Sending state 24.18750 °C with 1 decimals of accuracy
[14:35:34][D][main:181]: AC Timer is ON
[14:35:34][D][main:138]: Telling Climate to START

Seems this is the offending issue… loss of API connection.

WARNING esp5-studio-ac @ 192.168.0.124: Connection error occurred: [Errno 104] Connection reset by peer
INFO Processing unexpected disconnect from ESPHome API for esp5-studio-ac @ 192.168.0.124
WARNING Disconnected from API
INFO Successfully connected to esp5-studio-ac @ 192.168.0.124 in 0.006s
INFO Successful handshake with esp5-studio-ac @ 192.168.0.124 in 0.029s

Haven’t ever seen this occur previously, so not sure why it has all of a sudden started happening? Open to work arounds if anyone has any?

Here’s the code…

esphome:
  name: esp5-studio-ac
  platform: ESP32
  board: esp32doit-devkit-v1
  on_boot:
#  - wait_until:
#      condition: api.connected
  - delay: 2s
  - script.stop: ac_timer
  - climate.control:
      id: ac_climate_id
      mode: 'off'
  - mqtt.publish:
      topic: HomeAssistant/Studio/Aircon/Status
      payload: "OFF"

# Enable logging
logger:
#  level: VERBOSE

# Enable Home Assistant API
api:
  reboot_timeout: 0s

ota:
  password: !secret esp5-studio-ac-ota

wifi:
  ssid: !secret wifi_ssid
  password: !secret wifi_password
  
  # Enable fallback hotspot (captive portal) in case wifi connection fails
  ap:
    ssid: "Esp32-Ir-Test Fallback Hotspot"
    password: "<REDACTED>"

captive_portal:

status_led:
#  pin: GPIO2
  pin:
    number: 2
    ignore_strapping_warning: true

#Temperature Sensor Pin
dallas:
  - pin: 23
    update_interval: 30s

mqtt:
#  broker: !secret mqtt_broker
  broker: !secret mqtt_broker
  username: !secret mqtt_login
  password: !secret mqtt_passwd
  port: 1883
  reboot_timeout: 0s
  keepalive: 60s
  discovery: false

# IR TRansmitter entry
remote_transmitter:
  pin:
    number: 18
  id: ir_transmit
  carrier_duty_percent: 50%

climate:
  - platform: daikin
    name: "Aircon Studio"
    id: ac_climate_id
    supports_heat: false
    transmitter_id: ir_transmit

script:
  - id: ac_timer
    then:
      - binary_sensor.template.publish:
          id: timer_status
          state: ON
      - logger.log: "AC Timer is ON"
      - delay: 20min
      - binary_sensor.template.publish:
          id: timer_status
          state: OFF
      - logger.log: "AC Timer is OFF"

binary_sensor:
  - platform: template
    id: ac_climate_mgmt
    name: "Studio AC Climate"
    on_press:
      then:
          - climate.control:
              id: ac_climate_id
              mode: "COOL"
              fan_mode: AUTO
              target_temperature: 23°C
          - mqtt.publish:
              topic: HomeAssistant/Studio/Aircon/Status
              payload: "ON"
          - logger.log: "AC is ON"
    on_release:
      then:         
          - climate.control:
              id: ac_climate_id
              mode: "OFF"
          - mqtt.publish:
              topic: HomeAssistant/Studio/Aircon/Status
              payload: "OFF"
          - logger.log: "AC is OFF"
  - platform: template
    id: out_ac_temp_status
  
  - platform: template
    id: timer_status

sensor:
# Studio Inside temperature sensor
  - platform: dallas
    id: in_ac_dallas
    resolution: 12
    address: 0x2401204FD9422728
    name: "Studio AC Inside Temperature"
    on_value:
      then:
      - if:
          condition:
              # Is the inside temp higher than 24
              - lambda: 'return id(in_ac_dallas).state > 24;'
          then:
              # Start the AC
              - binary_sensor.template.publish:
                  id: ac_climate_mgmt
                  state: on
              - script.execute: ac_timer
              - logger.log: "Telling Climate to START"
          
      - if:
          condition:
            and:
              # Is the Outside temp under 18
              - lambda: 'return id(out_temp_studio).state < 18;'
              # Is the inside temp lower than 23
              - lambda: 'return id(in_ac_dallas).state < 23;'
              - binary_sensor.is_off: timer_status
          then:
              - binary_sensor.template.publish:
                  id: ac_climate_mgmt
                  state: off
              - script.stop: ac_timer
              - logger.log: "Telling Climate to STOP"

# Studio Outside Temperature from HA  
  - platform: homeassistant
    id: out_temp_studio
    name: "Studio Outside Temperature"
    entity_id: sensor.studio_temp_out

Ended up solving it myself… for reasons lost to time, I commented out the lines below…

#  - wait_until:
#      condition: api.connected

And it appears reinstating those lines and doing a fresh build solved the issue. Note to self, when I comment stuff out, write a comment as to why I did it :roll_eyes:

1 Like