home-assistant / core

:house_with_garden: Open source home automation that puts local control and privacy first.
https://www.home-assistant.io
Apache License 2.0
73.53k stars 30.71k forks source link

Platform esphome does not generate unique IDs #87702

Closed DarkWarden85 closed 1 year ago

DarkWarden85 commented 1 year ago

The problem

Hi,

I have the following error that keeps showing up in my logs when restarting Home Assistant:

Logger: homeassistant.components.climate
Source: helpers/entity_platform.py:540
Integration: Climate (documentation, issues)
First occurred: 12:55:49 (2 occurrences)
Last logged: 12:56:01

Platform esphome does not generate unique IDs. ID ventilation-controlclimatezehnder_comfoair_550_luxe already exists - ignoring climate.zehnder_comfoair_550

It refers to a climate entity I have set up in esphome. The strange thing is that it works absolutely fine. When looking into core.entity_registry, core.device_registry or the esphome config itself I cannot find any duplicate unique IDs. I've been having this problem since setting up the device nearly two years ago, but I simply cannot get to the bottom of this. Is there anything else I could do in order to troubleshoot this?

What version of Home Assistant Core has the issue?

Home Assistant 2023.2.3

What was the last working version of Home Assistant Core?

No response

What type of installation are you running?

Home Assistant OS

Integration causing the issue

esphome

Link to integration documentation on our website

https://www.home-assistant.io/integrations/esphome/

Diagnostics information

config_entry-esphome-70855a0e37800ebc92cf225c483da6c7.json.txt

Example YAML snippet

# See https://github.com/wichers/esphome-comfoair for uart communication source code

esphome:
  name: ventilation-control
  platform: ESP8266
  board: nodemcuv2
  includes:
    - ventilation-control/src/comfoair.h

# Enable logging
logger:
  level: WARN #DEBUG #VERBOSE #VERY_VERBOSE
  baud_rate: 0    # Very important! Otherwise uart communication to Ventilation system gets messed up
  #hardware_uart: UART0_SWAP    # Uses TX & RX Pins on Nodemcu instead of D8 & D7
# Enable Home Assistant API
api:

ota:
  password: ***REDACTED***

wifi:
  ssid: !secret wlan_ssid
  password: !secret wlan_password
  manual_ip:
    static_ip: ***REDACTED***
    gateway:  ***REDACTED***
    subnet:   ***REDACTED***
  #use_address: ***REDACTED***

  # Enable fallback hotspot (captive portal) in case wifi connection fails
  ap:
    ssid: "Ventilation-Control"
    password: ***REDACTED***

captive_portal:

# ------------------------------------------------------------------------------

status_led:
  pin:
    number: D4
    inverted: True  

sensor:
- platform: wifi_signal
  name: "Ventilation WiFi Signal Sensor"
  id: "ventilation_wifi_signal_sensor"
  update_interval: 60s
- platform: uptime
  name: "Ventilation Uptime Sensor"
  id: "ventilation_uptime_sensor"
  update_interval: 60s
  on_raw_value:
    then:
      - text_sensor.template.publish:
          id: "ventilation_uptime_sensor_human"
          state: !lambda |-
            int seconds = round(id(ventilation_uptime_sensor).raw_state);
            int days = seconds / (24 * 3600);
            seconds = seconds % (24 * 3600);
            int hours = seconds / 3600;
            seconds = seconds % 3600;
            int minutes = seconds /  60;
            seconds = seconds % 60;
            return (
              (days ? String(days) + "d " : "") +
              (hours ? String(hours) + "h " : "") +
              (minutes ? String(minutes) + "m " : "") +
              (String(seconds) + "s")
            ).c_str();

text_sensor:
  - platform: template
    name: "Ventilation Uptime Sensor Human Readable"
    id: ventilation_uptime_sensor_human
    icon: mdi:clock-start
  - platform: version
    name: "Ventilation ESPHome Version"
    id: ventilation_esphome_version_sensor
  - platform: wifi_info
    ip_address:
      name: Ventilation ESP IP-Address
    mac_address:
      name: Ventilation ESP Mac-Address

binary_sensor:

switch:
- platform: restart
  name: "Ventilation Restart"
- platform: safe_mode
  name: "Ventilation Restart (Safe Mode)"

uart:
  id: uart_bus
  baud_rate: 9600
  rx_pin: D7
  tx_pin: D8

