oogje / homebridge-i6-bigAssFans

A Homebridge plugin which allows you to control a Big Ass Fan.
MIT License
21 stars 4 forks source link

Loop of Child bridge process ended #16

Closed thicla01 closed 2 years ago

thicla01 commented 2 years ago

Describe The Bug:

The plugin was working flawlessy for several month, but now the Child bridge process ends continually

To Reproduce:

I have remove the plugin, clean the cache, restart the server, reinstall the plugin, reconfigure my Haiku Fan. The process start normaly. when I restart Homebridge, the child bridge process ends again continually

Expected behavior:

The process stay up after a Homebridge restart

Logs:

[24/09/2022, 20:21:22] [BigAssFans-i6] Initializing BigAssFans-i6 platform...
[24/09/2022, 20:21:22] [BigAssFans-i6] Initializing child bridge 0E:7A:F6:A6:CA:CB
[24/09/2022, 20:21:24] [homebridge-i6-bigassfans] Launched child bridge with PID 4695
[24/09/2022, 20:21:24] Registering platform 'homebridge-i6-bigassfans.BigAssFans-i6'
[24/09/2022, 20:21:24] [homebridge-i6-bigassfans] Loaded homebridge-i6-bigassfans v0.5.1 child bridge successfully
[24/09/2022, 20:21:24] [homebridge-i6-bigassfans] Init - initializing devices
[24/09/2022, 20:21:24] [homebridge-i6-bigassfans] Adding new accessory: Haiku_Salon

This a part of the loop : 
[24/09/2022, 20:30:17] [homebridge-i6-bigassfans] Restarting Process...
[24/09/2022, 20:30:19] [homebridge-i6-bigassfans] Launched child bridge with PID 11307
[24/09/2022, 20:30:20] Registering platform 'homebridge-i6-bigassfans.BigAssFans-i6'
[24/09/2022, 20:30:20] [homebridge-i6-bigassfans] Loaded homebridge-i6-bigassfans v0.5.1 child bridge successfully
[24/09/2022, 20:30:20] Loaded 1 cached accessories from cachedAccessories.0E7AF6A6CACB.
[24/09/2022, 20:30:20] [homebridge-i6-bigassfans] Loading accessory from cache: Haiku_Salon
[24/09/2022, 20:30:20] [homebridge-i6-bigassfans] Init - initializing devices
[24/09/2022, 20:30:20] [homebridge-i6-bigassfans] Restoring existing accessory from cache: Haiku_Salon
Error: listen EADDRINUSE: address already in use :::45070
    at Server.setupListenHandle [as _listen2] (node:net:1372:16)
    at listenInCluster (node:net:1420:12)
    at Server.listen (node:net:1508:7)
    at EventedHTTPServer.listen (/var/lib/homebridge/node_modules/homebridge/node_modules/hap-nodejs/src/lib/util/eventedhttp.ts:155:20)
    at HAPServer.listen (/var/lib/homebridge/node_modules/homebridge/node_modules/hap-nodejs/src/lib/HAPServer.ts:332:21)
    at Bridge.<anonymous> (/var/lib/homebridge/node_modules/homebridge/node_modules/hap-nodejs/src/lib/Accessory.ts:1279:18)
    at step (/var/lib/homebridge/node_modules/homebridge/node_modules/tslib/tslib.js:144:27)
    at Object.next (/var/lib/homebridge/node_modules/homebridge/node_modules/tslib/tslib.js:125:57)
    at fulfilled (/var/lib/homebridge/node_modules/homebridge/node_modules/tslib/tslib.js:115:62)
    at processTicksAndRejections (node:internal/process/task_queues:96:5)
[24/09/2022, 20:30:20] [homebridge-i6-bigassfans] Child bridge process ended
[24/09/2022, 20:30:20] [homebridge-i6-bigassfans] Process Ended. Code: 1, Signal: null

