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

[BUG] v1.8.0 breaks HomeKit / Homebridge integration for possible edge cases #116

Closed
simonnelli opened this issue Nov 17, 2020 · 20 comments
Closed
Assignees
Labels
bug Something isn't working

Comments

@simonnelli
Copy link

simonnelli commented Nov 17, 2020

Describe the bug
Latest update breaks connection between HomeKit and Homebridge.
Deleting Homebridge in HomeKit and trying to add the Bridge to HomeKit leads to Error message: "accessory is out of compliance"

Deleting Dingz-plugin from HomeKit resolves the issue

To Reproduce
Steps to reproduce the behavior:
Install latest Dingz-plugin in Homebridge

Plugin environment (please complete the following information):

  • dingz/myStrom Device Firmware Version [1.2.7]
  • Homebridge Server: [Homebridge Docker]
  • Plugin Version [v1.8.0]
  • Node.js Version [v14.15.0]
  • Homebridge Version [v1.2.3]
        {
            "name": "dingz",
            "motionPoller": true,
            "autoDiscover": false,
            "callbackHostname": "192.168.227.10",
            "devices": [
                {
                    "type": "dingz",
                    "name": "dingz Küche",
                    "address": "192.168.227.12"
                }
            ],
            "platform": "Dingz"
        },

Additional context
Remember #5 ? :D

@simonnelli simonnelli added the bug Something isn't working label Nov 17, 2020
@johannrichard
Copy link
Owner

Aw shucks. I'll have a look at it. Just to confirm:

  • You removed HomeBridge completely from your HomeKit and when you try to re-add the bridge, it fails?

If yes: is there a specific reason why you removed it in the first place (i.e. another error that made you remove it)?

And what iOS version did you test with?

And as a workaround: you can downgrade to v1.7.1 by installing via the terminal in HomeBridge:

npm install [email protected]

(I suspect the reachability attribute I introduce w/ v1.8.1 might trigger that error. I haven't seen that on my side yet but will do more tests)

@johannrichard
Copy link
Owner

Oh and yes, of course: #5. Have to check the code I reused when updating didn't miss that (They're still working on a fix in HomeBridge/Hap-JS. AFAIK it hasn't made it into a release yet). 🤪

@simonnelli
Copy link
Author

I completely removed HomeBridge from HomeKit because all HB-Accessories showed up as "no response". Tried to resolve the problem this way before I tried removing the Dingz-Plugin.

iOS is 14.2, rolling back to 1.7.1 works.

@johannrichard johannrichard changed the title [BUG] [BUG] v1.8.0 breaks HomeKit / Homebridge integration for possible edge cases Nov 17, 2020
@johannrichard
Copy link
Owner

    {
        "name": "dingz",
        "motionPoller": true,
        "autoDiscover": false,
        "callbackHostname": "192.168.227.10",
        "devices": [
            {
                "type": "dingz",
                "name": "dingz Küche",
                "address": "192.168.227.12"
            }
        ],
        "platform": "Dingz"
    },

May I ask you to post the output from /api/v1/device as well? As I've said elsewhere (e.g. #114 #87) , the API for v1.2.x firmware changed quite a bit and some information that was beforehand returned (but empty) might now be not returned at all for non-existing serial numbers ...

@simonnelli
Copy link
Author

simonnelli commented Nov 17, 2020

There you go:

{"246F28A65F30":{"type":"dingz","battery":false,"reachable":true,"meshroot":true,"fw_version":"1.2.7","hw_version":"1.1.2","fw_version_puck":"1.1.21","bl_version_puck":"1.0.0","hw_version_puck":"1.1.1","hw_id_puck":1,"puck_sn":"","puck_production_date":{"year":20,"month":1,"day":2},"puck_hw_model":"","front_hw_model":"dz1f-4b","front_production_date":"20/4/26","front_sn":"F20042600212","dip_config":3,"has_pir":false,"hash":"e6e52dab"}}

@qx54
Copy link

qx54 commented Nov 20, 2020

Updated to 1.8 and only discovered this issue afterwards.
Luckily it seems this issue doesn't happen in all circumstances, my Homekit/Homebridge connection still works.

myStrom Button Firmware Version [2.74]
myStrom PIR Firmware Version [3.8.2]
Homebridge Server: [Raspberry Pi 4]
Plugin Version [1.8.0]
Node.js Version [14.15.1]
Homebridge Version [1.1.6]

Maybe this helps.

@johannrichard
Copy link
Owner

johannrichard commented Nov 24, 2020

@simonnelli: I couldn't find any cases of empty serial numbers and the remaining info seems complete, so this is a bit weird.

In the meantime I've worked on a v2.0.0-nightly of the plug-in. If you install the nightly w/ homebridge-dingz@nightly you should be upgraded to this version.

The functionality remains largely the same but the code is less cluttered and better structured so should generally run better. There might be bugs though but you can always downgrade to v1.7.1 (although I think the newest nightlies are much more robust).

I've had it running over longer periods of time now on my production dingz. So far I could not observe any problems with its operation.

The biggest change I reverted w.r.t. v1.8.0 is the reachability. If the nightly works now, that might somehow have been the cause.

I'd be grateful if you could run it and let me know if it (still) works.

@simonnelli
Copy link
Author

I've been testing v2.0.0-nightly since Monday an this version seems to have fixed the bug described.
I've run into other error messages in the log, but will open another bug for this.

johannrichard added a commit that referenced this issue Nov 28, 2020
- simplify device updates
- allows updating device info (core info) via platform
- implements (better) device recovery
- implements better error handling for devices
- streamlines code
- streamlines accessory interfaces & methods
- other small chores
- implements fixes #3, #103, #116, #123, #135
@simonnelli
Copy link
Author

Strangely my setup broke again. I havn't changed anything except always updating to the last version of your plugin. Not sure when and why it broke but I've rolled back version by version (deleting plugin incl. configuration, restarting HB, starting from scratch), but every version since 1.7.1 now seems to be broken with my setup. Even with your plugin uninstalled (but leaving the config in the config-file) my setup breaks.

Not sure how to give you more precise info to debug. Staying on 1.7.1 for now but willing to help debug :)

