Esphome config with ESP32 and max6675 temp sensors

Hello,

I have a ESP32 with ESPHOME flashed to it. I added two max6675 temp sensors to monitor the BBQ.
So When I login to the webinterface of the ESPhome device I can read all the sensor data.
I added the device in Homeassistant with the intergrations. From there everything works.
So the temp sensor data is passing trough to HA. But the device is not always on.
So if I let say not use the device for 3 days then when starting the ESP32 again the temp sensors are unavailable in HA.
But in the webinterface of ESPhome they are online. Now when I remove the ESP32 form the intergration and re add it it works again.
Or if I disable the unavailable sensors and reenable it works.

Here is the output of my config:

esphome:
  name: esp_bbq
  platform: ESP32
  board: nodemcu-32s

wifi:
  ssid: !secret ssid
  password: !secret ssid_key
  ap:
    ssid: !secret ap_ssid
    password: !secret ap_key

captive_portal:

# Enable logging
logger:

# Enable Home Assistant API
api:
  password: !secret password
#  services:
#    - service: control_servo
#        level: float
#      then:
#        - servo.write:
#            id: pwm_servoBBQ
#            level: !lambda 'return level / 100.0;'

ota:
  password: !secret password

web_server:

spi:
  miso_pin: GPIO25
  clk_pin: GPIO22

sensor:
  - platform: max6675
    name: "Grill Temp"
    id: grill_temp
    cs_pin: GPIO21
    update_interval: 30s

  - platform: max6675
    name: "Probe 1 Temp"
    id: probe1_temp
    cs_pin: GPIO19
    update_interval: 30s

  - platform: homeassistant
    id: grill_probe_1_target
    entity_id: input_number.grill_probe_1_target
    internal: true

  - platform: homeassistant
    id: grill_alert_low
    entity_id: input_number.grill_alert_low
    internal: true

  - platform: homeassistant
    id: grill_alert_high
    entity_id: input_number.grill_alert_high
    internal: true

  - platform: wifi_signal
    name: "esp_bbq WiFi Signal Sensor"
    update_interval: 15s
    
  - platform: adc
    id: accu_spanning_bbq
    pin: 34
    attenuation: 11db
    filters:
    name: "Accu spanning"
    # on_value_range:
      # below: 3.00
      # then:
        # - switch.turn_on:
            # id: shutdown_esp_bbq

output: 
  # Servo Rotate : Using ledc output to control a standard 50Hz RC servo over the normal 1 to 2 mS pulse range
  - platform: ledc
    pin: GPIO27
    id: servoBBQ
    frequency: 50 Hz

servo:
  - id: pwm_servoBBQ
    output: servoBBQ

switch:
  - platform: gpio
    pin: GPIO13
    id: grill_alarm_buzzer
  - platform: template
    name: "Grill Alarm Buzzer"
    icon: "mdi:grill"
    turn_on_action:
    - switch.turn_on: grill_alarm_buzzer
    - delay: 500ms
    - switch.turn_off: grill_alarm_buzzer
    - delay: 500ms
    - switch.turn_on: grill_alarm_buzzer
    - delay: 500ms
    - switch.turn_off: grill_alarm_buzzer
    - delay: 500ms
    - switch.turn_on: grill_alarm_buzzer
    - delay: 500ms
    - switch.turn_off: grill_alarm_buzzer
    - delay: 500ms
    - switch.turn_on: grill_alarm_buzzer
    - delay: 500ms
    - switch.turn_off: grill_alarm_buzzer
    - delay: 500ms
    - switch.turn_on: grill_alarm_buzzer
    - delay: 500ms
    - switch.turn_off: grill_alarm_buzzer
    - delay: 500ms
    - switch.turn_on: grill_alarm_buzzer
    - delay: 500ms
    - switch.turn_off: grill_alarm_buzzer
    - delay: 500ms
    - switch.turn_on: grill_alarm_buzzer
    - delay: 500ms
    - switch.turn_off: grill_alarm_buzzer
    - delay: 500ms

  - platform: shutdown
    name: "esp_bbq Shutdown"
    id: shutdown_esp_bbq

i2c:
 sda: 15
 scl: 4
  

font:
 - file: 'arial.ttf'
   id: font1
   size: 10

 - file: 'arial.ttf'
   id: font2
   size: 24

 - file: 'arial.ttf'
   id: font3
   size: 14

time:
  - platform: homeassistant
    id: esptime
display:
 - platform: ssd1306_i2c
   model: "SSD1306 128x64"
   reset_pin: GPIO12
   address: 0x3C
   id: my_display
   pages:
     - id: page1
       lambda: |-

        // Print time in HH:MM format
        it.strftime(1, 0, id(font1), TextAlign::TOP_LEFT, "%H:%M", id(esptime).now());
        
        it.printf(110, 0, id(font1), "%.1f", id(accu_spanning_bbq).state);

        it.printf(64, 0, id(font3), TextAlign::TOP_CENTER, "Actueel");
     
        // Print inside temperature (from homeassistant sensor)
        if (id(grill_temp).has_state()) {
        it.printf(1, 23, id(font3), TextAlign::TOP_LEFT , "BBQ: %.1f°", id(grill_temp).state);
        }

        // Print outside temperature (from homeassistant sensor)
        if (id(probe1_temp).has_state()) {
        it.printf(1, 60, id(font3), TextAlign::BASELINE_LEFT , "Probe: %.1f°", id(probe1_temp).state);
        }
     - id: page2
       lambda: |-

        // Print time in HH:MM format
        it.strftime(1, 0, id(font1), TextAlign::TOP_LEFT, "%H:%M", id(esptime).now());
        
        it.printf(110, 0, id(font1), "%.1f", id(accu_spanning_bbq).state);

        it.printf(64, 0, id(font3), TextAlign::TOP_CENTER, "Target");
     
        // Print inside temperature (from homeassistant sensor)
        if (id(grill_temp).has_state()) {
        it.printf(1, 23, id(font3), TextAlign::TOP_LEFT , "BBQ: %.1f°", id(grill_alert_high).state);
        }

        // Print outside temperature (from homeassistant sensor)
        if (id(probe1_temp).has_state()) {
        it.printf(1, 60, id(font3), TextAlign::BASELINE_LEFT , "Probe: %.1f°", id(grill_probe_1_target).state);
        }



interval:
 - interval: 5s
   then:
     - display.page.show_next: my_display
     - component.update: my_display

binary_sensor:
  - platform: status
    name: ESP BBQ Status
1 Like

Fixed the problem. There were some leftovers in the esphome config folder.
Removed the old configs and it start working.

Dear Frank, so as far as the connection goes, you share miso and clk pins with all max6675s and then you assign each cs pin to a digital input and it works?

Thanks.

1 Like

Yes, that works.

That’s great. I’m trying to do a PID controlled PWM 12V fan project for my charcoal smoker/grill. Going to copy a bunch of your code. Thanks!

Can you share your project? I want to extend my project also with a 12v fan and controller.