esphome / issues

Issue Tracker for ESPHome
https://esphome.io/
290 stars 34 forks source link

After update to ESPHome 2022.12.8: template sensors not report values to HA anymore #4087

Closed RoSche2001 closed 1 year ago

RoSche2001 commented 1 year ago

The problem

I upgraded to ESPHome 2022.12.8 (and likely the same happened already with the update to 2022.12.6 just before) and both, my gas counter and my electricity counter are not recorded in HA anymore. I updated both devices several times by now, power cycled the ESPHome devices with no charge. When checking the logs from ESPHome the counter works just fine, in the case of my gas counter I have to sensors and can see them both working (a binary sensor and an increasing counter). BUT the increasing sensor for the gas does not show any state history in the history overview (nor do the values show up anywhere else. I deleted the devices from the integration and included them again - no change. reconnected the ESPHome sensor to a utility helper in HA - no change.

It somehow seems that the template sensor does not get reported from ESPHome to HA.

YAML below is an example, the other boards are principally the same.

Which version of ESPHome has the issue?

2022.12.8

What type of installation are you using?

Home Assistant Add-on

Which version of Home Assistant has the issue?

2023.1.7

What platform are you using?

ESP8266

Board

nodemcu

Component causing the issue

No response

Example YAML snippet

# passwords etc replaced with xxxx

esphome:
  name: gaszaehler

esp8266:
  board: nodemcuv2

# Enable logging
logger:

# Enable Home Assistant API
api:

ota:
  password: "xxxxxxx"

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

  manual_ip:
    static_ip: xxxxxxx
    gateway: xxxxxxx
    subnet: 255.255.255.0

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

captive_portal:

globals:
  - id: total_pulses_gas
    type: int
    initial_value: '0'

binary_sensor:
# hier das Hochzählen bei jedem Impuls
  - platform: gpio
    pin: 
      number: D1
      mode:
        input: true
        pullup: true
    name: "Grid Gas Volumen"
    filters:
      - delayed_on: 100ms
    id: grid_gas_volumen_m3
    icon: 'mdi:fire'
    on_press:
      then:
        - lambda: id(total_pulses_gas) += 1;

sensor:
# hier das Umrechnen in m3
  - platform: template
    name: "Grid Gas Total"
    device_class: gas
    unit_of_measurement: "m³"
    state_class: "total_increasing"
    icon: "mdi:fire"
    accuracy_decimals: 2
    lambda: |-
        return id(total_pulses_gas) * 0.01;

Anything in the logs that might be useful for us?

no error messages shown on ESPhome logs, not in HA logs

Additional information

No response

RoSche2001 commented 1 year ago

It seems that my database got corrupted during the update process. I reinstalled a previous version.