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

HomeKit Controller error in pairing.py with SOMA Connect #84023

Closed
Djelibeybi opened this issue Dec 15, 2022 · 4 comments · Fixed by #85853
Closed

HomeKit Controller error in pairing.py with SOMA Connect #84023

Djelibeybi opened this issue Dec 15, 2022 · 4 comments · Fixed by #85853

Comments

@Djelibeybi
Copy link
Contributor

The problem

I use the HomeKit Controller integration to connect to my SOMA Connect instead of using the more basic SOMA integration. This was working great until either 2022.12 or the introduction of bluetooth to my ODRIOD N2+ because now it throws errors trying to execute the cover.set_cover_position service.

What version of Home Assistant Core has the issue?

2022.12.6

What was the last working version of Home Assistant Core?

No response

What type of installation are you running?

Home Assistant OS

Integration causing the issue

homekit_controller

Link to integration documentation on our website

https://www.home-assistant.io/integrations/homekit_controller/

Diagnostics information

homekit_controller-a0163228bd15ffdd1f4185bfa9dcd60a-SOMA Connect-00e5d8bd725c24ccebdbbd988c355413.json.txt

Example YAML snippet

No response

Anything in the logs that might be useful for us?

Logger: homeassistant.core
Source: components/homekit_controller/connection.py:732
First occurred: 10:39:25 AM (4 occurrences)
Last logged: 11:09:31 AM

Error executing service: <ServiceCall cover.set_cover_position (c:01GM9G37AZSHZPB1MS5D60G6HN): entity_id=['cover.dining_room_table_blind', 'cover.lounge_blind', 'cover.kitchen_blind'], position=100>
Error executing service: <ServiceCall cover.set_cover_position (c:01GM9H7V5654ADG22CVXEWVXKK): entity_id=['cover.dining_room_table_blind', 'cover.lounge_blind', 'cover.kitchen_blind'], position=100>
Error executing service: <ServiceCall cover.set_cover_position (c:01GM9HT4Y9H1TW0CAN1XS626C4): position=100, entity_id=['cover.avis_office_blind']>
Error executing service: <ServiceCall cover.set_cover_position (c:01GM9HT537085D5TF15T4E4HHE): entity_id=['cover.dining_room_table_blind', 'cover.lounge_blind', 'cover.kitchen_blind'], position=100>
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/core.py", line 1763, in catch_exceptions
    await coro_or_task
  File "/usr/src/homeassistant/homeassistant/core.py", line 1782, in _execute_service
    await cast(Callable[[ServiceCall], Awaitable[None]], handler.job.target)(
  File "/usr/src/homeassistant/homeassistant/helpers/entity_component.py", line 213, in handle_service
    await service.entity_service_call(
  File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 678, in entity_service_call
    future.result()  # pop exception if have
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 943, in async_request_call
    await coro
  File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 715, in _handle_entity_call
    await result
  File "/usr/src/homeassistant/homeassistant/components/homekit_controller/cover.py", line 236, in async_set_cover_position
    await self.async_put_characteristics(
  File "/usr/src/homeassistant/homeassistant/components/homekit_controller/entity.py", line 90, in async_put_characteristics
    return await self._accessory.put_characteristics(payload)
  File "/usr/src/homeassistant/homeassistant/components/homekit_controller/connection.py", line 732, in put_characteristics
    await self.pairing.put_characteristics(characteristics)
  File "/usr/local/lib/python3.10/site-packages/aiohomekit/controller/ip/pairing.py", line 303, in put_characteristics
    aid, iid = characteristic["aid"], characteristic["iid"]
TypeError: string indices must be integers

Additional information

No response

@home-assistant
Copy link

Hey there @Jc2k, @bdraco, mind taking a look at this issue as it has been labeled with an integration (homekit_controller) you are listed as a code owner for? Thanks!

Code owner commands

Code owners of homekit_controller can trigger bot actions by commenting:

  • @home-assistant close Closes the issue.
  • @home-assistant rename Awesome new title Change the title of the issue.
  • @home-assistant reopen Reopen the issue.
  • @home-assistant unassign homekit_controller Removes the current integration label and assignees on the issue, add the integration domain after the command.

(message by CodeOwnersMention)


homekit_controller documentation
homekit_controller source
(message by IssueLinks)

@bdraco
Copy link
Member

bdraco commented Dec 15, 2022

Can you turn on debug logging and post the raw response?

https://github.com/Jc2k/aiohomekit/pull/237/files#diff-a28399cf9c8bbbb8a81b27e11e817d41d615191fde7804932bc3e8e4cb6a73bdR302 is now parsing the response but it looks like either we have a bug or your device isn't sending a compliant response to PUT /characteristics

@Djelibeybi
Copy link
Contributor Author

Yep, will try and do this later today or tomorrow.

@Malfarion
Copy link

Malfarion commented Jan 7, 2023

Hi there. I have close problem but with different background.
Homekit integration with aqara hub.
i'm trying to set alarm mode to some state and get same py script error.
Looks like there is a problem with processing response from device

Debug log 👍

2023-01-07 01:55:04.678 DEBUG (MainThread) [homeassistant.components.homekit_controller.connection] Called async_set_available_state with True for 2E:A8:02:F9:65:6A
2023-01-07 01:55:04.678 DEBUG (MainThread) [aiohomekit.controller.ip.connection] 192.168.3.156: raw request: b'PUT /characteristics HTTP/1.1\r\nHost: 192.168.3.156\r\nContent-Length: 53\r\nContent-Type: application/hap+json\r\n\r\n{"characteristics":[{"aid":1,"iid":66308,"value":0}]}'
2023-01-07 01:55:04.742 DEBUG (MainThread) [aiohomekit.controller.ip.connection] 192.168.3.156: raw response: bytearray(b'{"characteristics":[{"aid":1,"iid":66308,"status":-70410}]}')
2023-01-07 01:55:04.743 ERROR (MainThread) [homeassistant.components.websocket_api.http.connection] [140665377979456] string indices must be integers
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/components/websocket_api/commands.py", line 200, in handle_call_service
await hass.services.async_call(
File "/usr/src/homeassistant/homeassistant/core.py", line 1755, in async_call
task.result()
File "/usr/src/homeassistant/homeassistant/core.py", line 1792, in _execute_service
await cast(Callable[[ServiceCall], Awaitable[None]], handler.job.target)(
File "/usr/src/homeassistant/homeassistant/helpers/entity_component.py", line 213, in handle_service
await service.entity_service_call(
File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 678, in entity_service_call
future.result() # pop exception if have
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 958, in async_request_call
await coro
File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 715, in _handle_entity_call
await result
File "/usr/src/homeassistant/homeassistant/components/homekit_controller/alarm_control_panel.py", line 111, in async_alarm_arm_home
await self.set_alarm_state(STATE_ALARM_ARMED_HOME, code)
File "/usr/src/homeassistant/homeassistant/components/homekit_controller/alarm_control_panel.py", line 119, in set_alarm_state
await self.async_put_characteristics(
File "/usr/src/homeassistant/homeassistant/components/homekit_controller/entity.py", line 90, in async_put_characteristics
return await self._accessory.put_characteristics(payload)
File "/usr/src/homeassistant/homeassistant/components/homekit_controller/connection.py", line 758, in put_characteristics
await self.pairing.put_characteristics(characteristics)
File "/usr/local/lib/python3.10/site-packages/aiohomekit/controller/ip/pairing.py", line 303, in put_characteristics
aid, iid = characteristic["aid"], characteristic["iid"]
TypeError: string indices must be integers

bdraco added a commit to bdraco/home-assistant that referenced this issue Jan 13, 2023
@bdraco bdraco mentioned this issue Jan 13, 2023
19 tasks
bdraco added a commit that referenced this issue Jan 14, 2023
balloob pushed a commit that referenced this issue Jan 17, 2023
rlippmann pushed a commit to rlippmann/core that referenced this issue Jan 18, 2023
@github-actions github-actions bot locked and limited conversation to collaborators Feb 13, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants