BT Proxy Causing Entities To Not Update State in HA

After spending countless hours chasing red-herrings, I’ve narrowed down my issue to including BT Proxy in my YAML. Sharing this to maybe help someone else and to see if anyone has ideas on the root cause.

I’m currently on ESPHome 2024.4.2, but I assume the issue has been there for a while and I didn’t notice it as I tested things out (I also excluded BT Proxy for a while, to speed up compiling while building things out). The issue I was experiencing was that various entities that have binary states (switches, lights) on my ESPHome device would randomly but consistently not appear to respond to changes from within HA (I’d tell it to turn on, it would stay off indefinitely). I finally realized that if I simply reloaded the ESPHome integration for the device it would show the state that I had commanded it to (and would usually work for a couple cycles before having the same issue) which ultimately led me to realize it was simply an issue of the correct state not being passed on to HA (I also left the device overnight after having issues and the state would never update to the correct one on it’s own). So I’d tell a switch to go off, it would but HA didn’t know and only gave me the option to keep telling it to go off. I’ll mention that the logs showed no issues, but it also appeared to not show the state changes I was trying to effect (which was a large part of why I kept chasing red-herrings).

Here’s my YAML, but it’s QUITE long and I don’t think there’s anything really unique or particularly complex about it, mainly it’s a lot of duplication (it’s for a Keezer and I have 5 taps, so 5x a bunch of things).

esphome:
  name: keezer
  friendly_name: Keezer

esp32:
  board: esp32dev
  framework:
#    type: arduino
    type: esp-idf

# Enable logging
logger:

# Enable Home Assistant API
api:
  encryption:
    key: "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"

ota:
  password: "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"

wifi:
  ssid: !secret wifi_ssid
  password: !secret wifi_password

  # Enable fallback hotspot (captive portal) in case wifi connection fails
  ap:
    ssid: "Keezer Fallback Hotspot"
    password: "xxxxxxxxxxxxxxxxxx"

#Removed for Bluetooth Proxy feature
#captive_portal:

bluetooth_proxy:
  active: true

esp32_ble_tracker:


status_led:
  pin:
    number: GPIO2
#    inverted: true

button:
  - platform: restart
    name: Restart
  - platform: safe_mode
    name: Restart (Safe Mode)


# Keg 1 Pulse Counter Reset Button
  - platform: template
    name: Keg 1 Reset Pulse Counter Total
    on_press:
      - pulse_meter.set_total_pulses:
          id: keg_1_pulse_meter
          value: 0

# Keg 2 Pulse Counter Reset Button
  - platform: template
    name: Keg 2 Reset Pulse Counter Total
    on_press:
      - pulse_meter.set_total_pulses:
          id: keg_2_pulse_meter
          value: 0

# Keg 3 Pulse Counter Reset Button
  - platform: template
    name: Keg 3 Reset Pulse Counter Total
    on_press:
      - pulse_meter.set_total_pulses:
          id: keg_3_pulse_meter
          value: 0

# Keg 4 Pulse Counter Reset Button
  - platform: template
    name: Keg 4 Reset Pulse Counter Total
    on_press:
      - pulse_meter.set_total_pulses:
          id: keg_4_pulse_meter
          value: 0

# Keg 5 Pulse Counter Reset Button
  - platform: template
    name: Keg 5 Reset Pulse Counter Total
    on_press:
      - pulse_meter.set_total_pulses:
          id: keg_5_pulse_meter
          value: 0

number:

#REMOVED RESTORE VALUES TO KEEP FROM WEARING OUT THE FLASH WHILE TESTING
# Keg 1 Full Volume
  - platform: template
    name: Keg 1 Full
    optimistic: true
    id: keg_1_full_value
    icon: mdi:gauge-full
    device_class: volume_storage
    unit_of_measurement: gal
    max_value: 6
    min_value: 0
    step: 0.01
    initial_value: 5
    mode: box
#    restore_value: true

# Keg 2 Full Volume
  - platform: template
    name: Keg 2 Full
    optimistic: true
    id: keg_2_full_value
    icon: mdi:gauge-full
    device_class: volume_storage
    unit_of_measurement: gal
    max_value: 6
    min_value: 0
    step: 0.01
    initial_value: 5
    mode: box
