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

Having an ir device without an associated puck crashes getting updates #91

Open
tsuckow opened this issue Dec 4, 2024 · 3 comments · May be fixed by #92
Open

Having an ir device without an associated puck crashes getting updates #91

tsuckow opened this issue Dec 4, 2024 · 3 comments · May be fixed by #92

Comments

@tsuckow
Copy link

tsuckow commented Dec 4, 2024

I rearranged some devices in my home and found an issue that causes the home assistant plugin to stop getting temperature/state data from flair. It will load it once when you reload the plug-in but never again.

I had previously made a fake heater ir device to appease flair warnings about not having a zone in a room with a vent

Error adding entity climate.fake_heater_hvac_unit for domain climate with platform flair
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 598, in _async_add_entities
    await coro
  File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 912, in _async_add_entity
    await entity.add_to_platform_finish()
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 1362, in add_to_platform_finish
    self.async_write_ha_state()
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 1007, in async_write_ha_state
    self._async_write_ha_state()
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 1133, in _async_write_ha_state
    state, attr, capabilities, shadowed_attr = self.__async_calculate_state()
                                               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 1067, in __async_calculate_state
    available = self.available  # only call self.available once per update cycle
                ^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/climate/__init__.py", line 318, in __getattribute__
    return super().__getattribute__(__name)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/config/custom_components/flair/climate.py", line 805, in available
    if not self.puck_data.attributes['inactive']:
           ^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/climate/__init__.py", line 318, in __getattribute__
    return super().__getattribute__(__name)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/config/custom_components/flair/climate.py", line 500, in puck_data
    puck_id = self.hvac_data.relationships['puck']['data']['id']
              ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^
TypeError: 'NoneType' object is not subscriptable
@RobertD502
Copy link
Owner

RobertD502 commented Dec 4, 2024

That is due to Flair HVAC (mini split/other IR controlled units) needing to have a "controller" Puck associated with them. If you use the Flair app, you'll likely see a warning related to this for the fake HVAC unit that you created. Within Home Assistant, the Puck being online/offline is used to determine if the IR controlled HVAC unit climate entity is available (since an associated puck is used to control a unit).

In your case, you have a few options:

  1. If you have one available, within the Flair app, associate a Puck with the fake HVAC unit that you created.
  2. If the zone warning in the Flair app is just a warning and you're still able to control the vent(s) just fine, remove the fake HVAC unit and ignore the warning (shouldn't be a big deal if you're already doing all the control via Home Assistant and never using the app).
  3. If you don't prefer any of the two previous options: In the climate.py file, located in the custom_components/flair directory, comment out lines 496-501 and lines 801-808. However, be aware that whenever new versions of this integration are released and you install it, your changes will get reverted and you will need to do this step again.

@tsuckow
Copy link
Author

tsuckow commented Dec 4, 2024

I'll try to see if I can sneak some time next week to see if I can alter the python to just short circuit to offline if the puck is missing and submit a PR.

Or worst case skip importing the device.

@RobertD502
Copy link
Owner

RobertD502 commented Dec 4, 2024

I'll try to see if I can sneak some time next week to see if I can alter the python to just short circuit to offline if the puck is missing and submit a PR

Just to be upfront, this is not something that I'd plan to incorporate as the HVAC climate entities are meant to represent actual units that have pucks associated with them.

Edit: I see what you're saying. Apologies, I misinterpreted it initially. I can incorporate a check, which will mark the entity unavailable and log a warning - This way it satisfies your use case, but also alerts those who are using real units to a potential issue in their setup.

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 a pull request may close this issue.

2 participants