climate:
- platform: custom
  lambda: |-

    auto ca = new esphome::comfoair::ComfoAirComponent(id(uart_bus));
    App.register_component(ca);
    ca->outside_air_temperature = new Sensor("Comfoair Ventilation Outside Air");
    ca->outside_air_temperature->set_unit_of_measurement("°C");
    ca->outside_air_temperature->set_accuracy_decimals(1);
    App.register_sensor(ca->outside_air_temperature);
    ca->supply_air_temperature = new Sensor("Comfoair Ventilation Supply Air");
    ca->supply_air_temperature->set_unit_of_measurement("°C");
    ca->supply_air_temperature->set_accuracy_decimals(1);
    App.register_sensor(ca->supply_air_temperature);
    ca->return_air_temperature = new Sensor("Comfoair Ventilation Return Air");
    ca->return_air_temperature->set_unit_of_measurement("°C");
    ca->return_air_temperature->set_accuracy_decimals(1);
    App.register_sensor(ca->return_air_temperature);
    ca->exhaust_air_temperature = new Sensor("Comfoair Ventilation Exhaust Air");
    ca->exhaust_air_temperature->set_unit_of_measurement("°C");
    ca->exhaust_air_temperature->set_accuracy_decimals(1);
    App.register_sensor(ca->exhaust_air_temperature);

    ca->fan_supply_air_percentage = new Sensor("Comfoair Ventilation Fan Supply Air");
    ca->fan_supply_air_percentage->set_unit_of_measurement("%");
    App.register_sensor(ca->fan_supply_air_percentage);
    ca->fan_exhaust_air_percentage = new Sensor("Comfoair Ventilation Fan Exhaust Air");
    ca->fan_exhaust_air_percentage->set_unit_of_measurement("%");
    App.register_sensor(ca->fan_exhaust_air_percentage);
    ca->fan_speed_supply = new Sensor("Comfoair Ventilation Fan Speed Supply");
    App.register_sensor(ca->fan_speed_supply);
    ca->fan_speed_exhaust = new Sensor("Comfoair Ventilation Fan Speed Exhaust");
    App.register_sensor(ca->fan_speed_exhaust);

    ca->is_bypass_valve_open = new BinarySensor();
    ca->is_bypass_valve_open->set_name("Comfoair Ventilation Bypass Valve");
    App.register_binary_sensor(ca->is_bypass_valve_open);
    ca->is_preheating = new BinarySensor();
    ca->is_preheating->set_name("Comfoair Ventilation Preheating");
    App.register_binary_sensor(ca->is_preheating);
    ca->is_supply_fan_active = new BinarySensor();
    ca->is_supply_fan_active->set_name("Comfoair Ventilation Supply Fan");
    App.register_binary_sensor(ca->is_supply_fan_active);
    ca->is_filter_full = new BinarySensor();
    ca->is_filter_full->set_name("Comfoair Ventilation Filter Full");
    App.register_binary_sensor(ca->is_filter_full);
    ca->is_summer_mode = new BinarySensor();
    ca->is_summer_mode->set_name("Comfoair Ventilation Summer Mode");
    App.register_binary_sensor(ca->is_summer_mode);

    ca->return_air_level = new Sensor("Comfoair Ventilation Return Air Level");
    App.register_sensor(ca->return_air_level);
    ca->supply_air_level = new Sensor("Comfoair Ventilation Supply Air Level");
    App.register_sensor(ca->supply_air_level);

    App.register_climate(ca);
    return {ca};

  climates:
    - name: "Zehnder Comfoair 550 Luxe"

Anything in the logs that might be useful for us?

Logger: homeassistant.components.climate
Source: helpers/entity_platform.py:540
Integration: Climate (documentation, issues)
First occurred: 12:55:49 (2 occurrences)
Last logged: 12:56:01

Platform esphome does not generate unique IDs. ID ventilation-controlclimatezehnder_comfoair_550_luxe already exists - ignoring climate.zehnder_comfoair_550

Additional information

I am using a custom included file in order to interface with my zehnder climate control.

home-assistant[bot] commented 1 year ago

Hey there @ottowinter, @jesserockz, mind taking a look at this issue as it has been labeled with an integration (esphome) you are listed as a code owner for? Thanks!

Code owner commands Code owners of `esphome` can trigger bot actions by commenting: - `@home-assistant close` Closes the issue. - `@home-assistant rename Awesome new title` Change the title of the issue. - `@home-assistant reopen` Reopen the issue. - `@home-assistant unassign esphome` Removes the current integration label and assignees on the issue, add the integration domain after the command.

(message by CodeOwnersMention)


esphome documentation esphome source (message by IssueLinks)

DarkWarden85 commented 1 year ago

I have now installed the new esphome version 2023.2.0 and can confirm that the issue is still present.

jgverweij commented 1 year ago

Might be solved by using App.register_component instead of App.register_climate See: https://github.com/wichers/esphome-comfoair/issues/20#issue-1587615430

DarkWarden85 commented 1 year ago

Hi @jgverweij. That is actually my comment on the esphome-comfoair repo. I have posted a possible solution, but am waiting for confirmation that my approach is actually the right one.

jgverweij commented 1 year ago

Ah, didnt't see that it was you but recognised the same problem on two places. Have been researching this in the past as well, but still cannot seem to get a connection to my whr930.

issue-triage-workflows[bot] commented 1 year ago

There hasn't been any activity on this issue recently. Due to the high number of incoming GitHub notifications, we have to clean some of the old issues, as many of them have already been resolved with the latest updates. Please make sure to update to the latest Home Assistant version and check if that solves the issue. Let us know if that works for you by adding a comment 👍 This issue has now been marked as stale and will be closed if no further activity occurs. Thank you for your contributions.