#    restore_value: true

# Keg 3 Full Volume
  - platform: template
    name: Keg 3 Full
    optimistic: true
    id: keg_3_full_value
    icon: mdi:gauge-full
    device_class: volume_storage
    unit_of_measurement: gal
    max_value: 6
    min_value: 0
    step: 0.01
    initial_value: 5
    mode: box
#    restore_value: true

# Keg 4 Full Volume
  - platform: template
    name: Keg 4 Full
    optimistic: true
    id: keg_4_full_value
    icon: mdi:gauge-full
    device_class: volume_storage
    unit_of_measurement: gal
    max_value: 6
    min_value: 0
    step: 0.01
    initial_value: 5
    mode: box
#    restore_value: true

# Keg 5 Full Volume
  - platform: template
    name: Keg 5 Full
    optimistic: true
    id: keg_5_full_value
    icon: mdi:gauge-full
    device_class: volume_storage
    unit_of_measurement: gal
    max_value: 6
    min_value: 0
    step: 0.01
    initial_value: 1.5
    mode: box
#    restore_value: true


# Keg 1 Consumed (Only updated on Keezer Shutdown)
  - platform: template
    name: Keg 1 Consumed LTS
    optimistic: true
    id: keg_1_consumed_value_lts
    icon: mdi:gauge
    device_class: volume_storage
    unit_of_measurement: gal
    max_value: 6
    min_value: 0
    step: 0.01
    initial_value: 0
    mode: box
#    restore_value: true

# Keg 2 Consumed (Only updated on Keezer Shutdown)
  - platform: template
    name: Keg 2 Consumed LTS
    optimistic: true
    id: keg_2_consumed_value_lts
    icon: mdi:gauge
    device_class: volume_storage
    unit_of_measurement: gal
    max_value: 6
    min_value: 0
    step: 0.01
    initial_value: 0
    mode: box
#    restore_value: true

# Keg 3 Consumed (Only updated on Keezer Shutdown)
  - platform: template
    name: Keg 3 Consumed LTS
    optimistic: true
    id: keg_3_consumed_value_lts
    icon: mdi:gauge
    device_class: volume_storage
    unit_of_measurement: gal
    max_value: 6
    min_value: 0
    step: 0.01
    initial_value: 0
    mode: box
#    restore_value: true

# Keg 4 Consumed (Only updated on Keezer Shutdown)
  - platform: template
    name: Keg 4 Consumed LTS
    optimistic: true
    id: keg_4_consumed_value_lts
    icon: mdi:gauge
    device_class: volume_storage
    unit_of_measurement: gal
    max_value: 6
    min_value: 0
    step: 0.01
    initial_value: 0
    mode: box
#    restore_value: true

# Keg 5 Consumed (Only updated on Keezer Shutdown)
  - platform: template
    name: Keg 5 Consumed LTS
    optimistic: true
    id: keg_5_consumed_value_lts
    icon: mdi:gauge
    device_class: volume_storage
    unit_of_measurement: gal
    max_value: 6
    min_value: 0
    step: 0.01
    initial_value: 0
    mode: box
#    restore_value: true


# Keg 1 Pulse Conversion
  - platform: template
    name: Keg 1 Pulse Conversion
    optimistic: true
    id: keg_1_pulse_conversion
    icon: mdi:pulse
    unit_of_measurement: pulses/gal
    max_value: 5000
    min_value: 0
    step: 1
    initial_value: 2566
    mode: box
#    restore_value: true

# Keg 2 Pulse Conversion
  - platform: template
    name: Keg 2 Pulse Conversion
    optimistic: true
    id: keg_2_pulse_conversion
    icon: mdi:pulse
    unit_of_measurement: pulses/gal
    max_value: 5000
    min_value: 0
    step: 1
    initial_value: 2566
    mode: box
#    restore_value: true

# Keg 3 Pulse Conversion
  - platform: template
    name: Keg 3 Pulse Conversion
    optimistic: true
    id: keg_3_pulse_conversion
    icon: mdi:pulse
    unit_of_measurement: pulses/gal
    max_value: 5000
    min_value: 0
    step: 1
    initial_value: 2566
    mode: box
