Skip to content

Can not add bridge with iOS13? #93

Closed

Description

@christiantschoerner

Since iOS 13 I can not add the bridge. With iOS 12 it works. Is there anything new what is should be aware of? The iPhone says it can not be added because it could not connect to the device. Thanks for help and thank you for the project!

Activity

  1. leonborko commented on Nov 1, 2019

    @leonborko

    I have the same problem

  2. ccutrer commented on Nov 1, 2019

    @ccutrer
    Member

    are you running the latest code from HAP-Java, including 0201d9a ? That should fix iOS 13. If you're using it within OpenHAB, you might want to check out https://github.com/ccutrer/openhab2-addons/releases/tag/2.5.0-cody2 (but with caveats). Otherwise, you'll need to compile and drop latest HAP-Java into whatever other project yourself; there's not a new release yet.

  3. J-N-K commented on Nov 1, 2019

    @J-N-K

    Pairing is not working for me, too. It seems that netty closes the connection too early. I added some Thread.sleep and it helped to get some steps further, but finally failed.

  4. christiantschoerner commented on Nov 1, 2019

    @christiantschoerner
    Author

    are you running the latest code from HAP-Java, including 0201d9a ? That should fix iOS 13. If you're using it within OpenHAB, you might want to check out https://github.com/ccutrer/openhab2-addons/releases/tag/2.5.0-cody2 (but with caveats). Otherwise, you'll need to compile and drop latest HAP-Java into whatever other project yourself; there's not a new release yet.

    Compiled current code but same issue :/.

  5. frank-f commented on Nov 1, 2019

    @frank-f

    I'm having the same issue. I'm seeing the following error when I try to pair my phone to openHAB:

    2019-11-01 23:09:59.435 [ERROR] [.hapjava.impl.pairing.PairingManager] - Exception while finalizing pairing org.bouncycastle.crypto.tls.TlsFatalAlert: bad_record_mac(20) at io.github.hapjava.impl.crypto.ChachaDecoder.decodeCiphertext(ChachaDecoder.java:31) ~[299:org.openhab.io.homekit:2.5.0.201911012204] at io.github.hapjava.impl.crypto.ChachaDecoder.decodeCiphertext(ChachaDecoder.java:41) ~[299:org.openhab.io.homekit:2.5.0.201911012204] at io.github.hapjava.impl.pairing.FinalPairHandler.decrypt(FinalPairHandler.java:44) ~[299:org.openhab.io.homekit:2.5.0.201911012204] at io.github.hapjava.impl.pairing.FinalPairHandler.handle(FinalPairHandler.java:39) ~[299:org.openhab.io.homekit:2.5.0.201911012204] at io.github.hapjava.impl.pairing.PairingManager.handle(PairingManager.java:59) [299:org.openhab.io.homekit:2.5.0.201911012204] at io.github.hapjava.impl.connections.HttpSession.handlePairSetup(HttpSession.java:109) [299:org.openhab.io.homekit:2.5.0.201911012204] at io.github.hapjava.impl.connections.HttpSession.handleRequest(HttpSession.java:53) [299:org.openhab.io.homekit:2.5.0.201911012204] at io.github.hapjava.impl.connections.ConnectionImpl.doHandleRequest(ConnectionImpl.java:54) [299:org.openhab.io.homekit:2.5.0.201911012204] at io.github.hapjava.impl.connections.ConnectionImpl.handleRequest(ConnectionImpl.java:47) [299:org.openhab.io.homekit:2.5.0.201911012204] at io.github.hapjava.impl.http.impl.AccessoryHandler.channelRead0(AccessoryHandler.java:52) [299:org.openhab.io.homekit:2.5.0.201911012204] at io.github.hapjava.impl.http.impl.AccessoryHandler.channelRead0(AccessoryHandler.java:17) [299:org.openhab.io.homekit:2.5.0.201911012204] at io.netty.channel.SimpleChannelInboundHandler.channelRead(SimpleChannelInboundHandler.java:105) [274:io.netty.transport:4.1.34.Final] at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:359) [274:io.netty.transport:4.1.34.Final] at io.netty.channel.AbstractChannelHandlerContext.access$600(AbstractChannelHandlerContext.java:38) [274:io.netty.transport:4.1.34.Final] at io.netty.channel.AbstractChannelHandlerContext$7.run(AbstractChannelHandlerContext.java:350) [274:io.netty.transport:4.1.34.Final] at io.netty.util.concurrent.DefaultEventExecutor.run(DefaultEventExecutor.java:66) [271:io.netty.common:4.1.34.Final] at io.netty.util.concurrent.SingleThreadEventExecutor$5.run(SingleThreadEventExecutor.java:905) [271:io.netty.common:4.1.34.Final] at io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30) [271:io.netty.common:4.1.34.Final] at java.lang.Thread.run(Thread.java:748) [?:?]

  6. J-N-K commented on Nov 1, 2019

    @J-N-K

    @frank-f this is with an upgraded bcprov, right? That‘s not working.

  7. frank-f commented on Nov 1, 2019

    @frank-f

    @J-N-K I finally got the version from your repo to compile - it's that one.

    Edit: I downgraded bcprov in your fork back to 1.51 - it's not working like that either.

  8. yfre commented on Nov 3, 2019

    @yfre
    Contributor

    home app has different functions for initial devices load (json parsing) and for device updates.
    the initial load is more strict if something not exactly to specification it just stops. the procedure was change with ios13.
    what helps - start with a small set of device, e.g. lights, do initial load / add bridge, add more device afterwards.
    e.g. there was an issue with thermostat. i add first light and then thermostats.

    if you have time, please try to figure out which device exactly is making issue (but trying to bridge with one device with two, etc), so that we can fix it.

  9. christiantschoerner commented on Nov 3, 2019

    @christiantschoerner
    Author

    home app has different functions for initial devices load (json parsing) and for device updates.
    the initial load is more strict if something not exactly to specification it just stops. the procedure was change with ios13.
    what helps - start with a small set of device, e.g. lights, do initial load / add bridge, add more device afterwards.
    e.g. there was an issue with thermostat. i add first light and then thermostats.

    if you have time, please try to figure out which device exactly is making issue (but trying to bridge with one device with two, etc), so that we can fix it.

    Hey nice catch. But I even tried adding a bridge without any devices and that did not work as well. :(

  10. yfre commented on Nov 3, 2019

    @yfre
    Contributor

    Hey nice catch. But I even tried adding a bridge without any devices and that did not work as well. :(
    and was it working on ios12? maybe something on the network level.
    enable logging with

    1. ssh -p 8101 openhab@localhost
      default password is (habopen)
    2. log:set DEBUG org.openhab.io.homekit
    3. log:set DEBUG io.github.hapjava

    and you should see the request from the phone in openhab.log

  11. christiantschoerner commented on Nov 3, 2019

    @christiantschoerner
    Author

    Hey nice catch. But I even tried adding a bridge without any devices and that did not work as well. :(
    and was it working on ios12? maybe something on the network level.
    enable logging with

    1. ssh -p 8101 openhab@localhost
      default password is (habopen)
    2. log:set DEBUG org.openhab.io.homekit
    3. log:set DEBUG io.github.hapjava

    and you should see the request from the phone in openhab.log

    I am not using openHAB I am using it as Library

  12. frank-f commented on Nov 3, 2019

    @frank-f

    if you have time, please try to figure out which device exactly is making issue (but trying to bridge with one device with two, etc), so that we can fix it.

    Honestly, I gave up with this.

    I installed v2.4.0-homekit-6 (https://github.com/hap-java/openhab2-addons/releases/), which didn't work with iOS 13 either. So I booted up an old iOS 12 device, added everything flawlessly on the first try and now I'm happy I have my smart home stuff working again.

    I have thermostats, lights (on/off and dimmable), a temperature sensor and door/window sensors - if that helps.

  13. GreenRover commented on Nov 9, 2019

    @GreenRover

    I have the same issue. I use the source code from here with a simple java main (from samples branch) but i am unable to bind with my iPhone. But it seams that some kind of timeout happen.

    If i couple with on iPhone using iOS 12 it work but the iOS 13 devices still dont have access.
    Didt some one mage to get it run? Or is someone looking for an solution.

    I also tryed:
    https://github.com/timcharper/HAP-Java
    https://github.com/ccutrer/HAP-Java

  14. yfre commented on Nov 9, 2019

    @yfre
    Contributor

    i got it working. i have around 90 devices of all different types and it works perfect with ios13 as well as with latest Ipados and tvOs.
    my changes are merged to master branch here, but it looks like they dont work for everyone.

    if you want to give a try,

    the repos
    https://github.com/yfre/HAP-Java
    https://github.com/yfre/openhab2-addons/tree/2.4.0/new_devices

  15. christiantschoerner commented on Nov 9, 2019

    @christiantschoerner
    Author

    i got it working. i have around 90 devices of all different types and it works perfect with ios13 as well as with latest Ipados and tvOs.
    my changes are merged to master branch here, but it looks like they dont work for everyone.

    if you want to give a try,

    the repos
    https://github.com/yfre/HAP-Java
    https://github.com/yfre/openhab2-addons/tree/2.4.0/new_devices

    Does not work for me :(

  16. 28 remaining items

  17. yfre commented on Mar 25, 2020

    @yfre
    Contributor

    Just turned off the firewall and it is working like a charm. My fault, so sorry :/
    Anyway thank you for your time!

    cool! added firewall to my checklist :)

  18. obartelt commented on Mar 31, 2020

    @obartelt

    Doesn't work for me. Pairing completes, the service says it's re-registering, and then removeUser is called and the device says the process failed. iOS 13.3.1. I already tried with and without re-registering the service, but to no avail.

    What I find strange is that the request for accessories is received BEFORE the service is re-registering itself. Could this be the problem? Is there maybe a better way like updating the service instead of re-registering it (by using ServiceInfo.setText)? Or re-register the service immediately after sending the final pairing response, so that the service is ready when the next request comes?

  19. obartelt commented on Mar 31, 2020

    @obartelt

    Update: if I remove the MockSwitch and just create the bridge, I can add the bridge successfully. So it must have something to do with the device. I already checked the JSON and it's identical to the one posted here for a successful attempt. No null or anything strange. Any idea?

  20. yfre commented on Mar 31, 2020

    @yfre
    Contributor

    in the older iOS i had to remove "home" and create again time-to-time to get rid of some strange issues. but with ios 13.3.x i could repeat pairing many times without getting any issues.

    can you now add the device? without removing the bridge and home. just add device and restart the sample.

  21. obartelt commented on Mar 31, 2020

    @obartelt

    No, I can't, because I have to search again and then the bridge isn't found, because it's paired :-(

    I also cleared Home completely, but that changes nothing. Any info I can provide?

  22. yfre commented on Mar 31, 2020

    @yfre
    Contributor

    i did recently the refactoring of HAP in order to add support for optional attributes. the changes are not merged yet, but it would be interesting to know whether you get the same issue with a newer version.

    could you maybe try run the sample that is based on the refactored version?
    you can download it here
    https://1drv.ms/u/s!AqqiEfFRr6WAgYgRlv15LrGLAPkq8g?e=UsqzQ2
    and run with " java -jar target/hap-sample-0.0.2-SNAPSHOT.jar"

    or build it yourself form #102

  23. obartelt commented on Mar 31, 2020

    @obartelt

    Hmm, the jar is only 10 kb and doesn't seem to work? And building it myself would require updating the library, too, because the sample uses parameters for createBridge that I haven't seen before ;-)

  24. yfre commented on Mar 31, 2020

    @yfre
    Contributor

    you are right. the libs are missing.
    so, i have ziped the target folder with zip and jar.
    if you have time, could you please try it one more time
    https://1drv.ms/u/s!AqqiEfFRr6WAgYgSE-Tb84IKu4ev9A?e=vwozRf

  25. obartelt commented on Mar 31, 2020

    @obartelt

    Hmm, ok, that one works, so the error is probably somewhere on my side. Ok, here's what I'm trying to do: I'm triyng to get HAP-Java working with IKVM in C#/.NET. Which seems to work for the most part, but I have no idea why it fails on this "small" detail.

    If you have time, I have put the logs of both your sample and mine (using the same, cross-compiled 2.0 jar). Apart from the logging difference, I can't make out much difference, only that your's works and mine doesn't :-(

    https://1drv.ms/u/s!AtK4xQ8gVYfFmF4oiRQcptvbOPZ1?e=1q1JgT

  26. obartelt commented on Apr 2, 2020

    @obartelt

    After numerous attempts and switching of library versions, I finally got it working. In the end, the problem was one single character in the Json file ;-) I returned a .NET bool for the power state, which converted to "False" instead of "false". doh ;-)

  27. Otah commented on Apr 21, 2020

    @Otah

    Hi, I hope I didn't miss it in the discussion: in which version is this expected to be fixed?

    As far as I can tell right now, I tried both 1.1.3 and then 1.1.5 and in both of them the pairing does not work with iOS 13.x. It happened to me once from like 20-30 attempts that it worked, but it was literally just once.

    Is there a plan to port the fix to the original 1.1.x "beowulfe" series? Or do I have to eventually migrate to the 1.2.x series? I am using HAP Java 1.1.x as a "driver" for HAP Scala and my derived personal projects.

  28. Otah commented on Apr 22, 2020

    @Otah

    Probably never mind. So far it seems that the migration to 1.2 is extremely smooth. I will hopefully not need the older versions. (But maybe somebody else will?)

  29. added a commit that references this issue on Dec 28, 2020
  30. yfre commented on Jan 31, 2022

    @yfre
    Contributor

    closing as obsolete

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions