esphome / issues

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

MQTT Discovery Topic Repeatedly Published for Thermostat Climate Controller #1906

Open skyhisi opened 3 years ago

skyhisi commented 3 years ago

Operating environment/Installation (Hass.io/Docker/pip/etc.):

Installed via pip in virtual env with Python: 3.9.2 esphome 1.16.2 platformio 5.0.4

ESP (ESP32/ESP8266, Board/Sonoff):

ESP8266

ESPHome version (latest production, beta, dev branch)

1.16.2

Affected component:

Issue seen when combining the Thermostat and MQTT components:

Description of problem: When discovery is enabled for the Thermostat, the topic "homeassistant/climate/DEV_NAME/COMPONENT_ID/config" is repeatedly published at a rate of about 20 times per second.

This behaviour stops when discovery: False is set on the component (as no discovery messages are published).

Problem-relevant YAML-configuration entries:

mqtt:
  broker: 192.168.0.15
  topic_prefix: esphome/DEV_NAME

climate:
  - platform: thermostat
    id: COMPONENT_ID
    name: "Thermostat"
    discovery: False  # When discovery is enabled, the topic is spammed
    sensor: heater_temperature
    default_target_temperature_low: 30
    away_config:
      default_target_temperature_low: 15
    hysteresis: 3
    heat_action:
      - output.turn_on: heater
    idle_action:
      - output.turn_off: heater
    visual:
      min_temperature: 0
      max_temperature: 40
      temperature_step: 1

Logs (if applicable):

Nothing looks amiss in the ESPHome logs, when connected to the MQTT broker though, the topic is repeatedly generated:

mosquitto_sub -h 192.168.0.15 -t '#' -v | ts '[%.T]'
[13:52:40.862549] homeassistant/climate/DEV_NAME/COMPONENT_ID/config {"curr_temp_t":"esphome/DEV_NAME/climate/COMPONENT_ID/current_temperature/state","mode_cmd_t":"esphome/DEV_NAME/climate/COMPONENT_ID/mode/command","mode_stat_t":"esphome/DEV_NAME/climate/COMPONENT_ID/mode/state","modes":["off","heat"],"temp_cmd_t":"esphome/DEV_NAME/climate/COMPONENT_ID/target_temperature/command","temp_stat_t":"esphome/DEV_NAME/climate/COMPONENT_ID/target_temperature/state","min_temp":0,"max_temp":40,"temp_step":1,"away_mode_cmd_t":"esphome/DEV_NAME/climate/COMPONENT_ID/away/command","away_mode_stat_t":"esphome/DEV_NAME/climate/COMPONENT_ID/away/state","act_t":"esphome/DEV_NAME/climate/COMPONENT_ID/action/state","name":"DEV_NAME Thermostat","availability_topic":"esphome/DEV_NAME/status","unique_id":"ESPclimateCOMPONENT_ID","device":{"identifiers":"840d8eabab95","name":"DEV_NAME","sw_version":"esphome v1.16.2 Mar 12 2021, 13:51:25","model":"PLATFORMIO_D1_MINI","manufacturer":"espressif"}}
[13:52:40.912517] homeassistant/climate/DEV_NAME/COMPONENT_ID/config {"curr_temp_t":"esphome/DEV_NAME/climate/COMPONENT_ID/current_temperature/state","mode_cmd_t":"esphome/DEV_NAME/climate/COMPONENT_ID/mode/command","mode_stat_t":"esphome/DEV_NAME/climate/COMPONENT_ID/mode/state","modes":["off","heat"],"temp_cmd_t":"esphome/DEV_NAME/climate/COMPONENT_ID/target_temperature/command","temp_stat_t":"esphome/DEV_NAME/climate/COMPONENT_ID/target_temperature/state","min_temp":0,"max_temp":40,"temp_step":1,"away_mode_cmd_t":"esphome/DEV_NAME/climate/COMPONENT_ID/away/command","away_mode_stat_t":"esphome/DEV_NAME/climate/COMPONENT_ID/away/state","act_t":"esphome/DEV_NAME/climate/COMPONENT_ID/action/state","name":"DEV_NAME Thermostat","availability_topic":"esphome/DEV_NAME/status","unique_id":"ESPclimateCOMPONENT_ID","device":{"identifiers":"840d8eabab95","name":"DEV_NAME","sw_version":"esphome v1.16.2 Mar 12 2021, 13:51:25","model":"PLATFORMIO_D1_MINI","manufacturer":"espressif"}}
[13:52:40.962856] homeassistant/climate/DEV_NAME/COMPONENT_ID/config {"curr_temp_t":"esphome/DEV_NAME/climate/COMPONENT_ID/current_temperature/state","mode_cmd_t":"esphome/DEV_NAME/climate/COMPONENT_ID/mode/command","mode_stat_t":"esphome/DEV_NAME/climate/COMPONENT_ID/mode/state","modes":["off","heat"],"temp_cmd_t":"esphome/DEV_NAME/climate/COMPONENT_ID/target_temperature/command","temp_stat_t":"esphome/DEV_NAME/climate/COMPONENT_ID/target_temperature/state","min_temp":0,"max_temp":40,"temp_step":1,"away_mode_cmd_t":"esphome/DEV_NAME/climate/COMPONENT_ID/away/command","away_mode_stat_t":"esphome/DEV_NAME/climate/COMPONENT_ID/away/state","act_t":"esphome/DEV_NAME/climate/COMPONENT_ID/action/state","name":"DEV_NAME Thermostat","availability_topic":"esphome/DEV_NAME/status","unique_id":"ESPclimateCOMPONENT_ID","device":{"identifiers":"840d8eabab95","name":"DEV_NAME","sw_version":"esphome v1.16.2 Mar 12 2021, 13:51:25","model":"PLATFORMIO_D1_MINI","manufacturer":"espressif"}}

Additional information and things you've tried: As a workaround, disabling discovery at a global or component level will prevent the topic being published.

Discovery of other components appears to publishing as normal.

probot-esphome[bot] commented 3 years ago

mqtt source mqtt issues mqtt recent changes (message by IssueLinks)

stale[bot] commented 3 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

kbx81 commented 3 years ago

I don't have an MQTT setup here, but I'm curious to know if any of the recent changes in thermostat have had any effect on this.

github-actions[bot] commented 2 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.