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

Fan not being added. #125

Closed
thenoid opened this issue Jan 13, 2025 · 11 comments
Closed

Fan not being added. #125

thenoid opened this issue Jan 13, 2025 · 11 comments
Assignees
Labels
bug Something isn't working

Comments

@thenoid
Copy link

thenoid commented Jan 13, 2025

homeassistant  | 2025-01-12 17:01:40.957 ERROR (MainThread) [homeassistant.components.fan] Error adding entity fan.r3_closet_fan for domain fan with platform hubspace
homeassistant  | Traceback (most recent call last):
homeassistant  |   File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 608, in _async_add_entities
homeassistant  |     await coro
homeassistant  |   File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 927, in _async_add_entity
homeassistant  |     await entity.add_to_platform_finish()
homeassistant  |   File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 1384, in add_to_platform_finish
homeassistant  |     self.async_write_ha_state()
homeassistant  |     ~~~~~~~~~~~~~~~~~~~~~~~~~^^
homeassistant  |   File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 1023, in async_write_ha_state
homeassistant  |     self._async_write_ha_state()
homeassistant  |     ~~~~~~~~~~~~~~~~~~~~~~~~~~^^
homeassistant  |   File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 1148, in _async_write_ha_state
homeassistant  |     self.__async_calculate_state()
homeassistant  |     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
homeassistant  |   File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 1087, in __async_calculate_state
homeassistant  |     if state_attributes := self.state_attributes:
homeassistant  |                            ^^^^^^^^^^^^^^^^^^^^^
homeassistant  |   File "/usr/src/homeassistant/homeassistant/components/fan/__init__.py", line 406, in state_attributes
homeassistant  |     data[ATTR_PRESET_MODE] = self.preset_mode
homeassistant  |                              ^^^^^^^^^^^^^^^^
homeassistant  |   File "/config/custom_components/hubspace/fan.py", line 68, in preset_mode
homeassistant  |     if self.resource.preset.enabled:
homeassistant  |        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
homeassistant  | AttributeError: 'NoneType' object has no attribute 'enabled'

_dump_hs_devices.json

@Expl0dingBanana Expl0dingBanana self-assigned this Jan 13, 2025
@Expl0dingBanana Expl0dingBanana added the bug Something isn't working label Jan 13, 2025
@Expl0dingBanana
Copy link
Collaborator

@Expl0dingBanana
Copy link
Collaborator

Expl0dingBanana commented Jan 13, 2025

I havent added the functionality of the speaker but the fan should initialize now on the pre-release dev-exhaust-fan-setup. Let me know if that fixes your issue!

https://github.com/jdeath/Hubspace-Homeassistant/releases/tag/dev-exhaust-fan-setup

@thenoid
Copy link
Author

thenoid commented Jan 13, 2025

That is the one. The manual/box say it's a bf1112

@Expl0dingBanana
Copy link
Collaborator

Awesome, thanks for the confirmation. I just force pushed an update that should fix this issue and correctly identify the fan!

@thenoid
Copy link
Author

thenoid commented Jan 13, 2025

Fan is now recognized as having a on/off/hi/low.

Setting it to hi/low/off turns it on/off correctly. Just hitting "on" throws the following error

homeassistant  | 2025-01-12 18:32:56.686 ERROR (MainThread) [homeassistant.components.websocket_api.http.connection] [130449712691328] Unexpected exception
homeassistant  | Traceback (most recent call last):
homeassistant  |   File "/config/custom_components/hubspace/bridge.py", line 81, in async_request_call
homeassistant  |     return await task(*args, **kwargs)
homeassistant  |            ^^^^^^^^^^^^^^^^^^^^^^^^^^^
homeassistant  |   File "/usr/local/lib/python3.13/site-packages/aiohubspace/v1/controllers/fan.py", line 158, in set_state
homeassistant  |     func_class=cur_item.preset.func_class,
homeassistant  |                ^^^^^^^^^^^^^^^^^^^^^^^^^^
homeassistant  | AttributeError: 'NoneType' object has no attribute 'func_class'
homeassistant  |
homeassistant  | The above exception was the direct cause of the following exception:
homeassistant  |
homeassistant  | Traceback (most recent call last):
homeassistant  |   File "/usr/src/homeassistant/homeassistant/components/websocket_api/commands.py", line 245, in handle_call_service
homeassistant  |     response = await hass.services.async_call(
homeassistant  |                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
homeassistant  |     ...<7 lines>...
homeassistant  |     )
homeassistant  |     ^
homeassistant  |   File "/usr/src/homeassistant/homeassistant/core.py", line 2795, in async_call
homeassistant  |     response_data = await coro
homeassistant  |                     ^^^^^^^^^^
homeassistant  |   File "/usr/src/homeassistant/homeassistant/core.py", line 2838, in _execute_service
homeassistant  |     return await target(service_call)
homeassistant  |            ^^^^^^^^^^^^^^^^^^^^^^^^^^
homeassistant  |   File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 1006, in entity_service_call
homeassistant  |     single_response = await _handle_entity_call(
homeassistant  |                       ^^^^^^^^^^^^^^^^^^^^^^^^^^
homeassistant  |         hass, entity, func, data, call.context
homeassistant  |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
homeassistant  |     )
homeassistant  |     ^
homeassistant  |   File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 1078, in _handle_entity_call
homeassistant  |     result = await task
homeassistant  |              ^^^^^^^^^^
homeassistant  |   File "/usr/src/homeassistant/homeassistant/components/fan/__init__.py", line 314, in async_handle_turn_on_service
homeassistant  |     await self.async_turn_on(percentage, preset_mode, **kwargs)
homeassistant  |   File "/config/custom_components/hubspace/entity.py", line 106, in _impl
homeassistant  |     res = await method(*args, **kwargs)
homeassistant  |           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
homeassistant  |   File "/config/custom_components/hubspace/fan.py", line 107, in async_turn_on
homeassistant  |     await self.bridge.async_request_call(
homeassistant  |     ...<5 lines>...
homeassistant  |     )
homeassistant  |   File "/config/custom_components/hubspace/bridge.py", line 88, in async_request_call
homeassistant  |     raise HomeAssistantError(msg) from err
homeassistant  | homeassistant.exceptions.HomeAssistantError: Request failed: 'NoneType' object has no attribute 'func_class'

@Expl0dingBanana
Copy link
Collaborator

I guess the issue runs the whole way 😂 Let me take a look at that

@thenoid
Copy link
Author

thenoid commented Jan 13, 2025

FWIW - i updated the comment with more debug testing:

`Fan is now recognized as having a on/off/hi/low.

Setting it to hi/low/off turns it on/off correctly. Just hitting "on" throws the following error`

@Expl0dingBanana
Copy link
Collaborator

Expl0dingBanana commented Jan 13, 2025

Should be fixed now if you want to re-pull the tag. Actions sure are a pain sometimes haha

@thenoid
Copy link
Author

thenoid commented Jan 13, 2025

Looks better.

There was a weird behavior when turning it on. Turned it on -> ha marked it on -> device turned on -> ha marked it off -> (I assume the polling cycle occurs) ha marked it on. It was like some issue with the polling cycle after the on? not sure if it's possible to schedule quicker polling temporarily after an event?

Either way, it's now working! Thanks for the speedy updates.

image

@Expl0dingBanana
Copy link
Collaborator

Does that happen every time or sporadically? I think it may have been as it was polling but not sure.

@thenoid
Copy link
Author

thenoid commented Jan 13, 2025

Sporadically

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants