ztalbot2000 / homebridge-cmd4

CMD4 Plugin for Homebridge - Supports ~All Accessory Types & now all Characteristics too
Apache License 2.0
145 stars 14 forks source link

[Bug] #111

Closed machineglow closed 2 years ago

machineglow commented 2 years ago

Describe The Bug: homebridge dies with v4.2.0

To Reproduce: on startup, CMD4 throws an error and causes a homebridge bootloop

Expected Behaviour: expect homebridge to keep running

Paste of Logs:

Jul 24 18:18:55  homebridge[108748]: [7/24/2021, 6:18:55 PM] TypeError: qCallback is not a function
Jul 24 18:18:55 homebridge[108748]:     at ChildProcess.<anonymous> (/usr/local/lib/node_modules/homebridge-cmd4/Cmd4Accessory.js:997:27)
Jul 24 18:18:55 homebridge[108748]:     at ChildProcess.emit (events.js:327:22)
Jul 24 18:18:55 homebridge[108748]:     at maybeClose (internal/child_process.js:1048:16)
Jul 24 18:18:55 homebridge[108748]:     at Socket.<anonymous> (internal/child_process.js:439:11)
Jul 24 18:18:55 homebridge[108748]:     at Socket.emit (events.js:315:20)
Jul 24 18:18:55 homebridge[108748]:     at Pipe.<anonymous> (net.js:673:12)
Jul 24 18:18:55 homebridge[108748]: [7/24/2021, 6:18:55 PM] TypeError: qCallback is not a function
Jul 24 18:18:55 homebridge[108748]:     at ChildProcess.<anonymous> (/usr/local/lib/node_modules/homebridge-cmd4/Cmd4Accessory.js:997:27)
Jul 24 18:18:55 homebridge[108748]:     at ChildProcess.emit (events.js:327:22)
Jul 24 18:18:55 homebridge[108748]:     at maybeClose (internal/child_process.js:1048:16)
Jul 24 18:18:55 homebridge[108748]:     at Socket.<anonymous> (internal/child_process.js:439:11)
Jul 24 18:18:55 homebridge[108748]:     at Socket.emit (events.js:315:20)
Jul 24 18:18:55 homebridge[108748]:     at Pipe.<anonymous> (net.js:673:12)
Jul 24 18:18:55 homebridge[108748]: [7/24/2021, 6:18:55 PM] TypeError: qCallback is not a function
Jul 24 18:18:55 homebridge[108748]:     at ChildProcess.<anonymous> (/usr/local/lib/node_modules/homebridge-cmd4/Cmd4Accessory.js:997:27)
Jul 24 18:18:55 homebridge[108748]:     at ChildProcess.emit (events.js:327:22)
Jul 24 18:18:55 homebridge[108748]:     at maybeClose (internal/child_process.js:1048:16)
Jul 24 18:18:55 homebridge[108748]:     at Socket.<anonymous> (internal/child_process.js:439:11)
Jul 24 18:18:55 homebridge[108748]:     at Socket.emit (events.js:315:20)
Jul 24 18:18:55 homebridge[108748]:     at Pipe.<anonymous> (net.js:673:12)
Jul 24 18:18:55 homebridge[108748]: [7/24/2021, 6:18:55 PM] Got SIGTERM, shutting down Homebridge...
Jul 24 18:18:55 homebridge[108748]: [7/24/2021, 6:18:55 PM] [Harmony] INFO - shutdown
Jul 24 18:18:55 homebridge[108748]: [7/24/2021, 6:18:55 PM] [Aedes MQTT] Stopping Aedes MQTT broker "Aedes MQTT".
Jul 24 18:18:55 homebridge[108748]: [7/24/2021, 6:18:55 PM] TypeError: qCallback is not a function
Jul 24 18:18:55 homebridge[108748]:     at ChildProcess.<anonymous> (/usr/local/lib/node_modules/homebridge-cmd4/Cmd4Accessory.js:997:27)
Jul 24 18:18:55 homebridge[108748]:     at ChildProcess.emit (events.js:327:22)
Jul 24 18:18:55 homebridge[108748]:     at maybeClose (internal/child_process.js:1048:16)
Jul 24 18:18:55 homebridge[108748]:     at Socket.<anonymous> (internal/child_process.js:439:11)
Jul 24 18:18:55 homebridge[108748]:     at Socket.emit (events.js:315:20)
Jul 24 18:18:55 homebridge[108748]:     at Pipe.<anonymous> (net.js:673:12)

