Hey folks,
I am very new to ESPHome and excited with all the features it provides, but reality has bene giving me a very hard time…
I am working with the ESP32-S module:
I tried to accomplish a few things with my first node:
- Act as a BLE server to connect and propagate data from BLE devices I use
- Measure Gas using the MQ2 sensor
- Measure light using a photoresistor.
Once I managed to flash my ESP32-S I quickly realized that using the BLE Server component was a non-starter as the chip would crash in the first couple of minutes… So i commented out that section…
Now the chip crashes after about 10 minutes… which is obviously a huge problem…
The other set of problems is that neither the “adc” nor the “resistance” platforms, will read any values from my two sensors… I have them hooked up on GPIO32 (MQ2) and GPIO33 (Photoresistor).
Both the MQ2 and photoresistor are pulled down with a 10k resistor and use 5v VCC.
I tried both the “adc” standalone configuration and then added the “resistance” configuration on top of that, but both were reading default values…
I enabled verbose logging in an effort to understand why no values were being read and why the chip was crashing, the only notable thing was the log:
[18:20:02][V][component:200]: Component adc.sensor took a long time for an operation (0.05 s).
[18:20:02][V][component:201]: Components should block for at most 20-30ms.
Which I don’t know what sense to make of… it also happens that this is usually the last log before the chip crashes and won’t come back up…
Here are the last ~20 or so lines of remote logging before the crash:
[18:18:42][V][component:200]: Component adc.sensor took a long time for an operation (0.05 s).
[18:18:42][V][component:201]: Components should block for at most 20-30ms.
[18:19:02][V][adc:132]: 'mancave_mq2_gas_sensor': Got voltage=0.9530V
[18:19:02][V][sensor:076]: 'mancave_mq2_gas_sensor': Received new state 0.953000
[18:19:02][D][sensor:127]: 'mancave_mq2_gas_sensor': Sending state 0.95300 V with 2 decimals of accuracy
[18:19:02][D][resistance:039]: 'Mancave Gas Sensor' - Resistance 2354.8Ω
[18:19:02][V][sensor:076]: 'Mancave Gas Sensor': Received new state 2354.830811
[18:19:02][D][sensor:127]: 'Mancave Gas Sensor': Sending state 2354.83081 Ω with 1 decimals of accuracy
[18:19:02][V][mqtt:415]: Publish(topic='mancave-esphome/sensor/mancave_gas_sensor/state' payload='2354.8' retain=1)
[18:19:02][V][component:200]: Component adc.sensor took a long time for an operation (0.06 s).
[18:19:02][V][component:201]: Components should block for at most 20-30ms.
[18:19:07][I][ota:113]: Boot seems successful, resetting boot loop counter.
[18:19:07][D][esp32.preferences:113]: Saving 1 preferences to flash...
[18:19:07][V][esp32.preferences:125]: sync: key: 233825507, len: 4
[18:19:07][D][esp32.preferences:142]: Saving 1 preferences to flash: 0 cached, 1 written, 0 failed
[18:19:42][V][adc:132]: 'mancave_light_sensor': Got voltage=1.0450V
[18:19:42][V][sensor:076]: 'mancave_light_sensor': Received new state 1.045000
[18:19:42][D][sensor:127]: 'mancave_light_sensor': Sending state 1.04500 V with 2 decimals of accuracy
[18:19:42][D][resistance:039]: 'Mancave Light Sensor' - Resistance 2642.2Ω
[18:19:42][V][sensor:076]: 'Mancave Light Sensor': Received new state 2642.225098
[18:19:42][D][sensor:127]: 'Mancave Light Sensor': Sending state 2642.22510 Ω with 1 decimals of accuracy
[18:19:42][V][mqtt:415]: Publish(topic='mancave-esphome/sensor/mancave_light_sensor/state' payload='2642.2' retain=1)
[18:19:42][V][component:200]: Component adc.sensor took a long time for an operation (0.06 s).
[18:19:42][V][component:201]: Components should block for at most 20-30ms.
[18:20:02][V][adc:132]: 'mancave_mq2_gas_sensor': Got voltage=0.9440V
[18:20:02][V][sensor:076]: 'mancave_mq2_gas_sensor': Received new state 0.944000
[18:20:02][D][sensor:127]: 'mancave_mq2_gas_sensor': Sending state 0.94400 V with 2 decimals of accuracy
[18:20:02][D][resistance:039]: 'Mancave Gas Sensor' - Resistance 2327.4Ω
[18:20:02][V][sensor:076]: 'Mancave Gas Sensor': Received new state 2327.416504
[18:20:02][D][sensor:127]: 'Mancave Gas Sensor': Sending state 2327.41650 Ω with 1 decimals of accuracy
[18:20:02][V][mqtt:415]: Publish(topic='mancave-esphome/sensor/mancave_gas_sensor/state' payload='2327.4' retain=1)
[18:20:02][V][component:200]: Component adc.sensor took a long time for an operation (0.05 s).
[18:20:02][V][component:201]: Components should block for at most 20-30ms.
INFO 192.168.20.5: Ping timed out!
INFO Disconnected from ESPHome API for 192.168.20.5
WARNING Disconnected from API
WARNING Can't connect to ESPHome API for 192.168.20.5: Timeout while connecting to ('192.168.20.5', 6053)
INFO Trying to reconnect to 192.168.20.5 in the background
And here is my configuration:
esphome:
name: mancave-esphome
platform: ESP32
board: nodemcu-32s
wifi:
ssid: !secret wifi_ssid
password: !secret wifi_password
manual_ip:
# Set this to the IP of the ESP
static_ip: 192.168.20.5
# Set this to the IP address of the router. Often ends with .1
gateway: 192.168.20.1
# The subnet of the network. 255.255.255.0 works for most home networks.
subnet: 255.255.255.0
# esp32_ble_tracker:
# ble_client:
# - mac_address: A4:C1:38:45:6B:C8
# id: mancave_atc
mqtt:
broker: 192.168.20.2
username: !secret mqtt_user
password: !secret mqtt_password
sensor:
- platform: adc
pin: GPIO32
id: mancave_mq2_gas_sensor
# name: "Mancave MQ2 Gas Sensor"
# update_interval: 60s
- platform: resistance
sensor: mancave_mq2_gas_sensor
configuration: DOWNSTREAM
resistor: 10kOhm
reference_voltage: 5
name: Mancave Gas Sensor
- platform: adc
pin: GPIO33
id: mancave_light_sensor
# name: "Mancave Light Sensor"
# update_interval: 60s
- platform: resistance
sensor: mancave_light_sensor
configuration: DOWNSTREAM
resistor: 10kOhm
reference_voltage: 5
name: Mancave Light Sensor
# - platform: pvvx_mithermometer
# mac_address: A4:C1:38:45:6B:C8
# temperature:
# name: "Mancave temp"
# id: mancave_temp
# type: characteristic
# ble_client_id: mancave_atc
# name: "Mancave Temperature"
# service_uuid: "2A1F"
# characteristic_uuid: "2A1F"
# icon: "mdi:thermometer"
# unit_of_measurement: "C"
# Enable logging
logger:
level: VERBOSE
# Enable Home Assistant API
api:
ota:
Any help or guidance would be greatly appreciated…