[24/09/2022, 20:30:27] [homebridge-i6-bigassfans] Restarting Process...
[24/09/2022, 20:30:30] [homebridge-i6-bigassfans] Launched child bridge with PID 11328
[24/09/2022, 20:30:30] Registering platform 'homebridge-i6-bigassfans.BigAssFans-i6'
[24/09/2022, 20:30:30] [homebridge-i6-bigassfans] Loaded homebridge-i6-bigassfans v0.5.1 child bridge successfully
[24/09/2022, 20:30:30] Loaded 1 cached accessories from cachedAccessories.0E7AF6A6CACB.
[24/09/2022, 20:30:30] [homebridge-i6-bigassfans] Loading accessory from cache: Haiku_Salon
[24/09/2022, 20:30:30] [homebridge-i6-bigassfans] Init - initializing devices
[24/09/2022, 20:30:30] [homebridge-i6-bigassfans] Restoring existing accessory from cache: Haiku_Salon
Error: listen EADDRINUSE: address already in use :::45070
    at Server.setupListenHandle [as _listen2] (node:net:1372:16)
    at listenInCluster (node:net:1420:12)
    at Server.listen (node:net:1508:7)
    at EventedHTTPServer.listen (/var/lib/homebridge/node_modules/homebridge/node_modules/hap-nodejs/src/lib/util/eventedhttp.ts:155:20)
    at HAPServer.listen (/var/lib/homebridge/node_modules/homebridge/node_modules/hap-nodejs/src/lib/HAPServer.ts:332:21)
    at Bridge.<anonymous> (/var/lib/homebridge/node_modules/homebridge/node_modules/hap-nodejs/src/lib/Accessory.ts:1279:18)
    at step (/var/lib/homebridge/node_modules/homebridge/node_modules/tslib/tslib.js:144:27)
    at Object.next (/var/lib/homebridge/node_modules/homebridge/node_modules/tslib/tslib.js:125:57)
    at fulfilled (/var/lib/homebridge/node_modules/homebridge/node_modules/tslib/tslib.js:115:62)
    at processTicksAndRejections (node:internal/process/task_queues:96:5)
[24/09/2022, 20:30:31] [homebridge-i6-bigassfans] Child bridge process ended
[24/09/2022, 20:30:31] [homebridge-i6-bigassfans] Process Ended. Code: 1, Signal: null

Plugin Config:

Note : I have remove the "pin", "ip address" and "mac Address"
{
    "bridge": {
        "name": "Homebridge AADC",
        "username": "0E:95:9B:BC:AA:DC",
        "port": 51808,
        "pin": "",
        "advertiser": "avahi"
    },
    "accessories": [],
    "platforms": [
        {
            "name": "Config",
            "port": 8581,
            "auth": "form",
            "theme": "purple",
            "tempUnits": "c",
            "lang": "auto",
            "sessionTimeout": 57600,
            "platform": "config"
        },
{
            "fans": [
                {
                    "name": "Haiku_Salon",
                    "ip": "",
                    "mac": "",
                    "fanModel": "Haiku H/I Series",
                    "showWhooshSwitch": true,
                    "showFanAutoSwitch": false,
                    "showLightAutoSwitch": false,
                    "showDimToWarmSwitch": false,
                    "showEcoModeSwitch": true
                }
            ],
            "_bridge": {
                "username": "0E:7A:F6:A6:CA:CB",
                "port": 45070
            },
            "platform": "BigAssFans-i6"
        }
    ]
}

Screenshots:

Environment:: Homebridge run on a Raspberry Pi 4B, Raspbian GNU/Linux 11 (bullseye)

oogje commented 2 years ago

How do you add a wall control?

thicla01 commented 2 years ago

I just replaced the name, the IP address and the Mac address. I kept the "fanModel" as "Haiku H/I Series",

thicla01 commented 2 years ago

It's working for the one in the bedroom but not the one in the living room.

thicla01 commented 2 years ago

I have a feeling that It behaves like a relay

oogje commented 2 years ago

Interesting, I didn't know that would work.

I don't think I ever got a look at the log files when you have both fans configured at the same time. Can you add the Haiku Chambre to the config file as an additional fan, before the Haiku Salon entry. All parameters for the two fans the same but ip, mac and name.

kill/restart

And email the config and log output.

thicla01 commented 2 years ago

OK I will do that after dinner

oogje commented 2 years ago

Thanks. After that you can put everything back to the way you want it, kill homebridge and restart it with hb-service and manage it with Homebridge-UI or whatever.

I'm at loss to why the living room fan isn't working with the plugin. I don't think there's any problem with your fan itself and I don't think there's any problem communicating with your fan. But I don't have any ideas left now. I'll give it some thought and reach out to homebridge discord over the next days.

thicla01 commented 2 years ago

Hello oogje,

Email sent with the new configuration file and the log. Thank you very much for your help and your patience.

Let me know if I can help further. In the meantime, I will use plugin version 0.4.3. Both fans are working fine with that version.

oogje commented 2 years ago

I received the email. Thank you.

Hmm... now you remind me that v0.4.3 works, that's a big clue I should follow up on.

And thank you for your patience.

thicla01 commented 2 years ago

One last thing, I installed the version 0.4.3 of the plugins with both Haiku fan. In the log I see that part for the Haiku Chambre

[22/10/2022, 12:42:48] [BigAssFans-i6] Haiku Chambre - light detected

That part is missing for Haiku Salon. But it's possible to control the light even if the light seems to be undected in the log.

The CPU load is at 2%

thicla01 commented 2 years ago

I noticed that because with the plugin version 0.5.x, the light is detected for Haiku Chambre but not for Haiku Salon.

thicla01 commented 2 years ago

In Homebridge.ui "Accessories" section, all the accessories for both fan are created and are working.

oogje commented 2 years ago

Another clue. Thanks.

thicla01 commented 2 years ago

After a restart,

[22/10/2022, 13:42:36] [BigAssFans-i6] Haiku Salon - light detected

oogje commented 2 years ago

Fascinating.

On Oct 22, 2022, at 1:45 PM, thicla01 @.***> wrote:

After a restart,

[22/10/2022, 13:42:36] [BigAssFans-i6] Haiku Salon - light detected

— Reply to this email directly, view it on GitHub https://github.com/oogje/homebridge-i6-bigAssFans/issues/16#issuecomment-1287867735, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAKLWWFTFG5D6YVY764FSK3WEQRZ3ANCNFSM6AAAAAAQU3SURU. You are receiving this because you commented.

thicla01 commented 2 years ago

:)))

After several restart, I have "Haiku Chambre - light detected" but not for Haiku Salon.

But anyway, everything is working fine.

oogje commented 2 years ago

I think I found the problem. Please try homebridge-i6-bigassfans@0.5.2-beta4 at your convenience.

thicla01 commented 2 years ago

Hello oogje,

Good news! [24/10/2022, 16:12:28] [BigAssFans-i6] Haiku Salon - downlight detected [24/10/2022, 16:12:28] [BigAssFans-i6] Haiku Salon - no uplight detected

It's working! Accessories created and I have communication with both fan. It's working also with Home app.

I reconfigured everything from scratch and same results, it's working.

Thank you very much.

By curiosity what was the solution?

oogje commented 2 years ago

That's great. The problem was in parsing the messages from the fan. That functionality is very different between v0.4.x and v0.5.x and in retrospect it was the obvious place I should have immediately looked at. But it was the inconsistent "light detected" messages that got me to focus on that part of the code.

The plugin ignores "scheduling" messages from the fan, but it didn't ignore them properly, leaving extraneous data in the message buffer that I then tried to parse which produced seemingly unpredictable behavior.

Thank for sticking with it.

thicla01 commented 2 years ago

It's was a pleasure to be able to help you. That plugin is really helpful for me :)

Thanks for your great work.