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

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

Merged
merged 3 commits into from
Mar 24, 2024

Conversation

Joee-D
Copy link
Contributor

@Joee-D Joee-D commented Jan 6, 2024

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

@AlexxIT AlexxIT self-assigned this Jan 6, 2024
@lizhaobibi
Copy link

Probably will solve #1262 too?

@Joee-D
Copy link
Contributor Author

Joee-D commented Jan 14, 2024

Probably will solve #1262 too?

yes

@lizhaobibi
Copy link

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
Copy link
Contributor Author

Joee-D commented Jan 23, 2024

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
Copy link

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
Copy link
Contributor Author

Joee-D commented Jan 31, 2024

fixed #1262 (comment)

@AlexxIT AlexxIT merged commit da87daa into AlexxIT:master Mar 24, 2024
2 checks passed
@AlexxIT AlexxIT added this to the v4.0.0 milestone Mar 24, 2024
@AlexxIT
Copy link
Owner

AlexxIT commented Mar 24, 2024

Thanks!

@AlexxIT
Copy link
Owner

AlexxIT commented Mar 24, 2024

For your info AlexxIT/Blog#20

@AlexxIT
Copy link
Owner

AlexxIT commented Mar 31, 2024

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

Successfully merging this pull request may close these issues.

3 participants