bryan-bartow / homebridge-alarm.com

Alarm.com plugin for Homebridge
ISC License
43 stars 11 forks source link

Issue with locks and garage door integration #42

Closed gsteever closed 6 years ago

gsteever commented 7 years ago

It appears the issue we experienced earlier this week concerning, "WrapAPI Login call failing?", is also affecting my locks and garage door integration with Alarm.com. After launching homebridge I see the following messages. I do not have any lights bound to my Alarm.com account so the first two messages may not hold any relevance. Please let me know if you have any suggestions. It was particularly nice when I would say good night to siri, she would turn off lights, set the alarm, close the garage door and engage all of the locks.

[2/11/2017, 7:22:56 AM] [Security Panel] Request username/alarmdotcom/lights/0.1.1 was unsuccessful:

bryanbartow commented 7 years ago

@gsteever The calls to control the peripheral devices i.e. lights, locks, etc., were created by @yungsters. Looking at them, it doesn't look like any of them use the extra form variables that the login call does. Maybe they should be sending them now? As I don't have any of those devices, I can't test. If you, or anyone else that has these devices, want to try it yourself and see if it works, I can clone your call and update the plugin.

gsteever commented 7 years ago

@bryanbartow, I'd be happy to test them if you don't mind coding it with the extra variables. Just let me know when you have them done and what I need to do anything on my end (ie. update, test via wrap, etc). Thanks!

bryanbartow commented 7 years ago

@gsteever You've got it in the reverse order. Since I don't have these devices, it's something you (or someone else who has them) needs to create and give to me. Once that's done, I can modify my calls and update the plugin. Make sense?

gsteever commented 7 years ago

I'm sorry, I'm not following. Please let me know what you need from me and I'll gladly help. If it involves either creating a new alarm.com account or changing my alarm.com password to give you temporary access, just let me know.

bryanbartow commented 7 years ago

@gsteever I don't feel comfortable using someone else's account. You (or someone who has these devices tied to their account) needs to create new working API calls using WrapAPI. Once that's done, I'll clone the new calls and update the plugin.

gsteever commented 7 years ago

Sorry for the confusion, I'm new to this. I'll try to figure out how to do this and let you know when it is working. Also, just to let you know, overnight the API issue started to happen again. My homebridge is unable to login with alarm.com again. I tried the wrapapi, initlogin and login but getting the same problem we saw last week.

bryanbartow commented 7 years ago

@gsteever Yep. Noticed it just shortly after my last comment. I've updated the calls and plugin. Once you update, you should at least get your alarm functionality back.

livefeed commented 7 years ago

I have updated the plugin and the call key but getting this;

[2/14/2017, 11:15:10 AM] [Security Panel] Request livefeed/alarmdotcom/getviewstate/0.1.2 was unsuccessful:

davidvanvo commented 7 years ago

@livefeed there was a new wrapapi call, getviewstate. you can find the link in the readme.

livefeed commented 7 years ago

Thanks David, I added the new call but now see this;

11:24:32 - [Security Panel] Error while getting lock devices: TypeError: Cannot read property 'map' of undefined 11:24:33 - [Security Panel] Error while getting light devices: TypeError: Cannot read property 'map' of undefined 11:24:33 - [Security Panel] Initializing platform accessory 'Alarm.com Security Panel'...

davidvanvo commented 7 years ago

Personally, I've always had those errors because I do not own any lock or light devices. It should still work with these errors.

livefeed commented 7 years ago

ahhh yeis working - thank you! I now have my garage door (MyQ) in my Alarm.com account should it show up via your plugin? @bryanbartow It would be really nice if the plugin would pull the garage door in as a lock.

bryanbartow commented 7 years ago

@livefeed The general rule is if the device is supported on the Alarm.com mobile site, it can potentially be supported by the plugin. Do you see controls for you garage door when you log in to that site?

livefeed commented 7 years ago

@bryanbartow yes I see it it my account and opens and closes

kpdillon commented 7 years ago

I just wanted to come on here and say thank you for continuing to maintain this and the changes that appear to be breaking this interaction from homebridge lately. This is a really a nice way to operate and automate my alarm system.

livefeed commented 7 years ago

I second that last comment, thank you!

bryanbartow commented 7 years ago

@kpdillon @livefeed You bet. As long as my wife insists on having a home security system and as long as that system uses Alarm.com I'll keep updating the plugin. Glad you like it.

bryanbartow commented 7 years ago

@livefeed I don't have any way to work on that since I don't have a garage door integrated with Alarm.com, but if you want to submit a PR I'll be happy to look at it.

livefeed commented 7 years ago

@bryanbartow sorry new to this, whats a PR?

bryanbartow commented 7 years ago

@livefeed Pull request. I take it you're not a developer ;)

livefeed commented 7 years ago

@bryanbartow aaahhhh no!

If you could tell me how to do it? Would love to have that garage door in HomeKit via alarm.com

jdshkolnik commented 7 years ago

Hi,

I do have locks which show in alarm.com yet I still get "Error while getting lock devices: TypeError: Cannot read property 'map' of undefined". All I'm seeing right now is my security panel correctly showing as off and one of their z-wave light dimmers showing as no response.

bryanbartow commented 7 years ago

@jdshkolnik As previously stated, I only have an alarm.com panel. I don't have any other peripheral devices. I can't work on those calls. @yungsters originally created them using his devices. If someone who has them wants to submit PR to fix/update the associated calls, I'll be happy to merge them in.

jdshkolnik commented 7 years ago

I saw the Chrome plugin for WrapAPI but how exactly are you capturing these calls?

gsteever commented 7 years ago

@bryanbartow, I just created a pull request although I'm not sure if I did it correctly. I also grabbed what I could which you can find attached to this message.

https://github.com/bryanbartow/homebridge-alarm.com/pull/46/files

yungsters.txt

bryanbartow commented 7 years ago

@jdshkolnik Read the docs.

bryanbartow commented 7 years ago

@gsteever I closed the pull request because it would revert the plugin to a previous state and didn't include any new code which could fix the current issue(s) you are facing.

gsteever commented 7 years ago

No problem, I figured what I had attempted earlier wasn't going to help much. As I mentioned previously, I'm happy to assist with the troubleshooting as I have both a garage door and locks integrated with my Alarm.com account. Although I am not a developer, my degree was in computer science and I still have technical ability. If you can point me in the right direction, by either suggesting resources such as using the wrapapi plug-in or a hybrid approach, I'd like to assist getting this resolved since @yungsters doesn't appear to be active or responsive to what is happening right now. Thanks again for all that you do...this community appreciates all of your efforts!

bryanbartow commented 7 years ago

@gsteever There are two areas you can work on to try and solve the issue(s):

  1. Read the WrapAPI docs and look at the existing calls to see how they work. Then, use the WrapAPI plugin to create working calls for your accessories. Once that's done, compare your calls to the existing calls and determine how the existing calls need to be modified in order to work.
  2. Read the home bridge docs and learn how to run homebridge in debug mode with local plugins. Then, use git to clone or fork this repository and test any changes you make using a local copy of the plugin. Once you've determined everything is working, submit a PR with your modified code and I can merge it into mine.

It may turn out that there are no changes necessary to the plugin itself and only modification to the WrapAPI calls are necessary. If that's the case, just let me know when you have working calls and I'll modify the existing calls to match yours. Make sense?

gsteever commented 7 years ago

Yes, this makes sense. I'll try to dig into it over the weekend. There will be a learning curve and an efficiency delay so please be patient with me. Thanks!

livefeed commented 7 years ago

@gsteever @bryanbartow thank you both for working on this, fingers crossed!

jdshkolnik commented 7 years ago

I updated to latest npm package and added the new accessories section but still get "Error while getting lock devices: TypeError: Cannot read property 'map' of undefined"

bryanbartow commented 7 years ago

@jdshkolnik Those calls still have not been updated. Whatever issue(s) existed before will still exist. The new version just allows you to conditionally load the individual accessories.

jdshkolnik commented 7 years ago

@bryanbartow How is the conditional loading accomplished? You mean during active development, like in a debug mode?

bryanbartow commented 7 years ago

@jdshkolnik I'm not sure if I follow your question. The accessories object in the config contains three booleans each one representing one of the accessory types. The plugin will attempt to load each accessory type if the corresponding boolean in the config is set to true.

jdshkolnik commented 7 years ago

I understand now. You're saying the attempt will now be made but the API calls themselves are still not working.

bryanbartow commented 7 years ago

@jdshkolnik Yep.

btotharye commented 7 years ago

Were you ever able to fix this? I'm getting this same error on a new setup and I'm wanting to get the locks working. I have the locks and the API appears to be right from what I can see but it appears to be hitting on this line in the code:

getLockAccessories() { return this.api.login() .then(session => session.send('locks/0.1.1')) .then(json => json.data.locks.map( lock => new ADCLockAccessory(this, lock) )) .catch(error => { this.log('Error while getting lock devices: %s', error); return []; }); }

[3/16/2017, 9:19:01 PM] Loading 1 platforms... [3/16/2017, 9:19:01 PM] [Security Panel] Initializing Alarmdotcom platform... [3/16/2017, 9:19:05 PM] [Security Panel] Error while getting lock devices: TypeError: Cannot read property 'map' of undefined [3/16/2017, 9:19:05 PM] [Security Panel] Initializing platform accessory 'Alarm.com Security Panel'...

Let me know what you need help with to fix this, I'm going to work on the code and see if I can get this working.

Thanks

bryanbartow commented 7 years ago

@btotharye Not sure if your question was directed at me or not, but I don't have locks in my Alarm.com account, so I don't have any way of testing this. If you or someone else with locks can get it working and submit a PR, I will merge it in.

livefeed commented 7 years ago

I would just like my garage door that's in alarm.com to port over via this.

andrewmattie commented 7 years ago

I've taken a look at the WrapAPI calls for the locks and found the form selector needed to up updated. I've created a PR (#54) with the modified url.

bryanbartow commented 7 years ago

I've merged @andrewmattie PR. It requires one to delete their existing /locks call and replace it with his. I have not noticed any issues with my system, but I don't have locks, so I can only verify that it doesn't interfere with the core alarm functionality.

jdshkolnik commented 6 years ago

I'll look at this when I have a chance. I don't have a garage so I'll spin the locks out as a separate enhancement before starting.

livefeed commented 6 years ago

Great thank you!

wdbrady commented 6 years ago

I can confirm the new WrapAPI URL works for locks.

jdshkolnik commented 6 years ago

@wdbrady Just to be clear, you're saying this issue can be closed, right?

wdbrady commented 6 years ago

Using the @andredmattie link on WrapAPI works for locks. I would recommend updating the link on NPM, but this can be closed in my opinion.

NeTechcom commented 6 years ago

Hi iv added a nutone nws15z light switch to my iq panel 2 and it's working fine on the panel but it doesn't come up on alarm.com.