tagyoureit / homebridge-luxor

Homebridge plugin for Luxor FX lights
6 stars 6 forks source link

Plugin crash on GetGroupList() #4

Closed fmeppo closed 4 years ago

fmeppo commented 5 years ago

When I start home bridge after configuring this plugin, I get the error below. Other home kit plugins work, but the luxor one gives no joy.

Feb 23 16:09:52 myhome homebridge[745]: [2019-2-23 16:09:52] [Luxor] Error in di dFinishLaunching TypeError: Cannot read property 'GroupListGet' of undefined Feb 23 16:09:52 myhome homebridge[745]: at LuxorPlatform.getControllerGroupL ist (/usr/lib/node_modules/homebridge-luxor/index.js:120:21) Feb 23 16:09:52 myhome homebridge[745]: at /usr/lib/node_modules/homebridge- luxor/index.js:427:19 Feb 23 16:09:52 myhome homebridge[745]: at tryCatcher (/usr/lib/node_modules /homebridge-luxor/node_modules/bluebird/js/release/util.js:16:23) Feb 23 16:09:52 myhome homebridge[745]: at Promise._settlePromiseFromHandler (/usr/lib/node_modules/homebridge-luxor/node_modules/bluebird/js/release/promis e.js:512:31) Feb 23 16:09:52 myhome homebridge[745]: at Promise._settlePromise (/usr/lib/ node_modules/homebridge-luxor/node_modules/bluebird/js/release/promise.js:569:18 ) Feb 23 16:09:52 myhome homebridge[745]: at Promise._settlePromise0 (/usr/lib /node_modules/homebridge-luxor/node_modules/bluebird/js/release/promise.js:614:1 0)

fmeppo commented 5 years ago

Looks like my luxor unit is just undefined - it's a lxtwo instead of a lxzdc. Makes sense; it appears to be a newer hardware revision. Unfortunately, that causes the if/elseif in getController to not initialize the controller. Working up a patch.

There's also a bug around accessory definition. Should have that isolated soon.

tagyoureit commented 5 years ago

Hi, thanks for looking into this. I don't have the new hardware so appreciate your efforts here.

tagyoureit commented 5 years ago

Just curious if you were able to get this working? I have other users who are also interested in this but I don't have the right hardware/API calls currently.

fmeppo commented 5 years ago

Sorta. Getting the controller working was pretty trivial, and the Luxor-programmed scenes work the same as in the original Luxor ZDC unit, but lights appear to be a little different. I got them to detect, but the homekit switches don't actually manipulate the lights.

I'll see if I can clean that up and start feeding you diffs. Got a bit side-tracked with a large number of landscaping projects. :-)

tagyoureit commented 5 years ago

I got back in touch with Pentair and they sent me the updated API calls. However, they say it really didn't change. I need to find some time to dig into this, too.

fmeppo commented 5 years ago

I forked the project last night and pushed a few diffs up. There’s one of substance; I suspect a lot of the issues stem from things just being incorrectly detected on the new product ID. Should have this in a bit better place soon - but if you could forward the docs from Pentair my way, I’d appreciate it.

Sent from my iPhone

On May 6, 2019, at 4:35 PM, tagyoureit notifications@github.com wrote:

I got back in touch with Pentair and they sent me the updated API calls. However, they say it really didn't change. I need to find some time to dig into this, too.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or mute the thread.

tagyoureit commented 5 years ago

Unfortunately (and perplexingly) Hunter made me sign an NDA in order for them to provide me the docs so I can't just send them to you. They did give me permission to publish out the Homekit code (and/or other integrations) with the API's but I just can't blanket share the document they provided.

fmeppo commented 5 years ago

Unfortunate, but understandable.

In unrelated news, I noticed I can set my ZDC lights to identify as ZD lights. That’ll help with testing - could you do this on original ZDC gear?

Sent from my iPhone

On May 7, 2019, at 7:12 AM, tagyoureit notifications@github.com wrote:

Unfortunately (and perplexingly) Hunter made me sign an NDA in order for them to provide me the docs so I can't just send them to you. They did give me permission to publish out the Homekit code (and/or other integrations) with the API's but I just can't blanket share the document they provided.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or mute the thread.

tagyoureit commented 5 years ago

I just pushed up a LXTWO branch. It has the basic changes for the lxtwo. Can you pull it down and try it? I have two items in the Readme which I might need to address but let's see how far this gets us.

fmeppo commented 5 years ago

Had a chance to try your branch. Unfortunately, it doesn't work - it complains that the ZDTWO module isn't found. I don't think you've defined a class for luxorZDTWOController. Poking around a bit, I think your LXTWO diff was landed in the master branch, not the LXTWO branch. The LXTWO branch just has some doc changes, I think.

I just sent along a pull request for the set of changes that've been working for me for a while. These are based off master from a commit or two ago - but it'll get the lxtwo initialized, and various theme-based buttons (and illuminate/exterminate all) work. I've been having issues with controlling individual light groups; setting colors doesn't yet work. I think it's something related to a missing endpoint on the Luxor device, but I haven't had enough time to set up a span port and dig into it.

If you're interested, I can help sort merge conflicts in that pull request, or rebase on top of the current master.

-- Mike Shuey

On Wed, May 22, 2019 at 12:13 PM tagyoureit notifications@github.com wrote:

I just pushed up a LXTWO branch https://github.com/tagyoureit/homebridge-luxor/tree/LXTWO. It has the basic changes for the lxtwo. Can you pull it down and try it? I have two items in the Readme which I might need to address but let's see how far this gets us.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/tagyoureit/homebridge-luxor/issues/4?email_source=notifications&email_token=ADITDE3OR33NC4Z3R3GKRVTPWWLMLA5CNFSM4GZY67P2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGODWAASVA#issuecomment-494930260, or mute the thread https://github.com/notifications/unsubscribe-auth/ADITDEZYKJPAK5BWPWQZNDDPWWLMLANCNFSM4GZY67PQ .

tagyoureit commented 5 years ago

Thanks for the changes in the PR. I'm not quite sure what happened with my last push, but I just incorporated all of your changes and the LXTWO branch. I also went through each API call and noted where there are differences. There are really only a few and the biggest are the color wheel (251-260) and DMX control (65535) in the GroupListGet API. Please check it out and let me know how it works.

rlr3000 commented 5 years ago

Not working for me. It finds the controller, but not able to connect:

[5/29/2019, 11:15:59 PM] [Luxor] Found Controller named lxtwo-23309 of type ZDTWO [5/29/2019, 11:15:59 PM] [Luxor] Luxor was not able to connect to connect to the controller. TypeError: Cannot read property 'type' of undefined

LuxorZD2 Error.txt

tagyoureit commented 5 years ago

Try it again now. Had an error that I just fixed.

rlr3000 commented 5 years ago

Progress, but now getting an error "was not able to retrieve light groups from controller".

[5/30/2019, 12:03:35 PM] [Luxor] Found Controller named lxtwo-23309 of type ZDTWO [5/30/2019, 12:03:35 PM] [Luxor] ZDTWO Controller @ IP 10.0.1.15 initialized. [5/30/2019, 12:03:35 PM] [Luxor] ZD Accessory Pathlights: initializing cached ZD light Pathlights [5/30/2019, 12:03:35 PM] [Luxor] ZDC Accessory Maple Uplights: initializing cached ZDC light Maple Uplights [5/30/2019, 12:03:35 PM] [Luxor] ZDC Accessory West side Uplight: initializing cached ZDC light West side Uplight [5/30/2019, 12:03:35 PM] [Luxor] ZDC Accessory West Porch Uplight: initializing cached ZDC light West Porch Uplight [5/30/2019, 12:03:35 PM] [Luxor] ZDC Accessory East Porch Uplight: initializing cached ZDC light East Porch Uplight [5/30/2019, 12:03:35 PM] [Luxor] ZDC Accessory East side Uplight: initializing cached ZDC light East side Uplight [5/30/2019, 12:03:35 PM] [Luxor] ZD Accessory Post Lamp: initializing cached ZD light Post Lamp [5/30/2019, 12:03:35 PM] [Luxor] was not able to retrieve light groups from controller. { RequestError: Error: connect ECONNREFUSED 10.0.1.15:80

LuxorZD2 Error 2.txt

tagyoureit commented 5 years ago

Connection refused is a networking error. Can you reach http://10.0.1.15 from the computer where homebridge is running? There should be a primitive webpage.

You can also run curl -d '' 10.1.1.15 and you should get back {"Status":1} if the connection is successful.

rlr3000 commented 5 years ago

I do get {"Status":1} when running that command. I can also view the primitive webpage at the address.

Screen Shot 2019-05-30 at 1 48 47 PM

tagyoureit commented 5 years ago

Ah, ok. I took the error message from the PR. I just changed it. Can you try again.

rlr3000 commented 5 years ago

Still getting an error...

[5/30/2019, 2:22:20 PM] [Luxor] was not able to retrieve light groups from controller. RequestError: Error: connect ECONNREFUSED 10.0.1.15:80 undefined

LuxorZD2 Error 3.txt

tagyoureit commented 5 years ago

I just added 2 more debug statements. Can you try again?

rlr3000 commented 5 years ago

Still getting an error, although the log looks different...

LuxorZD2 Error 4.txt

tagyoureit commented 5 years ago

Let's backup a step... I just added a test file to the repo. Can you run node grouplistget.js? This works on my LXZDC. It should work the same on your LXTWO.

Only thing I see in the latest logs is that the app is sending 4 requests. Maybe they are being blocked because they are running simultaneously.

Try this file and let me know what you get back.

rlr3000 commented 5 years ago

Perhaps I'm doing something wrong, but when I run "node grouplistget.js", I get:

module.js:472 throw err; ^

Error: Cannot find module '/Users/***/grouplistget.js' at Function.Module._resolveFilename (module.js:470:15) at Function.Module._load (module.js:418:25) at Module.runMain (module.js:605:10) at run (bootstrap_node.js:420:7) at startup (bootstrap_node.js:139:9) at bootstrap_node.js:535:3

tagyoureit commented 5 years ago

If you pull the latest release it should be in the root of the homebridge-luxor. Is the file there?

Here is a link to the file in Github.

rlr3000 commented 5 years ago

It wasn't there, but I manually downloaded and placed it in there. Now when I run "node grouplistget.js", I get the following (but I still get the error when launching home bridge):

trying to connect to: {"url":"http://10.0.1.15/GroupListGet.json","method":"POST"} retrieved info object: { "Status": 0, "GroupList": [ { "Name": "Pathlights", "Grp": 1, "Inten": 40, "Colr": 0 }, { "Name": "Maple Uplights", "Grp": 2, "Inten": 75, "Colr": 249 }, { "Name": "West side Uplight", "Grp": 3, "Inten": 45, "Colr": 1 }, { "Name": "West Porch Uplight", "Grp": 4, "Inten": 60, "Colr": 1 }, { "Name": "East Porch Uplight", "Grp": 5, "Inten": 60, "Colr": 246 }, { "Name": "East side Uplight", "Grp": 6, "Inten": 45, "Colr": 1 }, { "Name": "Post Lamp", "Grp": 7, "Inten": 16, "Colr": 0 } ] } requestTime: 44.586ms

tagyoureit commented 5 years ago

That's good progress. If this file wasn't in your local directory it means you have not been getting all of the changes that I've been uploading. Can you make sure that you have all of the latest files?. You might want to try deleting the directory and re download. Because I am not increasing the version number npm might not be grabbing the latest unless you force it.

rlr3000 commented 5 years ago

Sorry, I was a bit confused before because I was looking under: [Users/"my account"/node_modules/homebridge-luxor] and didn't see it there.

I'm now looking at: [usr/local/lib/node_modules/homebridge-luxor] and do see it there.

In any case, I deleted the homebridge-luxor folder in the usr directory, and reinstalled the luxor plugin. I now see all the files there, including grouplistget.js.

However, running homebridge, I still get an error. See attached txt file for details.

LuxorZD2 Error 5.txt

tagyoureit commented 5 years ago

Grab the latest. Only thing I can think of since you are getting results from a single request is that the controller is being flooded (or has some type of DoS for multiple requests).

In this version, I put in caching for groupListGet. In previous versions it would make a request for each light. In this version, I cache the results for 5 seconds so any subsequent requests will just get the short term cached results.

rlr3000 commented 5 years ago

Still getting an error...

LuxorZD2 Error 6.txt

rlr3000 commented 5 years ago

Although there is maybe some improvement. Previously after running homebridge my home app would recognize the lights (but get no response), now it will recognize the lights and themes (but still gets no response).

tagyoureit commented 5 years ago

You are right that this is an improvement. The error is no longer with groupListGet but now with colorListGet. I think that means that my assumption about the controller blocking multiple requests is correct.

Grab the latest. I added the same caching mechanism to the latter "get" commands.

rlr3000 commented 5 years ago

Still getting an error, however it is now working (somewhat) within the home app - that is, I can see light groups and turn them on and off within the home app. However, themes are no longer recognized.

LuxorZD2 Error 7.txt

rlr3000 commented 5 years ago

Interestingly, I'm no longer getting the error and everything seems to be working well - light groups and themes all functioning. Not sure why there was an issue before. Nice work!

rlr3000 commented 5 years ago

Well... now, after a reboot, the error recurred and the themes disappeared. So maybe it's not entirely fixed.

tagyoureit commented 5 years ago

Well... clearly you shouldn't be rebooting. ;-) But seriously, send the logs again. Could be hitting something else that wasn't accounted for yet.

rlr3000 commented 5 years ago

Hey - sorry for my delay.

So it seems like whenever I do a reboot, I get an error (LuxorZD2 Error 8a.txt) and the themes disappear from the home app.

Then, if I then quit homebridge, and then restart homebridge, I still get a new error (LuxorZD2 Error 8b.txt), but now the themes re-populate and it works fine.

LuxorZD2 Error 8a.txt LuxorZD2 Error 8b.txt

daveman918 commented 4 years ago

I have a Lux 300 and also get this error. Is there a plan to support the newer controllers. Happy to provide more specifics.

tagyoureit commented 4 years ago

I've been trying to get this to work for a while and without access to a newer device it has been tricky to track down. I'm happy to look at it again with you if you want to provide more details.

tagyoureit commented 4 years ago

I found someone local to me that has a newer Luxor and will try to get access to their system over the holidays. Hopefully early Jan I can put this to rest.

tagyoureit commented 4 years ago

Thanks for being patient. Can you pull the latest LXWO branch and try again?

tagyoureit commented 4 years ago

I believe this is now fixed. Please re-open if you still have issues.