Code Monkey home page Code Monkey logo

Comments (14)

Jc2k avatar Jc2k commented on June 12, 2024

Eep! Thanks for reporting this. Are you able to attach your /configuration/.storage/homekit_controller-entity-map? I want to check what kind of characteristics you have that don't give a format.

Without it we may use a different on wire format to an iOS client, which may or may not work depending on the accessories HomeKit stack. E.g. I had to fix Ecobee support in the last release because it would accept 1, 0 and False as bools, but not True.

  • If it's not an important characteristic or it's read-only i'd be inclined to go with your fix as is
  • If it is an important characteristic, I can merge in the defaults for a given uuid

How are you finding iDevice support otherwise? Is push support working?

from aiohomekit.

LanderTome avatar LanderTome commented on June 12, 2024

The device seems to be working fine. I triggered it through the software and with automations in both Homekit and HA. It is a power outlet with a controllable RGB LED light.

Is this the information you were looking for?

"C3:13:33:4E:1F:37": {
    "accessories": [
        {
            "aid": 1,
            "services": [
                {
                    "characteristics": [
                        {
                            "iid": 2,
                            "perms": [
                                "pr"
                            ],
                            "type": "00000023-0000-1000-8000-0026BB765291",
                            "value": "iDevices Switch"
                        },
                        {
                            "iid": 3,
                            "perms": [
                                "pr"
                            ],
                            "type": "00000020-0000-1000-8000-0026BB765291",
                            "value": "iDevices LLC"
                        },
                        {
                            "iid": 4,
                            "perms": [
                                "pr"
                            ],
                            "type": "00000021-0000-1000-8000-0026BB765291",
                            "value": "IDEV0001"
                        },
                        {
                            "iid": 5,
                            "perms": [
                                "pr"
                            ],
                            "type": "00000030-0000-1000-8000-0026BB765291",
                            "value": "00133875"
                        },
                        {
                            "iid": 6,
                            "perms": [
                                "pw"
                            ],
                            "type": "00000014-0000-1000-8000-0026BB765291"
                        },
                        {
                            "iid": 7,
                            "perms": [
                                "pr"
                            ],
                            "type": "00000052-0000-1000-8000-0026BB765291",
                            "value": "1.2.1"
                        },
                        {
                            "iid": 8,
                            "perms": [
                                "pr"
                            ],
                            "type": "00000053-0000-1000-8000-0026BB765291",
                            "value": "1"
                        }
                    ],
                    "iid": 1,
                    "stype": "accessory-information",
                    "type": "0000003E-0000-1000-8000-0026BB765291"
                },
                {
                    "characteristics": [
                        {
                            "ev": false,
                            "iid": 11,
                            "perms": [
                                "pr",
                                "pw",
                                "ev"
                            ],
                            "type": "00000025-0000-1000-8000-0026BB765291",
                            "value": false
                        },
                        {
                            "iid": 12,
                            "perms": [
                                "pr"
                            ],
                            "type": "00000023-0000-1000-8000-0026BB765291",
                            "value": "Switch"
                        }
                    ],
                    "iid": 10,
                    "stype": "switch",
                    "type": "00000049-0000-1000-8000-0026BB765291"
                },
                {
                    "characteristics": [
                        {
                            "ev": false,
                            "iid": 21,
                            "perms": [
                                "pr",
                                "pw",
                                "ev"
                            ],
                            "type": "00000025-0000-1000-8000-0026BB765291",
                            "value": true
                        },
                        {
                            "ev": false,
                            "iid": 22,
                            "perms": [
                                "pr",
                                "pw",
                                "ev"
                            ],
                            "type": "00000013-0000-1000-8000-0026BB765291",
                            "value": 261
                        },
                        {
                            "ev": false,
                            "iid": 23,
                            "perms": [
                                "pr",
                                "pw",
                                "ev"
                            ],
                            "type": "0000002F-0000-1000-8000-0026BB765291",
                            "value": 100
                        },
                        {
                            "ev": false,
                            "iid": 24,
                            "perms": [
                                "pr",
                                "pw",
                                "ev"
                            ],
                            "type": "00000008-0000-1000-8000-0026BB765291",
                            "value": 100
                        },
                        {
                            "iid": 25,
                            "perms": [
                                "pr"
                            ],
                            "type": "00000023-0000-1000-8000-0026BB765291",
                            "value": "Night Light"
                        }
                    ],
                    "iid": 20,
                    "stype": "lightbulb",
                    "type": "00000043-0000-1000-8000-0026BB765291"
                },
                {
                    "characteristics": [
                        {
                            "ev": false,
                            "format": "string",
                            "iid": 31,
                            "perms": [
                                "pr",
                                "ev"
                            ],
                            "type": "DA594802-809A-4320-BB49-CB0F9CCCB00E",
                            "value": "U6: 0"
                        },
                        {
                            "format": "data",
                            "iid": 32,
                            "perms": [
                                "pw"
                            ],
                            "type": "DA594803-809A-4320-BB49-CB0F9CCCB00E"
                        }
                    ],
                    "iid": 30,
                    "stype": "Unknown Service: DA594801-809A-4320-BB49-CB0F9CCCB00E",
                    "type": "DA594801-809A-4320-BB49-CB0F9CCCB00E"
                }
            ]
        }
    ],
    "config_num": 1
},

from aiohomekit.

Jc2k avatar Jc2k commented on June 12, 2024

Yes, brilliant. It looks like they only include format for vendor specific characteristics. First device i've ssen do that! So i'll probably go down the merging route to be safe.

from aiohomekit.

LanderTome avatar LanderTome commented on June 12, 2024

Now that I think about it, it also reports power usage to the iDevices app. Would that be the vendor specific characteristic?

from aiohomekit.

Jc2k avatar Jc2k commented on June 12, 2024

Some devices do do that yes, I know the Eve plug does for example. I can't see which characteristic it might be in the file you provided though. It's unclear what the value of "DA594802-809A-4320-BB49-CB0F9CCCB00E" means though.

from aiohomekit.

pzuccar avatar pzuccar commented on June 12, 2024

Hello,

I tried this this and this without success.

I'm running home-assistant 0.109.6 and getting this error on pairing:

2020-05-10 21:23:08 ERROR (MainThread) [homeassistant.components.homekit_controller.config_flow] Pairing attempt failed with an unhandled exception Traceback (most recent call last): File "/usr/src/homeassistant/homeassistant/components/homekit_controller/config_flow.py", line 263, in async_step_pair self.finish_pairing = await discovery.start_pairing(self.hkid) File "/usr/local/lib/python3.7/site-packages/aiohomekit/controller/ip/discovery.py", line 76, in start_pairing request, expected = state_machine.send(response) File "/usr/local/lib/python3.7/site-packages/aiohomekit/protocol/__init__.py", line 143, in perform_pair_setup_part1 response_tlv[0][0] == TLV.kTLVType_State and response_tlv[0][1] == TLV.M2 IndexError: list index out of range

I have root access and can help with the debugging

from aiohomekit.

pzuccar avatar pzuccar commented on June 12, 2024

Hello,

It looks like the switch is responding with a HTTP 400 to the pair attempt
Here is the component log:

2020-05-11 18:08:44 DEBUG (MainThread) [aiohomekit.controller.ip.connection] Attempting connection to 192.168.1.41:80
2020-05-11 18:08:44 DEBUG (MainThread) [aiohomekit.protocol.tlv] sending [
  6: (1 bytes/<class 'bytearray'>) 0x01
  0: (1 bytes/<class 'bytearray'>) 0x01
]

2020-05-11 18:08:44 DEBUG (MainThread) [aiohomekit.controller.ip.connection] 192.168.1.41: raw request: b'POST /pair-setup HTTP/1.1\r\nHost: 192.168.1.41\r\nContent-Type: application/pairing+tlv8\r\nContent-Length: 6\r\n\r\n\x06\x01\x01\x00\x01\x01'
2020-05-11 18:08:44 DEBUG (MainThread) [aiohomekit.controller.ip.connection] Got HTTP error 400 for POST against /pair-setup
2020-05-11 18:08:44 DEBUG (MainThread) [aiohomekit.protocol.tlv] receiving [
]

