AlexxIT / XiaomiGateway3

Home Assistant custom component for control Xiaomi Multimode Gateway (aka Gateway 3), Xiaomi Multimode Gateway 2, Aqara Hub E1 on default firmwares over LAN
https://github.com/AlexxIT/Blog
MIT License
2.48k stars 349 forks source link

fix climate device init setup error and support Scdvb HAVC #1255

Closed Joee-D closed 8 months ago

Joee-D commented 10 months ago

1. fix climate init setup failed problem

fix TARGET_TEMPERATURE_RANGE to TARGET_TEMPERATURE. image

image

log:

Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 507, in async_add_entities
    await asyncio.gather(*tasks)
  File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 752, in _async_add_entity
    await entity.add_to_platform_finish()
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 1278, in add_to_platform_finish
    self.async_write_ha_state()
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 941, in async_write_ha_state
    self._async_write_ha_state()
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 1062, in _async_write_ha_state
    state, attr, capabilities, shadowed_attr = self.__async_calculate_state()
                                               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 1001, in __async_calculate_state
    attr.update(self.state_attributes or {})
                ^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/climate/__init__.py", line 369, in state_attributes
    hass, self.target_temperature_high, temperature_unit, precision
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/backports/functools.py", line 70, in __get__
    val = self.func(instance)
          ^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/climate/__init__.py", line 449, in target_temperature_high
    return self._attr_target_temperature_high
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 338, in _getter
    return getattr(o, private_attr_name)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
AttributeError: 'ScdvbHAVC' object has no attribute '__attr_target_temperature_high

2. support scdvb havc device,

I change the modification method, so it will not affect other devices, only itself.

1216

1217

image

lizhaobibi commented 10 months ago

Probably will solve #1262 too?

Joee-D commented 10 months ago

Probably will solve #1262 too?

yes

lizhaobibi commented 10 months ago

Probably will solve #1262 too?

yes

Hi, just curious to ask, did you encounter the state issue mentioned in #1262 too? Or it’s just a device specific issue with lumi thermostat.

Joee-D commented 10 months ago

Probably will solve #1262 too?

yes

Hi, just curious to ask, did you encounter the state issue mentioned in #1262 too? Or it’s just a device specific issue with lumi thermostat.

the bug was introduced by this PR Fix error in HA 2024.1 (HA>=2023.1)

you can manually modify the code in custom_components/xiaomi_gateway3/climate.py search and change the ClimateEntityFeature.TARGET_TEMPERATURE_RANGE to ClimateEntityFeature.TARGET_TEMPERATURE, then reboot the HA to reload the XiaomiGateway3. It should work now.

lizhaobibi commented 10 months ago

Probably will solve #1262 too?

yes

Hi, just curious to ask, did you encounter the state issue mentioned in #1262 too? Or it’s just a device specific issue with lumi thermostat.

the bug was introduced by this PR Fix error in HA 2024.1 (HA>=2023.1)

you can manually modify the code in custom_components/xiaomi_gateway3/climate.py search and change the ClimateEntityFeature.TARGET_TEMPERATURE_RANGE to ClimateEntityFeature.TARGET_TEMPERATURE, then reboot the HA to reload the XiaomiGateway3. It should work now.

No I don’t mean the TARGET_TEMPERATURE issue which fixed by this PR properly. By “state issue” I actually mean this issue.

Joee-D commented 10 months ago

fixed https://github.com/AlexxIT/XiaomiGateway3/issues/1262#issuecomment-1905487648

AlexxIT commented 8 months ago

Thanks!

AlexxIT commented 8 months ago

For your info https://github.com/AlexxIT/Blog/issues/20

AlexxIT commented 8 months ago

https://github.com/AlexxIT/XiaomiGateway3/releases/tag/v4.0.0