#    restore_value: true

# Keg 4 Pulse Conversion
  - platform: template
    name: Keg 4 Pulse Conversion
    optimistic: true
    id: keg_4_pulse_conversion
    icon: mdi:pulse
    unit_of_measurement: pulses/gal
    max_value: 5000
    min_value: 0
    step: 1
    initial_value: 2566
    mode: box
#    restore_value: true

# Keg 5 Pulse Conversion
  - platform: template
    name: Keg 5 Pulse Conversion
    optimistic: true
    id: keg_5_pulse_conversion
    icon: mdi:pulse
    unit_of_measurement: pulses/gal
    max_value: 5000
    min_value: 0
    step: 1
    initial_value: 2566
    mode: box
#    restore_value: true


switch:
# Keezer Switch  
  - platform: template
    name: Keezer
    id: keezer_switch
    icon: mdi:glass-mug-variant
    optimistic: true
    turn_on_action:


#      - if:
#          condition:
#            - light.is_off: keezer_lights
#          then:
#Tap 1 LEDs
#            - light.turn_on:
#                id: tap_1_leds
#                brightness: 100%
#                red: 95%
#                green: 37%
#                blue: 71%

#Tap 3 LEDs
#            - light.turn_on:
#                id: tap_3_leds
#                brightness: 100%
#                red: 0%
#                green: 69%
#                blue: 31%

#Tap 4 LEDs
#            - light.turn_on:
#                id: tap_4_leds
#                brightness: 100%
#                red: 50%
#                green: 50%
#                blue: 50%
#          else:

#Tap 1 LEDs
#      - light.turn_on:
#          id: tap_1_leds
#          brightness: 100%
#          red: 95%
#          green: 37%
#          blue: 71%

#Tap 3 LEDs
#      - light.turn_on:
#          id: tap_3_leds
#          brightness: 100%
#          red: 0%
#          green: 69%
#          blue: 31%

#Tap 4 LEDs
#      - light.turn_on:
#          id: tap_4_leds
#          brightness: 100%
#          red: 50%
#          green: 50%
#          blue: 50%



      - light.turn_on:
          id: keezer_lights
          brightness: 100%
          red: 0%
          green: 5%
          blue: 100%
      - switch.turn_on: keg_valves
      - pulse_meter.set_total_pulses:
          id: keg_1_pulse_meter
          value: 0
      - pulse_meter.set_total_pulses:
          id: keg_2_pulse_meter
          value: 0
      - pulse_meter.set_total_pulses:
          id: keg_3_pulse_meter
          value: 0
      - pulse_meter.set_total_pulses:
          id: keg_4_pulse_meter
          value: 0
      - pulse_meter.set_total_pulses:
          id: keg_5_pulse_meter
          value: 0

    turn_off_action:


#      - light.turn_off:
#          id: tap_1_leds
#      - light.turn_off:
#          id: tap_2_leds
#      - light.turn_off:
#          id: tap_3_leds
#      - light.turn_off:
#          id: tap_4_leds
#      - light.turn_off:
#          id: tap_5_leds



      - light.turn_off:
          id: keezer_lights
      - switch.turn_off: keg_valves
      - number.set:
          id: keg_1_consumed_value_lts
          value: !lambda "return (id(keg_1_consumed_value_lts).state + (id(keg_1_poured_volume).state * 0.0078125));"
      - number.set:
          id: keg_2_consumed_value_lts
          value: !lambda "return (id(keg_2_consumed_value_lts).state + (id(keg_2_poured_volume).state * 0.0078125));"
      - number.set:
          id: keg_3_consumed_value_lts
          value: !lambda "return (id(keg_3_consumed_value_lts).state + (id(keg_3_poured_volume).state * 0.0078125));"
      - number.set:
          id: keg_4_consumed_value_lts
          value: !lambda "return (id(keg_4_consumed_value_lts).state + (id(keg_4_poured_volume).state * 0.0078125));"
      - number.set:
          id: keg_5_consumed_value_lts
          value: !lambda "return (id(keg_5_consumed_value_lts).state + (id(keg_5_poured_volume).state * 0.0078125));"
      - pulse_meter.set_total_pulses:
          id: keg_1_pulse_meter
          value: 0
      - pulse_meter.set_total_pulses:
          id: keg_2_pulse_meter
          value: 0
      - pulse_meter.set_total_pulses:
          id: keg_3_pulse_meter
          value: 0
      - pulse_meter.set_total_pulses:
          id: keg_4_pulse_meter
          value: 0
      - pulse_meter.set_total_pulses:
          id: keg_5_pulse_meter
          value: 0

