Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Renaming thermostat in zigbee2mqtt, changing the homeassistant id causes exception #1479

Open
3 tasks
phdoerfler opened this issue Nov 17, 2024 · 2 comments
Open
3 tasks
Assignees
Labels
enhancement New feature or request

Comments

@phdoerfler
Copy link

Prerequisites

  • Model name of your Devices:
  • Eurotronic
  • Spirit Zigbee wireless heater thermostat
  • Zigbee model SPZB0001
  • Firmware build date 20191014
  • Firmware version 22190930
  • Output from Home Assistant Developer Tools state (Output of the underlying real thermostat)
hvac_modes:
  - "off"
  - auto
  - heat
min_temp: 5
max_temp: 30
target_temp_step: 0.5
current_temperature: 21
temperature: 21
hvac_action: heating
friendly_name: trv_kueche
supported_features: 385

Description

In zigbee2mqtt rename device with the box "Update Home Assistant entity ID" checked, changing the entity ID from, e.g., "climate.trv_küche" to "climate.trv_kueche".

Steps to Reproduce

see description

Expected behavior:

I expect renaming to be handled more gracefully.

Actual behavior:

The log shows this exception multiple times:

2024-11-17 11:14:04.951 ERROR (MainThread) [homeassistant] Error doing job: Task exception was never retrieved (None)
Traceback (most recent call last):
  File "/config/custom_components/better_thermostat/climate.py", line 794, in startup
    await init(self, trv)
  File "/config/custom_components/better_thermostat/adapters/delegate.py", line 46, in init
    return await self.real_trvs[entity_id]["adapter"].init(self, entity_id)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/config/custom_components/better_thermostat/adapters/mqtt.py", line 47, in init
    ).state in (STATE_UNAVAILABLE, STATE_UNKNOWN, None):
      ^^^^^
AttributeError: 'NoneType' object has no attribute 'state'

Versions

BT: 1.6.1

HA:
Core 2024.11.2
Supervisor 2024.11.2
Operating System 13.2
Frontend 20241106.2

Additional Information

No additional information

@phdoerfler phdoerfler added the new bug incoming bug issue label Nov 17, 2024
@MrUhu
Copy link

MrUhu commented Nov 29, 2024

You are renaming the device inside home assistant.
Why should better Thermostat pick up the new name, if to this plugin it just looks like there is a new thermostat installed.
This behaviour is totally expected and not a bug.

I mean. Correct me if I'm wrong, but better Thermostat has no knowledge about changes within home assistant, so this is unfixable.
Just don't rename your thermostats or simply set up a new one within better Thermostat.

@folfy folfy added enhancement New feature or request and removed new bug incoming bug issue labels Jan 9, 2025
@folfy
Copy link
Collaborator

folfy commented Jan 9, 2025

I get it would be nice to catch the exception at least, but it would be a lot of work to "fix" all device requests in BT, so won't be implemented that soon, as there are way more important issues.

Detecting a name-change (i.e. getting some signal for this event) might be possible, like don't wanna say for sure that it's impossible, but I'd say that a different topic, and not what OP requested anyway (just requested more graceful handling of the resulting error).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

4 participants