@simonnelli
Copy link
Author

Just found out why I didn't notice that my setup breaks: When I update your plugin, everything works as long as I don't restart HB. As soon as I restart HB and the updated plugin loads it breaks. Likely since v.1.7.1

@johannrichard
Copy link
Owner

Do you have any errors in the log (early on)? I've sometimes seen cases where ports remained blocked in auto-discovery when HB was restarted, but only on my development machine and not on my "production" system (where I install the nightlies as well after first testing on my dev).

@simonnelli
Copy link
Author

Just the already reported errors (dead, alive). Auto discovery is off

@johannrichard johannrichard reopened this Dec 2, 2020
@johannrichard
Copy link
Owner

johannrichard commented Dec 2, 2020

Was wondering: do you still have the mixed IPv4/IPv6 setup you had when we worked on the initial bugs (#13)? From some (other) problems I had with homebridge crashing because of network issues, I fear it might be network stack related.

I made one change in the callback server, binding the plug-in to 0.0.0.0, in v2.0.0. I've removed that in the latest nightly, if you want test that one, we might confirm/exclude this as a probable cause.

@simonnelli
Copy link
Author

Yes I'm still running dualstack IPv4/v6. Will test with v6 off tomorrow.

Still breaking with latest nightly (2.0.7-nightly.3)

@johannrichard
Copy link
Owner

johannrichard commented Dec 3, 2020

Yes I'm still running dualstack IPv4/v6. Will test with v6 off tomorrow.

Don't bother. If it wasn't the IPv6 stack related to the callback server and the change with binding or not to the IPv4 then it's something else.

@johannrichard
Copy link
Owner

Just an update on my investigations: On my side, I've lately seen some weird HomeKit behaviour (endless "Updating", especially when away) which I first attributed to my Apple TV/Hub running iOS beta and/or another HomeKit device being the culprit (since rebooting either one made the issues go away).

I will do some more tests and report back ASAP.

@johannrichard
Copy link
Owner

johannrichard commented Dec 3, 2020

@simonnelli With a bit more time to reflect on your bug report and a fresh look, I have a few questions related to the breaking (sorry to ask them, but we never discussed these):

  • when you upgraded to v2.0.0, did you remove the accessories (dingz) from the cache before restarting HB or did you just install/uninstall the plugin and maybe change/remove the config? This is a bit tricky, upgrading/downgrading the plugin does not clear the accessories cache and this can lead to problems (The accessories cache can be found in HB Config UI X Settings. It should be sufficient to remove the dingz from the cache and then restart HB again, however, it will remove them from HomeKit.)

HB_Accessories_Cache

  • if you run v2.0.0 and issue the command dns-sd -B _hap._tcp in Terminal.app on a Mac, do you see your HB listed?
> dns-sd -B _hap._tcp
21:16:59.341  Add        3   4 local.               _hap._tcp.           Serenity XXXX

@simonnelli
Copy link
Author

Just tried following:

Uninstall dingz-plugin, removing configuration
clearing dingz from HB-cache
restarted HB
installed 2.0.0, configured one dingz manually, no auto-discovery
dingz is displayed in Config UI X but HB connection immediately breaks.

Here the output from dns-sd -B _hap._tcp. I assume the duplicated entries are because of IPv4/v6

9:46:30.893 Add 3 4 local. _hap._tcp. Philips hue - 2C8000
9:46:30.893 Add 3 8 local. _hap._tcp. Philips hue - 2C8000
9:46:30.893 Add 3 4 local. _hap._tcp. Switch 01d3f8
9:46:30.893 Add 3 8 local. _hap._tcp. Switch 01d3f8
9:46:30.893 Add 3 4 local. _hap._tcp. Smart AC Control WR1741951488
9:46:30.893 Add 3 8 local. _hap._tcp. Smart AC Control WR1741951488
9:46:30.893 Add 3 4 local. _hap._tcp. DINGZ A65F30
9:46:30.893 Add 3 8 local. _hap._tcp. DINGZ A65F30
9:46:30.893 Add 3 4 local. _hap._tcp. Homebridge AC78
9:46:30.893 Add 2 8 local. _hap._tcp. Homebridge AC78

@johannrichard
Copy link
Owner

This really sounds like our famous #5 again, only it's much harder to catch. The only difference in the device config I saw was the empty puck_hw_model. But the code handling this didn't change between the v1.7.1 and v2.0.0.

I'm almost tempted to propose a dingz swap: I send you my test dingz and you send me your prototype. Would make my programming harder and (hopefully) solve your problem (and if not, it would be something else ...). Let me know if this is something you'd consider.

@johannrichard
Copy link
Owner

I've gone through a bit more looking around if other plugin developers had similar issues. Although I also run my HB setup on [email protected] like you, I saw quite some reports of people who had issues running their setup under this version, and reverted back to [email protected].

So what I suggest to further debug:

  • what happens if you run homebridge-dingz@latest on [email protected] (you can downgrade the homebridge in the docker image as you would with a plugin: npm i [email protected] and then restart homebridge (but not the docker container, obviously); if this works: fine, if not, help with the following as well
  • I sent you some instructions over at Twitter for full debug output you can send me by mail

johannrichard added a commit that referenced this issue Dec 12, 2020
- remove reference to #103, #116, #120, #123 (all implemented by now)
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
Status: Done
Development

No branches or pull requests

3 participants