# Keg Valves
  - platform: gpio
    pin: GPIO19
    name: Keg Valves
    id: keg_valves
    device_class: switch
    icon: mdi:pipe-valve

# Freezer Relay
  - platform: gpio
    pin: GPIO26
    name: Freezer Relay
    id: freezer_relay
    device_class: switch
    icon: mdi:snowflake-thermometer

text_sensor:
  - platform: wifi_info
    ip_address:
      name: IP Address

sensor:
# Send WiFi signal strength & uptime to HA
  - platform: wifi_signal
    name: WiFi Strength
    update_interval: 60s
    disabled_by_default: true
  - platform: uptime
    name: Uptime
    disabled_by_default: true


# Keg 1 Pulse Meter
  - platform: pulse_meter
    pin: GPIO4
    name: Keg 1 Pulse Meter
    id: keg_1_pulse_meter
    internal_filter: 20us     #Default is 13us. Used 20, 10, 5, 2 with Pulse and no noise.
    internal_filter_mode: PULSE
    timeout: 1s
    total:
      name: Keg 1 Total Pulses
      id: keg_1_pulse_meter_total

# Keg 2 Pulse Meter
  - platform: pulse_meter
    pin: GPIO13
    name: Keg 2 Pulse Meter
    id: keg_2_pulse_meter
    internal_filter: 20us     #Default is 13us. Used 20, 10, 5, 2 with Pulse and no noise.
    internal_filter_mode: PULSE
    timeout: 1s
    total:
      name: Keg 2 Total Pulses
      id: keg_2_pulse_meter_total

# Keg 3 Pulse Meter
  - platform: pulse_meter
    pin: GPIO16
    name: Keg 3 Pulse Meter
    id: keg_3_pulse_meter
    internal_filter: 20us     #Default is 13us. Used 20, 10, 5, 2 with Pulse and no noise.
    internal_filter_mode: PULSE
    timeout: 1s
    total:
      name: Keg 3 Total Pulses
      id: keg_3_pulse_meter_total

# Keg 4 Pulse Meter
  - platform: pulse_meter
    pin: GPIO17
    name: Keg 4 Pulse Meter
    id: keg_4_pulse_meter
    internal_filter: 20us     #Default is 13us. Used 20, 10, 5, 2 with Pulse and no noise.
    internal_filter_mode: PULSE
    timeout: 1s
    total:
      name: Keg 4 Total Pulses
      id: keg_4_pulse_meter_total

# Keg 5 Pulse Meter
  - platform: pulse_meter
    pin: GPIO18
    name: Keg 5 Pulse Meter
    id: keg_5_pulse_meter
    internal_filter: 20us     #Default is 13us. Used 20, 10, 5, 2 with Pulse and no noise.
    internal_filter_mode: PULSE
    timeout: 1s
    total:
      name: Keg 5 Total Pulses
      id: keg_5_pulse_meter_total


# Keg 1 Percent Full
  - platform: template
    name: Keg 1 Percent Full
    id: keg_1_percent_full
    state_class: measurement
    unit_of_measurement: "%"
    icon: mdi:keg
    lambda: |-
      if (id(keezer_switch).state and (id(keg_1_pulse_meter_total).state > 10)) {
        return (((id(keg_1_full_value).state - (id(keg_1_consumed_value_lts).state + (id(keg_1_pulse_meter_total).state * (1 / id(keg_1_pulse_conversion).state)))) / (id(keg_1_full_value).state)) * 100);
      } else {
        return (((id(keg_1_full_value).state - id(keg_1_consumed_value_lts).state) / (id(keg_1_full_value).state)) * 100);
      }
    update_interval: 1s

