Uptime and template sensor are not showing in HA

Hi all,

This is my first esphome. I have the DHT sensor working fine. I have also uptime and template sensors. They show in log fine, the board seems to report values to HA properly.

Here is the yaml:

sensor:
- platform: uptime
  id: uptime_counter
  internal: false
  update_interval: 10s
  accuracy_decimals: 0
    
- platform: template
  id: heart_beat
  internal: false
  update_interval: 15s
  lambda: 'return millis();'
- platform: dht
  id: camper_sensors
  pin: GPIO2
  temperature:
    id: "camper_temp"
    name: "Camper Temperature"
  humidity:
    id: "camper_humi"
    name: "Camper Humidity"
  update_interval: 5s

Here is the log:

[01:42:46.297][D][dht:042]: Temperature 18.8°C Humidity 37.0%
[01:42:46.303][D][sensor:133]: 'Camper Temperature': Sending state 18.80000 °C with 1 decimals of accuracy
[01:42:46.303][D][sensor:133]: 'Camper Humidity': Sending state 37.00000 % with 0 decimals of accuracy
[01:42:49.939][D][sensor:133]: 'heart_beat': Sending state 1230592.00000  with 1 decimals of accuracy
[01:42:50.731][D][sensor:133]: 'uptime_counter': Sending state 1231.38403 s with 0 decimals of accuracy

In HA, uptime and heart_beat are not found. Any idea?

You need to give name to your sensors

sensor:
- platform: uptime
  id: uptime_counter
  name: "Uptime"
  internal: false
  update_interval: 10s
  accuracy_decimals: 0
1 Like

Thank Karosm. You saved my project.

You are welcome!

1 Like