homebridge-modern-forms icon indicating copy to clipboard operation
homebridge-modern-forms copied to clipboard

Expected a string as the second argument

Open anon1y4012 opened this issue 4 years ago • 8 comments

Hi, when I try to run homebridge with the plugin installed I'm hitting the following error.

[8/28/2020, 10:10:47 PM] TypeError: Expected a string as the second argument at Object.module.exports [as default] (/usr/local/lib/node_modules/homebridge-modern-forms/node_modules/network-calculator/index.js:12:11) at MapSubscriber.project (/usr/local/lib/node_modules/homebridge-modern-forms/dist/platform.js:42:310) at MapSubscriber._next (/usr/local/lib/node_modules/homebridge-modern-forms/node_modules/rxjs/internal/operators/map.js:49:35) at MapSubscriber.Subscriber.next (/usr/local/lib/node_modules/homebridge-modern-forms/node_modules/rxjs/internal/Subscriber.js:66:18) at TapSubscriber._next (/usr/local/lib/node_modules/homebridge-modern-forms/node_modules/rxjs/internal/operators/tap.js:65:26) at TapSubscriber.Subscriber.next (/usr/local/lib/node_modules/homebridge-modern-forms/node_modules/rxjs/internal/Subscriber.js:66:18) at MergeMapSubscriber.notifyNext (/usr/local/lib/node_modules/homebridge-modern-forms/node_modules/rxjs/internal/operators/mergeMap.js:93:26) at SimpleInnerSubscriber._next (/usr/local/lib/node_modules/homebridge-modern-forms/node_modules/rxjs/internal/innerSubscribe.js:27:21) at SimpleInnerSubscriber.Subscriber.next (/usr/local/lib/node_modules/homebridge-modern-forms/node_modules/rxjs/internal/Subscriber.js:66:18) at AsyncSubject.Subject.next (/usr/local/lib/node_modules/homebridge-modern-forms/node_modules/rxjs/internal/Subject.js:60:25) at AsyncSubject.complete (/usr/local/lib/node_modules/homebridge-modern-forms/node_modules/rxjs/internal/AsyncSubject.js:53:35) at handler (/usr/local/lib/node_modules/homebridge-modern-forms/node_modules/rxjs/internal/observable/bindNodeCallback.js:53:33) at /usr/local/lib/node_modules/homebridge-modern-forms/node_modules/network/lib/index.js:109:11 at /usr/local/lib/node_modules/homebridge-modern-forms/node_modules/network/lib/linux.js:10:7 at ChildProcess.exithandler (child_process.js:294:7) at ChildProcess.emit (events.js:315:20) at maybeClose (internal/child_process.js:1021:16) at Socket. (internal/child_process.js:443:11) at Socket.emit (events.js:315:20) at Pipe. (net.js:674:12)

It actually logs the error twice, with the same timestamp.

Homebridge then crashes. The config looks like this

...... { "platform": "ModernForms" }, .....

Any thoughts?

anon1y4012 avatar Aug 29 '20 03:08 anon1y4012

Hey thanks for reporting! I'm taking a look into it now and will report back.

nickbreaton avatar Aug 30 '20 01:08 nickbreaton

@john2691 I think there may be a problem with the auto discovery feature of the plugin. This has turned out to be a bit more challenging than originally anticipated, but as long as you know the IP address of your fan(s), you can skip that entirely by specifying the following:

{
    "platform": "ModernForms",
    "autoDiscover": false,
    "fans": [
        {
            "ip": "YOUR FANS IP ADDRESS"
        }
    ]
}

That should hopefully get things working for you, but it would be great to understand what's causing this in the first place. Would you mind sharing what platform you're running on (Mac, Linux, Windows, HOOBS device), and if you are running in a Docker container?

nickbreaton avatar Aug 30 '20 01:08 nickbreaton

I've also pushed an update, 1.0.6, that should prevent the crash from happening. The issue is I can't seem to determine some network details to make a guess at the range of IP addresses your fan's may be in. I've now provided fallbacks for those missing details, but those fallbacks may align with how your network is configured.

nickbreaton avatar Aug 30 '20 01:08 nickbreaton

Ok, so I've updated to 1.0.6 and get a different error, with and without the manual IP address of the fan in the config file.

I'll also note that the fan is on the same subnet of the machine running Homebridge, which is a Raspberry Pi 3B+ running Buster.

[8/29/2020, 8:39:32 PM] Error: spawn arp ENOENT at Process.ChildProcess._handle.onexit (internal/child_process.js:267:19) at onErrorNT (internal/child_process.js:469:16) at processTicksAndRejections (internal/process/task_queues.js:84:21)

Thanks for the fast response, let me know what else you need!

anon1y4012 avatar Aug 30 '20 01:08 anon1y4012

@john2691 Okay that's a bummer, will try to reproduce with Buster but might take a little longer 😄.

Did you also add "autoDiscover": false, to the config?

nickbreaton avatar Aug 30 '20 01:08 nickbreaton

Just added it, problem solved. Working great now, thanks!

For anyone with this bug in the immediate future, my config looks like this.

{ "platform": "ModernForms", "autoDiscover": false, "fans": [ { "ip": "192.168.X.XX" } ] },

anon1y4012 avatar Aug 30 '20 01:08 anon1y4012

@john2691 Great! Would be super helpful if you could test the auto discovery for me in the future when I push a fix. I'll leave the issue open for now.

nickbreaton avatar Aug 30 '20 01:08 nickbreaton

Just let me know!

anon1y4012 avatar Aug 30 '20 01:08 anon1y4012