# Keg 2 Percent Full
  - platform: template
    name: Keg 2 Percent Full
    id: keg_2_percent_full
    state_class: measurement
    unit_of_measurement: "%"
    icon: mdi:keg
    lambda: |-
      if (id(keezer_switch).state and (id(keg_2_pulse_meter_total).state > 10)) {
        return (((id(keg_2_full_value).state - (id(keg_2_consumed_value_lts).state + (id(keg_2_pulse_meter_total).state * (1 / id(keg_2_pulse_conversion).state)))) / (id(keg_2_full_value).state)) * 100);
      } else {
        return (((id(keg_2_full_value).state - id(keg_2_consumed_value_lts).state) / (id(keg_2_full_value).state)) * 100);
      }
    update_interval: 1s

# Keg 3 Percent Full
  - platform: template
    name: Keg 3 Percent Full
    id: keg_3_percent_full
    state_class: measurement
    unit_of_measurement: "%"
    icon: mdi:keg
    lambda: |-
      if (id(keezer_switch).state and (id(keg_3_pulse_meter_total).state > 10)) {
        return (((id(keg_3_full_value).state - (id(keg_3_consumed_value_lts).state + (id(keg_3_pulse_meter_total).state * (1 / id(keg_3_pulse_conversion).state)))) / (id(keg_3_full_value).state)) * 100);
      } else {
        return (((id(keg_3_full_value).state - id(keg_3_consumed_value_lts).state) / (id(keg_3_full_value).state)) * 100);
      }
    update_interval: 1s

# Keg 4 Percent Full
  - platform: template
    name: Keg 4 Percent Full
    id: keg_4_percent_full
    state_class: measurement
    unit_of_measurement: "%"
    icon: mdi:keg
    lambda: |-
      if (id(keezer_switch).state and (id(keg_4_pulse_meter_total).state > 10)) {
        return (((id(keg_4_full_value).state - (id(keg_4_consumed_value_lts).state + (id(keg_4_pulse_meter_total).state * (1 / id(keg_4_pulse_conversion).state)))) / (id(keg_4_full_value).state)) * 100);
      } else {
        return (((id(keg_4_full_value).state - id(keg_4_consumed_value_lts).state) / (id(keg_4_full_value).state)) * 100);
      }
    update_interval: 1s

# Keg 5 Percent Full
  - platform: template
    name: Keg 5 Percent Full
    id: keg_5_percent_full
    state_class: measurement
    unit_of_measurement: "%"
    icon: mdi:keg
    lambda: |-
      if (id(keezer_switch).state and (id(keg_5_pulse_meter_total).state > 10)) {
        return (((id(keg_5_full_value).state - (id(keg_5_consumed_value_lts).state + (id(keg_5_pulse_meter_total).state * (1 / id(keg_5_pulse_conversion).state)))) / (id(keg_5_full_value).state)) * 100);
      } else {
        return (((id(keg_5_full_value).state - id(keg_5_consumed_value_lts).state) / (id(keg_5_full_value).state)) * 100);
      }
    update_interval: 1s


# Keg 1 Poured Volume
  - platform: template
    name: Keg 1 Poured Volume
    id: keg_1_poured_volume
    device_class: volume_storage
    state_class: measurement
    unit_of_measurement: fl. oz.
    accuracy_decimals: 1
    icon: mdi:beer
    lambda: |-
      if (id(keezer_switch).state and (id(keg_1_pulse_meter_total).state > 10)) {
        return ((id(keg_1_pulse_meter_total).state * (1 / id(keg_1_pulse_conversion).state)) * 128);
      } else {
        return 0;
      }
    update_interval: 1s

# Keg 2 Poured Volume
  - platform: template
    name: Keg 2 Poured Volume
    id: keg_2_poured_volume
    device_class: volume_storage
    state_class: measurement
    unit_of_measurement: fl. oz.
    accuracy_decimals: 1
    icon: mdi:beer
    lambda: |-
      if (id(keezer_switch).state and (id(keg_2_pulse_meter_total).state > 10)) {
        return ((id(keg_2_pulse_meter_total).state * (1 / id(keg_2_pulse_conversion).state)) * 128);
      } else {
        return 0;
      }
    update_interval: 1s

# Keg 3 Poured Volume
  - platform: template
    name: Keg 3 Poured Volume
    id: keg_3_poured_volume
    device_class: volume_storage
    state_class: measurement
    unit_of_measurement: fl. oz.
    accuracy_decimals: 1
    icon: mdi:beer
    lambda: |-
      if (id(keezer_switch).state and (id(keg_3_pulse_meter_total).state > 10)) {
        return ((id(keg_3_pulse_meter_total).state * (1 / id(keg_3_pulse_conversion).state)) * 128);
      } else {
        return 0;
      }
    update_interval: 1s

# Keg 4 Poured Volume
  - platform: template
    name: Keg 4 Poured Volume
    id: keg_4_poured_volume
    device_class: volume_storage
    state_class: measurement
    unit_of_measurement: fl. oz.
    accuracy_decimals: 1
    icon: mdi:beer
    lambda: |-
      if (id(keezer_switch).state and (id(keg_4_pulse_meter_total).state > 10)) {
        return ((id(keg_4_pulse_meter_total).state * (1 / id(keg_4_pulse_conversion).state)) * 128);
      } else {
        return 0;
      }
    update_interval: 1s

# Keg 5 Poured Volume
  - platform: template
    name: Keg 5 Poured Volume
    id: keg_5_poured_volume
    device_class: volume_storage
    state_class: measurement
    unit_of_measurement: fl. oz.
    accuracy_decimals: 1
    icon: mdi:beer
    lambda: |-
      if (id(keezer_switch).state and (id(keg_5_pulse_meter_total).state > 10)) {
        return ((id(keg_5_pulse_meter_total).state * (1 / id(keg_5_pulse_conversion).state)) * 128);
      } else {
        return 0;
      }
    update_interval: 1s


# Keg 1 Flowrate
  - platform: template
    name: Keg 1 Flowrate
    id: keg_1_flowrate
    device_class: volume_flow_rate
    state_class: measurement
    unit_of_measurement: gal/min
    accuracy_decimals: 2
    icon: mdi:water-pump
    lambda: |-
      if (id(keezer_switch).state) {
        return ((id(keg_1_pulse_meter).state * (1 / id(keg_1_pulse_conversion).state)));
      } else {
        return 0;
      }
    update_interval: 1s

# Keg 2 Flowrate
  - platform: template
    name: Keg 2 Flowrate
    id: keg_2_flowrate
    device_class: volume_flow_rate
    state_class: measurement
    unit_of_measurement: gal/min
    accuracy_decimals: 2
    icon: mdi:water-pump
    lambda: |-
      if (id(keezer_switch).state) {
        return ((id(keg_2_pulse_meter).state * (1 / id(keg_2_pulse_conversion).state)));
      } else {
        return 0;
      }
    update_interval: 1s

# Keg 3 Flowrate
  - platform: template
    name: Keg 3 Flowrate
    id: keg_3_flowrate
    device_class: volume_flow_rate
    state_class: measurement
    unit_of_measurement: gal/min
    accuracy_decimals: 2
    icon: mdi:water-pump
    lambda: |-
      if (id(keezer_switch).state) {
        return ((id(keg_3_pulse_meter).state * (1 / id(keg_3_pulse_conversion).state)));
      } else {
        return 0;
      }
    update_interval: 1s

# Keg 4 Flowrate
  - platform: template
    name: Keg 4 Flowrate
    id: keg_4_flowrate
    device_class: volume_flow_rate
    state_class: measurement
    unit_of_measurement: gal/min
    accuracy_decimals: 2
    icon: mdi:water-pump
    lambda: |-
      if (id(keezer_switch).state) {
        return ((id(keg_4_pulse_meter).state * (1 / id(keg_4_pulse_conversion).state)));
      } else {
        return 0;
      }
    update_interval: 1s

