Hi!
recently picked up an old HA/esphome project to finish the HW, but run into an issue with only one out of three sensors showing up in HA.
They all appear normally in MQTT.
They show up in homeassistant/sensors and under name/sensor/temperature and name/sensor/humidity
In HA only battery_voltage is showing up as an entity.
Here’s my code:
substitutions:
name: esp32_pm_d4
friendly_name: ESP32 PM d4
ip: x.x.x.x
sensor_name: dht_sensor
sleep_time: 14s
update_sensor_interval: 10s
esphome:
name: ${name}
friendly_name: ${friendly_name}
min_version: 2024.6.0
name_add_mac_suffix: false
project:
name: esphome.web
version: dev
on_boot:
then:
- delay: 1s
esp32:
board: esp32dev
framework:
type: arduino
globals:
- id: ota_mode
type: bool
initial_value: 'false'
# Enable logging
logger:
mqtt:
id: mqtt_client
broker: !secret mqtt_broker_ip
username: !secret mqtt_sensors_user
password: !secret mqtt_sensors_password
birth_message:
will_message:
discovery: true
discovery_retain: True
on_message:
- topic: esphome/ota_mode # Deep sleep stop
payload: 'ON'
then:
- deep_sleep.prevent: deep_sleep_control
- globals.set:
id: ota_mode
value: 'true'
- logger.log:
format: "OTA mode enabled - Deep sleep prevented"
- topic: esphome/ota_mode # Deep sleep start
payload: 'OFF'
then:
- globals.set:
id: ota_mode
value: 'false'
- logger.log:
format: "OTA mode disabled - Entering deep sleep"
- deep_sleep.allow: deep_sleep_control
- topic: $name/sensor/temperature/state
then:
- if:
condition:
lambda: 'return !id(ota_mode);'
then:
- logger.log:
format: "Shoud go to sleep"
- deep_sleep.enter: deep_sleep_control
sensor:
- id: battery_voltage
platform: adc
pin: GPIO35
name: "Battery voltage"
accuracy_decimals: 3
update_interval: $update_sensor_interval
attenuation: auto
filters:
- multiply: 1.75
- id: dht_sensor
platform: dht
model: DHT22
pin: GPIO33
update_interval: $update_sensor_interval
temperature:
name: "Temperature"
id: ${name}_temperature
humidity:
name: "Humidity"
id: ${name}_humidity
wifi:
power_save_mode: LIGHT #There are other options. Just checking if this helps with self heating.
fast_connect: true # Skip wifi scan to save time.
ssid: !secret wifi_ssid
password: !secret wifi_password
manual_ip:
static_ip: $ip
gateway: x.x.x.x
subnet: 255.255.255.0
# If changing the name or the IP address of the device, this provides the old address so that ESPHome knows which device to overwrite.
use_address: $ip
deep_sleep:
id: deep_sleep_control
sleep_duration: $sleep_time
#run_duration: $run_time