xZetsubou / hass-localtuya

🔹 A Home Assistant integration to handle Tuya devices locally "fork from localtuya"
https://xzetsubou.github.io/hass-localtuya/
GNU General Public License v3.0
231 stars 21 forks source link

[Bug]: Error while setting up localtuya platform for climate #219

Open YOYONL89 opened 2 weeks ago

YOYONL89 commented 2 weeks ago

LocalTuya Version

3.2.5.1

Home Assistant Version

2024.3.3

Environment

What happened?

During setup i see the climate entity being created although it get the status unavailable. Also the temps (if i get them) showing are of with one decimal so 40C is displayed as 4,0C. The reason i selected "Is this device connected to another local integration, including Home Assistant and any other tools?" is that the cloud tuya is there but in the disabled state, dunno if it might be related although i get the feeling its not.

Steps to reproduce.

  1. Add a new Device (Heatpump)
  2. Adding sometimes failles and does not show a new device / adding sometimes succeeds but the device becomes NA after a few seconds and displaying the wrong info?

Relevant log output

Logger: homeassistant.components.climate
Bron: helpers/entity_platform.py:350
integratie: Klimaat (documentation, issues)
First occurred: 23:06:50 (2 gebeurtenissen)
Laatst gelogd: 23:08:59

Error while setting up localtuya platform for climate
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 350, in _async_setup_platform
    await asyncio.shield(awaitable)
  File "/config/custom_components/localtuya/common.py", line 111, in async_setup_entry
    entity_class(
  File "/config/custom_components/localtuya/climate.py", line 195, in __init__
    self._preset_name_to_value = {v: k for k, v in self._preset_set.items()}
                                                   ^^^^^^^^^^^^^^^^^^^^^^
AttributeError: 'str' object has no attribute 'items'

Diagnostics information.

image

xZetsubou commented 2 weeks ago

This has been fixed on beta updates if you added the device with auto discover entities. If you want to manually fix Localtuya -> configure -> choose reconfigure existing device -> select your device -> click on submit to processed to climate configuration and remove everything inside the presets

OR Download beta version using HACS and re-add the device again if you configured the entities automatically.