# Keg 5 Flowrate
  - platform: template
    name: Keg 5 Flowrate
    id: keg_5_flowrate
    device_class: volume_flow_rate
    state_class: measurement
    unit_of_measurement: gal/min
    accuracy_decimals: 2
    icon: mdi:water-pump
    lambda: |-
      if (id(keezer_switch).state) {
        return ((id(keg_5_pulse_meter).state * (1 / id(keg_5_pulse_conversion).state)));
      } else {
        return 0;
      }
    update_interval: 1s


# Gas Weight RAW Sensor
  - platform: hx711
#    name: Gas Value RAW
#    id: gas_value_raw
    name: Gas Percent Full
    id: gas_percent_full
    state_class: measurement
    unit_of_measurement: "%"
    accuracy_decimals: 1
    dout_pin: GPIO21
    clk_pin: GPIO22
    update_interval: 1s #Used 0.1s for Beehive

    filters:

# Used this avergae for the Beehive
      - sliding_window_moving_average:
          window_size: 600
          send_every: 15
          send_first_at: 15

# From Particle Code
# Gas_Empty_Calibration=7213399; 
# Gas_Full_Calibration=7335977;
# Actual readings are showing as negative
      - calibrate_linear:
         method: least_squares
         datapoints:
          - -7213399 -> 0
          - -7335977 -> 100


# Temperature Sensor
  - platform: dallas
    address: 0xff3190d4454bfa28
    name: Keezer Temperature
    id: keezer_temperature


# Pressure Transducer
  - platform: adc
    pin: GPIO39
    name: Gas Pressure
    icon: mdi:gas-cylinder
    unit_of_measurement: psi
    device_class: pressure
    state_class: measurement
    accuracy_decimals: 1
    update_interval: 1s
    attenuation: auto
    filters:
#      - median:
#          window_size: 11
#          send_every: 11
#          send_first_at: 11

      - sliding_window_moving_average:
          window_size: 15
          send_every: 15
          send_first_at: 15

      - calibrate_linear:
         method: least_squares
         datapoints:
# Sensor advertises 0.5V=0psi & 4.5V=100psi. These values are from testing (using the analog gauge on the gas tank):
          - 0.28 -> 0
          - 1.98 -> 40

      - clamp:
          min_value: 0
          max_value: 100
          ignore_out_of_range: false #This determines whether it just ignores out of range values or treats them as a max/min value


binary_sensor:

# Lid Sensor
  - platform: gpio
    pin:
      number: GPIO23
      inverted: true
      mode:
        input: true
        pullup: true
    name: Keezer Lid
    id: keezer_lid
    device_class: door
    on_press:
      then:
        - light.turn_on: interior_lights
    on_release:
      then:
        - light.turn_off: interior_lights

light:
# Interior Lights
  - platform: binary
    name: Interior Lights
    id: interior_lights
    icon: mdi:led-strip
    output: interior_lights_output


# Keezer Lights

#  - platform: neopixelbus
#    type: GRB
#    variant: WS2812
#    pin: GPIO27
#    num_leds: 37
#    name: Keezer Lights
#    id: keezer_lights
#    icon: mdi:wall-sconce-flat




  - platform: partition
    name: "Tap #1 LEDs"
    id: tap_1_leds
    segments:
      - id: keezer_lights
        from: 0
        to: 7

  - platform: partition
    name: "Tap #2 LEDs"
    id: tap_2_leds
    segments:
      - id: keezer_lights
        from: 8
        to: 14

  - platform: partition
    name: "Tap #3 LEDs"
    id: tap_3_leds
    segments:
      - id: keezer_lights
        from: 15
        to: 21

  - platform: partition
    name: "Tap #4 LEDs"
    id: tap_4_leds
    segments:
      - id: keezer_lights
        from: 22
        to: 28

  - platform: partition
    name: "Tap #5 LEDs"
    id: tap_5_leds
    segments:
      - id: keezer_lights
        from: 29
        to: 36



  - platform: esp32_rmt_led_strip
    name: Keezer Lights
    id: keezer_lights
    icon: mdi:wall-sconce-flat
    rgb_order: GRB
    is_rgbw: False
    pin: GPIO27
    num_leds: 37
    rmt_channel: 0
    chipset: WS2812
    max_refresh_rate: 200ms #16ms ~= 60Hz # 100ms seemed to help quite a bit, but still got some flicker at times
    effects:
      - addressable_color_wipe:
          name: Christmas Wipe
          colors:
            - red: 100%
              green: 0%
              blue: 0%
              white: 0%
              num_leds: 15
            - red: 0%
              green: 100%
              blue: 0%
              white: 0%
              num_leds: 15
          add_led_interval: 200ms
          reverse: false

      - addressable_color_wipe:
          name: Chiefs Wipe
          colors:
            - red: 100%
              green: 0%
              blue: 0%
              white: 0%
              num_leds: 15
            - red: 100%
              green: 87%
              blue: 0%
              white: 0%
              num_leds: 15
          add_led_interval: 200ms
          reverse: false

      - random:
          name: Random
          transition_length: 5s
          update_interval: 7s

      - addressable_rainbow:
          name: Rainbow
          speed: 10
          width: 50

      - addressable_color_wipe:
          name: Random Color Wipe
          colors:
            - random: true
              num_leds: 15
          add_led_interval: 200ms
          reverse: false