Cmd4 Config:

        {
            "platform": "Cmd4",
            "name": "Cmd4",
            "allowTLV8": false,
            "outputConstants": false,
            "restartRecover": true,
            "fetch": "Polled",
            "accessories": [
                {
                    "type": "Switch",
                    "displayName": "Playroom AirPlaying",
                    "on": "FALSE",
                    "name": "Playroom AirPlaying",
                    "Manufacturer": "Apple Inc.",
                    "Model": "AirPort10,115",
                    "SerialNumber": "C86NQKFFFFFF",
                    "polling": true,
                    "interval": 10,
                    "timeout": 10000,
                    "state_cmd_prefix": "bash",
                    "state_cmd": "/var/homebridge/Cmd4Scripts/LivingRoomAirplayState.sh"
                },
                {
                    "type": "Switch",
                    "displayName": "Master Bedroom AirPlaying",
                    "on": "FALSE",
                    "name": "Master Bedroom AirPlaying",
                    "Manufacturer": "Apple Inc.",
                    "Model": "AirPort10,115",
                    "SerialNumber": "C86NQKFFFFFF",
                    "polling": true,
                    "interval": 10,
                    "timeout": 10000,
                    "state_cmd_prefix": "bash",
                    "state_cmd": "/var/homebridge/Cmd4Scripts/MasterBedroomAirplayState.sh",
                    "state_cmd_suffix": ""
                },
                {
                    "type": "Switch",
                    "displayName": "Kitchen AirPlaying",
                    "on": "FALSE",
                    "name": "Kitchen AirPlaying",
                    "Manufacturer": "Apple Inc.",
                    "Model": "AirPort10,115",
                    "SerialNumber": "C86NQKFFFFFF",
                    "polling": true,
                    "interval": 10,
                    "timeout": 10000,
                    "state_cmd_prefix": "bash",
                    "state_cmd": "/var/homebridge/Cmd4Scripts/KitchenAirplayState.sh",
                    "state_cmd_suffix": ""
                },
                {
                    "type": "Switch",
                    "displayName": "Family Room AirPlaying",
                    "on": "FALSE",
                    "name": "Family Room AirPlaying",
                    "Manufacturer": "Apple Inc.",
                    "Model": "AirPort10,115",
                    "SerialNumber": "C86NQKFFFFFF",
                    "polling": true,
                    "interval": 20,
                    "timeout": 10000,
                    "state_cmd_prefix": "bash",
                    "state_cmd": "/var/homebridge/Cmd4Scripts/FamilyRoomAirplayState.sh",
                    "state_cmd_suffix": ""
                }
            ]
        },

Environment:

ztalbot2000 commented 2 years ago

Hi,

Nasty. I'll look into it.

John

On Sat, Jul 24, 2021 at 7:02 PM machineglow @.***> wrote:

Assigned #111 https://github.com/ztalbot2000/homebridge-cmd4/issues/111 to @ztalbot2000 https://github.com/ztalbot2000.

— You are receiving this because you were assigned. Reply to this email directly, view it on GitHub https://github.com/ztalbot2000/homebridge-cmd4/issues/111#event-5064445120, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABSBCX4DOODTVNJ4N7N6FTDTZNA7LANCNFSM5A545KHA .

ztalbot2000 commented 2 years ago

Hi,

Weird, I essentially have the same environment. Can you please do me a favor and on the offending line change it to:

If (qCallback != null)

Thanks, John

On Sat, Jul 24, 2021 at 7:13 PM John Talbot @.***> wrote:

Hi,

Nasty. I'll look into it.

John

On Sat, Jul 24, 2021 at 7:02 PM machineglow @.***> wrote:

Assigned #111 https://github.com/ztalbot2000/homebridge-cmd4/issues/111 to @ztalbot2000 https://github.com/ztalbot2000.

— You are receiving this because you were assigned. Reply to this email directly, view it on GitHub https://github.com/ztalbot2000/homebridge-cmd4/issues/111#event-5064445120, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABSBCX4DOODTVNJ4N7N6FTDTZNA7LANCNFSM5A545KHA .

machineglow commented 2 years ago

Sure. I reverted back to 4.0.1 for now but will switch back and do the code change later tonight.

Hi,

Weird, I essentially have the same environment. Can you please do me a favor and on the offending line change it to:

If (qCallback != null)

Thanks, John

On Sat, Jul 24, 2021 at 7:13 PM John Talbot @.***> wrote:

Hi,

Nasty. I'll look into it.

John

On Sat, Jul 24, 2021 at 7:02 PM machineglow @.***> wrote:

Assigned #111 https://github.com/ztalbot2000/homebridge-cmd4/issues/111 to @ztalbot2000 https://github.com/ztalbot2000.

— You are receiving this because you were assigned. Reply to this email directly, view it on GitHub https://github.com/ztalbot2000/homebridge-cmd4/issues/111#event-5064445120, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABSBCX4DOODTVNJ4N7N6FTDTZNA7LANCNFSM5A545KHA .

ztalbot2000 commented 2 years ago

I was able to replicate it using your config. I will fix it ASAP. Though I do not know why it fails yet.

Ttyl, John

On Sat, Jul 24, 2021 at 7:50 PM machineglow @.***> wrote:

Sure. I reverted back to 4.0.1 for now but will switch back and do the code change later tonight.

Hi,

Weird, I essentially have the same environment. Can you please do me a favor and on the offending line change it to:

If (qCallback != null)

Thanks, John

On Sat, Jul 24, 2021 at 7:13 PM John Talbot @.***> wrote:

Hi,

Nasty. I'll look into it.

John

On Sat, Jul 24, 2021 at 7:02 PM machineglow @.***> wrote:

Assigned #111 https://github.com/ztalbot2000/homebridge-cmd4/issues/111

111 https://github.com/ztalbot2000/homebridge-cmd4/issues/111

to @ztalbot2000 https://github.com/ztalbot2000 https://github.com/ztalbot2000.

— You are receiving this because you were assigned. Reply to this email directly, view it on GitHub

111 (comment)

https://github.com/ztalbot2000/homebridge-cmd4/issues/111#event-5064445120 , or unsubscribe

https://github.com/notifications/unsubscribe-auth/ABSBCX4DOODTVNJ4N7N6FTDTZNA7LANCNFSM5A545KHA .

— You are receiving this because you were mentioned.

Reply to this email directly, view it on GitHub https://github.com/ztalbot2000/homebridge-cmd4/issues/111#issuecomment-886124794, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABSBCX6GNB7BWC3CH5ODFRLTZNGTVANCNFSM5A545KHA .

ztalbot2000 commented 2 years ago

Hi,

Not that I like the way I had to fix this, but it will work in a pinch. Resolved in 4.2.1.

Sorry for the inconvenience. I will look at why my Unit tests did not pick this up.

Take care, John Talbot