Core: homekit_controller: Add support for fan service

Created on 24 Aug 2019  ·  17Comments  ·  Source: home-assistant/core

Home Assistant release with the issue:

0.97.2

Operating environment (Hass.io/Docker/Windows/etc.):

Docker

Component/platform:

homekit_controller

Description of problem:
Upgraded from 0.93.2 to 0.97.2 and my Hunter ceiling fan showed up as a new device to configure (shows up as a SIMPLEconnect Fan). Trying to configure fails with the below error.

Traceback (if applicable):

2019-08-24 02:43:52 ERROR (MainThread) [aiohttp.server] Error handling request
Traceback (most recent call last):
  File "/usr/local/lib/python3.7/site-packages/aiohttp/web_protocol.py", line 418, in start
    resp = await task
  File "/usr/local/lib/python3.7/site-packages/aiohttp/web_app.py", line 458, in _handle
    resp = await handler(request)
  File "/usr/local/lib/python3.7/site-packages/aiohttp/web_middlewares.py", line 119, in impl
    return await handler(request)
  File "/usr/src/app/homeassistant/components/http/real_ip.py", line 37, in real_ip_middleware
    return await handler(request)
  File "/usr/src/app/homeassistant/components/http/ban.py", line 69, in ban_middleware
    return await handler(request)
  File "/usr/src/app/homeassistant/components/http/auth.py", line 228, in auth_middleware
    return await handler(request)
  File "/usr/src/app/homeassistant/components/http/view.py", line 124, in handle
    result = await result
  File "/usr/src/app/homeassistant/components/config/config_entries.py", line 153, in get
    return await super().get(request, flow_id)
  File "/usr/src/app/homeassistant/helpers/data_entry_flow.py", line 78, in get
    result = await self._flow_mgr.async_configure(flow_id)
  File "/usr/src/app/homeassistant/data_entry_flow.py", line 93, in async_configure
    if cur_step.get("data_schema") is not None and user_input is not None:
AttributeError: 'NoneType' object has no attribute 'get'

Additional information:

homekit_controller

Most helpful comment

@benjgos @TheAlphaLaw i've just opened a pull request against Home Assistant for HomeKit fan support.

All 17 comments

Is there any other information you can give? That traceback isn't inside homekit_controller so its a bit hard to figure out what might be going on. Do you get the pop up asking for a pairing code or does it fail before then?

Hey there @Jc2k, mind taking a look at this issue as its been labeled with a integration (homekit_controller) you are listed as a codeowner for? Thanks!

Hi,
Sorry for the lack of info.
I don't get the pairing code. UI just sits there spinning forever (escape aborts it).
I realized I didn't remove the fan from my Home app so I removed it and tried again.
Now when I start up HASS it shows I have a new device to configure, but once I click on Configure it spins for a short while and pops up "Aborted - Cannot add pairing as device can no longer be found."
No logs are generated for this.
I have the below enabled logs. Is there anything else I can do to provide more info?

logger:
  default: info
  logs:
    homeassistant.components.homekit: debug
    pyhap: debug
    homeassistant.components.homekit_controller: debug

Thanks.

Update, I've been trying periodically to click Configure for the fan, probably tried 10 times since the last post.
This timeI tried again and received the popup for the PIN, entered it and it added the new integration.
This was the log output:

2019-08-30 00:59:01 INFO (MainThread) [homeassistant.setup] Setting up homekit_controller
2019-08-30 00:59:01 INFO (MainThread) [homeassistant.setup] Setup of domain homekit_controller took 0.1 seconds.
2019-08-30 00:59:03 DEBUG (MainThread) [homeassistant.components.homekit_controller.connection] HomeKit connection not polling any characteristics.
2019-08-30 00:59:03 INFO (MainThread) [homeassistant.components.light] Setting up light.homekit_controller

It created a light component, but no fan.
I assume it wasn't identified correctly as a fan? is there any information I can provide to fix this?

Thanks.

There hasn't been any activity on this issue recently. Due to the high number of incoming GitHub notifications, we have to clean some of the old issues, as many of them have already been resolved with the latest updates.
Please make sure to update to the latest Home Assistant version and check if that solves the issue. Let us know if that works for you by adding a comment 👍
This issue now has been marked as stale and will be closed if no further activity occurs. Thank you for your contributions.

Is there any update on this? I am only able to connect the light and not the fan to HA via the homekit integration. Homekit works fine with the fan on it's own.

There is no fan code to map homekit fans to home assistant fans at the moment. If you can share your ‘/config/.storage/homekit_controller-entity-map’ I can probably add support. But my time is limited so I can’t make any promises about when.

@benjgos @Jc2k

Just checked remotely and I have my fans and Homekit integration disabled. Will not be home until this weekend. @benjgos are you able to provide this info on your end?

Sure, see attached.
homekit_controller-entity-map.zip

@benjgos Thank you!

@Jc2k I can get you mine, if needed, this weekend. Let me know!

@benjgos @TheAlphaLaw i've just opened a pull request against Home Assistant for HomeKit fan support.

@Jc2k Thank you so much! Just upgraded to 104.0 and the new fan entity works great on my Hunter (SIMPLEconnect) fan! I can at last delete my half baked workarounds! :))

@Jc2k I second that, works perfectly!

Updated to 0.104.2 and now the Hunter (SIMPLEconnect) fan is showing up when added to Home Assistant. But, not working properly, whenever I turn on it always goes to high speed.

If state is on, then I select medium it goes to a real "low" speed, if I select high, it goes to a real "medium" speed, if I select low or off, it turns off but the state keeps showing as on state, unless I turn the toggle off.
If state is off, then doesn't matter if I select low, medium or high, it always go to a real "high" speed.

I’m not seeing that with my Fan (Hunter Apache).
Compared to the Hunter app, I have the following mappings:
Off = 0
Low = 1
Medium = 2
High = 4

Thats the behavior of the fan, initially seems illogical but I was able to find a pattern, so had to created a Template Fan with some scripts to address the behavior bellow and its working ok now:

If State Off, previous High

Turn Low = High
Turn Medium = High
Turn High = High

If State Off, previous Medium

Turn Low = High
Turn Medium = High
Turn High = High

If State Off, previous Low

Turn Low = Low
Turn Medium = Low
Turn High = Low

If State Off, previous Off with Status On

Turn Low = High
Turn Medium = High
Turn High = High

If State On, doesn’t matter previous state.

Change to Off = Off but status On
Change to Low = Off but status On
Change to Medium = Low
Change to High = Medium

I can shed some light on this. There are 2 levels of translation happening:

  • It appears your device supports states 0 to 4
  • HomeKit works on percentages exclusively
  • HA is a bit confusing but it essentially has [off, low, medium, high]

I think there might be fans that don't use those mappings but they aren't compliant so things like the HomeKit/Alexa/Google Assistant extensions probably don't work as well or at all for them.

The first layer of translation is really problematic as its unspecified by the HomeKit protocol. I have no way of knowing what the transition percentage point is for each of the speeds your fan does support. And thats why the labels don't match.

The relevant issue to track for this is here. To properly support HomeKit fans I need a richer fan API in HA. Until then there will be this discrepancy that you see.

I think something else is going on with the off + speed change. But I think it'll be difficult to debug that until we can do something about the architecture issue.

Was this page helpful?
0 / 5 - 0 ratings