output:
# Interior Lights
  - id: interior_lights_output
    platform: gpio
    pin: GPIO25


# Freezer Temperature Controller
climate:
  - platform: thermostat
    name: Thermostat
    sensor: keezer_temperature
    visual:
      min_temperature: 32 °F
      max_temperature: 60 °F
      temperature_step: 0.5 °F
    min_cooling_off_time: 300s
    min_cooling_run_time: 120s
    min_idle_time: 300s
    cool_action:
      - switch.turn_on: freezer_relay
    idle_action:
      - switch.turn_off: freezer_relay
    default_preset: Beer
    on_boot_restore_from: memory
    preset:
      - name: Beer
        mode: COOL
        default_target_temperature_high: 40 °F


dallas:
  - pin: GPIO32
    update_interval: 15s

Simply commenting out the BT Proxy part and it’s been working flawlessly for days and countless cycles of switching things on/off trying to get it to break again:

bluetooth_proxy:
  active: true

esp32_ble_tracker:

Anything jump out? This was a situation where I really had no specific need for BT Proxy, and getting rid of it ultimately allowed me to switch to the Arduino framework which then allowed me to use the Neopixel library, which is SOOOO much better than the alternative.

Do You re-flashed device via Serial while adding esp32_ble_tracker as per manual?
As well check out Use on single-core chips topic on same page.

Note:

The first time this component is enabled for an ESP32, the code partition needs to be resized. Please flash the ESP32 via USB when adding this to your configuration. After that, you can use OTA updates again.

Interesting, I’ve always read that note more in regards to ESPHome version (there were a number of updates in the past that required serially updating to get full benefit of coming from an older version), and so I’ve always serially flashed a basic YAML file first and then built things on top of that (including BT Proxy). I’ve never had an issue on the dozen or so other devices running BT Proxy I’ve done this with, but maybe I’ve been doing it wrong and just gotten lucky… Might have to pull the chip and try this.

All my ESP32s are dual-core, so that isn’t it, but thanks for the info!

I had a little free time, so I pulled the chip and flashed serially just now. I was JUST about convinced that it fixed things, and then it did the same thing again. Back to no more BT Proxy again… :slight_smile:

Thanks for the idea though! Regardless, I’ll make sure I include BT Proxy when I do my initial flash in the future.

Your yaml is relatively big. Bluetooth proxy is a resource hog. You have probably reached a resource limit.

Good thing they are cheap. Try a esp32 on is own.

Yeah, that’s what I’ve assumed is the case, it’s just a strange failure mode (and while it’s a big YAML file, it’s mostly just a bunch of variables being stored versus something obviously complex like a media player, voice assistant, etc.). Seems like it ought to at least throw an error in the log when it happens. The only other time I’ve ran into an issue with BT Proxy and resources, it simply threw an error during compiling.

Luckily I don’t have any actual need for BT Proxy on this device, as I have several near the same spot already.

1 Like