2020-05-11 18:08:44 ERROR (MainThread) [homeassistant.components.homekit_controller.config_flow] Pairing attempt failed with an unhandled exception
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/components/homekit_controller/config_flow.py", line 263, in async_step_pair
    self.finish_pairing = await discovery.start_pairing(self.hkid)
  File "/usr/local/lib/python3.7/site-packages/aiohomekit/controller/ip/discovery.py", line 76, in start_pairing
    request, expected = state_machine.send(response)
  File "/usr/local/lib/python3.7/site-packages/aiohomekit/protocol/__init__.py", line 143, in perform_pair_setup_part1
    response_tlv[0][0] == TLV.kTLVType_State and response_tlv[0][1] == TLV.M2
IndexError: list index out of range
2020-05-11 18:08:44 DEBUG (MainThread) [aiohomekit.controller.ip.connection] Connection HomeKitConnection(host='192.168.1.41', port=80) lost.
2020-05-11 18:08:44 DEBUG (MainThread) [aiohomekit.controller.ip.connection] Attempting connection to 192.168.1.41:80

from aiohomekit.

Jc2k avatar Jc2k commented on June 12, 2024

@pzuccar in the first ticket you linked to (where I talk about with_auth) can you confirm that you tried explicitly setting it to both true and false, and that neither worked?

from aiohomekit.

pzuccar avatar pzuccar commented on June 12, 2024

Yes, in fact I commented out the IF block and explicitly set the auth to True, rebooted, tried and failed. Then repeated the process with Falseand failed again.

from aiohomekit.

pzuccar avatar pzuccar commented on June 12, 2024

I have an iDevices Wall Switch. model IDEV0008 Hardware V1 Firmware 1.9.9.
I had it working, connected to wifi and working with HomeKit, I deleted it from the Home app and then tried to pair it with Home Assistant via zeroconf

from aiohomekit.

Jc2k avatar Jc2k commented on June 12, 2024

It's a good sign that the device responds with a 400. A lot of cheaper HomeKit stacks just drop the connection entirely. It's a shame it doesn't say more, though.

There are 2 possibilities:

  • There is a small variation between what we are sending and what the iDevice expects. These are annoying to work out but easy to fix. E.g. Tado won't tolerate white space in JSON payloads. And Ecobee will tolerate 1, 0 and false as boolean, but not true.

  • iDevice is using one of the new pairing schemes that isn't supported yet.

Resolving either is going to require a bit of reverse engineering.

What I could really do with is a wireshark capture of your iOS device pairing with the iDevice. Which might be a tricky to get as you'll probably need to be able to do wifi captures. Is that something you can provide?

from aiohomekit.

pzuccar avatar pzuccar commented on June 12, 2024

Sure, I'll set everything up and get back to you with the capture.

from aiohomekit.

pzuccar avatar pzuccar commented on June 12, 2024

OK! Solved. As I saw in wireshark, turns out the device was also returning HTTP 400 to HomeKit.
So I put it in pairing mode and aiohomekit happily connected to it!

For those poor souls in need, the steps are the following:

  1. Pair the Switch with HomeKit using the iDevices app. This will get the switch on your wifi.
  2. Once you get it working, delete it from de Home app
  3. Now put the switch on pairing mode, press the button number 6 ( the little one of the left ) for 5 seconds, the blue light should start blinking
  4. Press the button number 2 once ( the off button )
  5. Now pair from Home Assistant
  6. Done

from aiohomekit.

Jc2k avatar Jc2k commented on June 12, 2024

Was closing down old tickets and I think i got confused with multiple iDevice issues in the same ticket and the actual original issue was not solved. Since then, #16 was submitted and I think that will fix the original issue. That should have been released in Home Assistant 0.114.0. So I think we are done here!

from aiohomekit.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.