node-alarm-dot-com / homebridge-node-alarm-dot-com

Alarm.com plugin for Homebridge using Node.js
MIT License
58 stars 23 forks source link

Lights require 2 commands to turn on #49

Closed Stugatza closed 3 years ago

Stugatza commented 3 years ago

Lights require me to turn them on 2x, before they come on. Turning off works consistent.

ngori commented 3 years ago

@Stugatza Are you using a hardware lighting device (like a jasco zwave) or a cloud integration (lutron)?

Stugatza commented 3 years ago

Zwave devices integrated directly to my Qolsys Alarm.com panel

ngori commented 3 years ago

I have one zwave lighting device also connected to a my Qolsys panel. I don't t use the lightning functionality (only a z wave range extender to reach my garage) but I can't get mine to turn on at all. I can turn it off though.

Stugatza commented 3 years ago

likely not the best way to fix this, but i modified index.js (/usr/local/lib/node_modules/homebridge-node-alarm-dot-com)

Insert "brightness = true" to line to line 819 above "method = nodeADC.setLightOn"

Restart homebridge

this now works consistently for me... Perhaps others can test?

ngori commented 3 years ago

I believe @chase9 wrote the light implementation and it was only meant for dimmers if I recall correctly.

chase9 commented 3 years ago

I had thought this was fixed by adding a method overload for basic lights but I will go back and run through it.

iBanks3 commented 3 years ago

likely not the best way to fix this, but i modified index.js (/usr/local/lib/node_modules/homebridge-node-alarm-dot-com)

Insert "brightness = true" to line to line 819 above "method = nodeADC.setLightOn"

Restart homebridge

this now works consistently for me... Perhaps others can test?

Where can I find this path? I tried finding it on my raspberry pi but directory cannot be found. I have homebridge installed on Raspberian and I am completely knew to it, just set it up today and have a couple plugins working but running into the lighting issue with this plugin. Thanks

Edit: I have found the file under /usr/lib/... had to remove /local/ but unable to modify file due to level of permissions. I can’t seem to change the permissions to allow write access but will play with it some more.

Edit 2: Figured out the permissions situation and updated the file. I am now able to turn the lights on but no longer able to turn them back off. Tapping the icon will toggle off but quickly back on and light status doesn’t change.

chase9 commented 3 years ago

There are two characteristics we care about when looking at lights, "brightness" and "on". I believe where we're getting stuck is that homekit likes to modify both values at once, whereas alarm.com expects any modifications to a light to happen in one API call.

I just rewrote some of the light implementation on the typescript branch and things seem to be working well! I'm unable to get my light into "not responding" state, and it accepts all commands in a timely fashion. If you could try the latest code out and let me know how it's working for you, that would be great!

iBanks3 commented 3 years ago

There are two characteristics we care about when looking at lights, "brightness" and "on". I believe where we're getting stuck is that homekit likes to modify both values at once, whereas alarm.com expects any modifications to a light to happen in one API call.

I just rewrote some of the light implementation on the typescript branch and things seem to be working well! I'm unable to get my light into "not responding" state, and it accepts all commands in a timely fashion. If you could try the latest code out and let me know how it's working for you, that would be great!

Hey, I’m just getting time to play around with my homebridge setup and honestly, hopefully to not look like an idiot, I’m not too sure on how to install/use the updated code. I tried downloading the .zip file and overwriting the existing homebridge-node-alarm-dot-com folder and files with the typescript files from the zip. I also tried to mom install -g homebridge-node-alarm-dot-com-typescript and the same but used the https://github.com/node-alarm-dot-com/homebridge-node-alarm-dot-com.git from the typescript branch and still no joy. Sorry to be such a noob on this as I am, mind pointing me in a direction that i can read up on how to go about installing this code? Thanks

chase9 commented 3 years ago

Hey @iBanks3. Please don't feel like a noob, It was hard to get started for me as well. I still don't understand NPM packaging, which is why I don't have a good way to get you the updated code!

I'll attach the updated index.js files for you to replace. The issue you ran into is that Typescript (.ts) files need to be transpiled into Javascript (.js) files before they can be used.

next.zip

If you replace your files with the files I attached you should have the latest.

iBanks3 commented 3 years ago

Awesome. Thanks, will give it a shot. On Nov 26, 2020, 12:07 PM -0500, Chase Lau notifications@github.com, wrote:

Hey @iBanks3. Please don't feel like a noob, It was hard to get started for me as well. I still don't understand NPM packaging, which is why I don't have a good way to get you the updated code! I'll attach the updated index.js files for you to replace. The issue you ran into is that Typescript (.ts) files need to be transpiled into Javascript (.js) files before they can be used. next.zip If you replace your files with the files I attached you should have the latest. — You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub, or unsubscribe.

iBanks3 commented 3 years ago

Hey @iBanks3. Please don't feel like a noob, It was hard to get started for me as well. I still don't understand NPM packaging, which is why I don't have a good way to get you the updated code!

I'll attach the updated index.js files for you to replace. The issue you ran into is that Typescript (.ts) files need to be transpiled into Javascript (.js) files before they can be used.

next.zip

If you replace your files with the files I attached you should have the latest.

I was looking for the files to replace but not finding the file names you've attached in the folder /usr/lib/node_modules/homebridge-node-alarm-dot-com/node_modules/node-alarm-dot-com. Perhaps the wrong folder I am looking in? I also noticed the _MACOSX folder within the archive, could it also be that I am using Homebridge on a Raspberry Pi and not MacOS as to why I don't see these files?

rferson commented 3 years ago

Hey @iBanks3. Please don't feel like a noob, It was hard to get started for me as well. I still don't understand NPM packaging, which is why I don't have a good way to get you the updated code! I'll attach the updated index.js files for you to replace. The issue you ran into is that Typescript (.ts) files need to be transpiled into Javascript (.js) files before they can be used. next.zip If you replace your files with the files I attached you should have the latest.

I was looking for the files to replace but not finding the file names you've attached in the folder /usr/lib/node_modules/homebridge-node-alarm-dot-com/node_modules/node-alarm-dot-com. Perhaps the wrong folder I am looking in? I also noticed the _MACOSX folder within the archive, could it also be that I am using Homebridge on a Raspberry Pi and not MacOS as to why I don't see these files?

I am also having the same issue and am looking to replace the files but can't seem to find where to replace the files ? Sorry...

rferson commented 3 years ago

likely not the best way to fix this, but i modified index.js (/usr/local/lib/node_modules/homebridge-node-alarm-dot-com) Insert "brightness = true" to line to line 819 above "method = nodeADC.setLightOn" Restart homebridge this now works consistently for me... Perhaps others can test?

Where can I find this path? I tried finding it on my raspberry pi but directory cannot be found. I have homebridge installed on Raspberian and I am completely knew to it, just set it up today and have a couple plugins working but running into the lighting issue with this plugin. Thanks

Edit: I have found the file under /usr/lib/... had to remove /local/ but unable to modify file due to level of permissions. I can’t seem to change the permissions to allow write access but will play with it some more.

Edit 2: Figured out the permissions situation and updated the file. I am now able to turn the lights on but no longer able to turn them back off. Tapping the icon will toggle off but quickly back on and light status doesn’t change.

I did this above and seems to consistently work. My only question is, does this affect the ability to change the light level (dimming)?

chase9 commented 3 years ago

Not as far as I can tell. I have a dimmer and it works fine. I haven’t been able to eliminate a jump in light level when a light is off and you turn it on by changing the dimness, but it ends up at the right level.

I’m more concerned about non-dimming lights because I’m not sure if their API calls include brightness.

Chase Lau

Please excuse any grammatical errors as this was sent from my iPhone.

On Nov 29, 2020, at 9:38 AM, rferson notifications@github.com wrote:

 likely not the best way to fix this, but i modified index.js (/usr/local/lib/node_modules/homebridge-node-alarm-dot-com) Insert "brightness = true" to line to line 819 above "method = nodeADC.setLightOn" Restart homebridge this now works consistently for me... Perhaps others can test?

Where can I find this path? I tried finding it on my raspberry pi but directory cannot be found. I have homebridge installed on Raspberian and I am completely knew to it, just set it up today and have a couple plugins working but running into the lighting issue with this plugin. Thanks

Edit: I have found the file under /usr/lib/... had to remove /local/ but unable to modify file due to level of permissions. I can’t seem to change the permissions to allow write access but will play with it some more.

Edit 2: Figured out the permissions situation and updated the file. I am now able to turn the lights on but no longer able to turn them back off. Tapping the icon will toggle off but quickly back on and light status doesn’t change.

I did this above and seems to consistently work. My only question is, does this affect the ability to change the light level (dimming)?

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

rferson commented 3 years ago

Dimming doesn’t work for me in this configuration.

I will keep looking.

Thank you.

On Sun, Nov 29, 2020 at 6:49 PM Chase Lau notifications@github.com wrote:

Not as far as I can tell. I have a dimmer and it works fine. I haven’t been able to eliminate a jump in light level when a light is off and you turn it on by changing the dimness, but it ends up at the right level.

I’m more concerned about non-dimming lights because I’m not sure if their API calls include brightness.

Chase Lau

Please excuse any grammatical errors as this was sent from my iPhone.

On Nov 29, 2020, at 9:38 AM, rferson notifications@github.com wrote:

 likely not the best way to fix this, but i modified index.js (/usr/local/lib/node_modules/homebridge-node-alarm-dot-com) Insert "brightness = true" to line to line 819 above "method = nodeADC.setLightOn" Restart homebridge this now works consistently for me... Perhaps others can test?

Where can I find this path? I tried finding it on my raspberry pi but directory cannot be found. I have homebridge installed on Raspberian and I am completely knew to it, just set it up today and have a couple plugins working but running into the lighting issue with this plugin. Thanks

Edit: I have found the file under /usr/lib/... had to remove /local/ but unable to modify file due to level of permissions. I can’t seem to change the permissions to allow write access but will play with it some more.

Edit 2: Figured out the permissions situation and updated the file. I am now able to turn the lights on but no longer able to turn them back off. Tapping the icon will toggle off but quickly back on and light status doesn’t change.

I did this above and seems to consistently work. My only question is, does this affect the ability to change the light level (dimming)?

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

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/node-alarm-dot-com/homebridge-node-alarm-dot-com/issues/49#issuecomment-735477646, or unsubscribe https://github.com/notifications/unsubscribe-auth/AMLICD5U2WLDABKCFTCG2ZTSSLMZ7ANCNFSM4SYNHS5Q .

chase9 commented 3 years ago

I'm sorry, I'm having trouble understanding. With this configuration, do you see the dimming switch and all, but dimming doesn't do anything?

rferson commented 3 years ago

I used the fix of adding the line "brightness = true" in the config file and my lights turn on and off reliably now. Brightness changes do not occur however. I wasn't able to figure out what two files to replace so i am somewhat confused

On Wed, Dec 2, 2020 at 11:18 AM ngori notifications@github.com wrote:

@chase9 https://github.com/chase9 Hey Chase, I have 1 hardware z-wave on/off device and then a ton of cloud integrated Lutron dimmers. I just looked at the calls for toggling the z-wave switch on and off. The API call for the non-dimmer is using an attribute of desired state where 2 is on and 3 is off vs the brightness level attribute set for a dimmer. The states variables are defined but I don't seem them being used elsewhere.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/node-alarm-dot-com/homebridge-node-alarm-dot-com/issues/49#issuecomment-737336226, or unsubscribe https://github.com/notifications/unsubscribe-auth/AMLICD7PQSF6OJ4M4NLKXA3SSZSGDANCNFSM4SYNHS5Q .

chase9 commented 3 years ago

The project has been updated with changes making lights more reliable. Please let me know if you still have issues after updating!

iBanks3 commented 3 years ago

The project has been updated with changes making lights more reliable. Please let me know if you still have issues after updating!

Update via plugin update via Homebridge UI or download files separately here?

chase9 commented 3 years ago

The updated version of this plugin will be available via the UI shortly. I'm just cleaning some things up first.

iBanks3 commented 3 years ago

Awesome. I’m off of work today so once released I can do some heavy testing to see if any issues. On Feb 6, 2021, 4:27 PM -0500, Chase Lau notifications@github.com, wrote:

The updated version of this plugin will be available via the UI shortly. I'm just cleaning some things up first. — You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub, or unsubscribe.

chase9 commented 3 years ago

Thanks! It's was just pushed up. You can ping me here or on the Discord if you find any problems.

iBanks3 commented 3 years ago

Cool. Link to the Discord channel?

This is what I am getting after the update and 2FA is currently disabled as the app is trying to force me to enable.

[Security System] UNHANDLED ERROR: Error: No afg cookie: ASP.NET_SessionId=eaokws5cssifdgly5o5lpspl; cookieTest=1; twoFactorAuthenticationId=65B43BD1836DF55560F753CADAF066EB0ACEDA74603340B8620A813EA16673BB; IsFromNewSite=1; fromASP=; IsFromSeamlessLogin=; login=; ST=; SeamlessLoginEnabled=; loggedInAsSubscriber=1; BIGipServer~AlarmApplication~Alarm_WEBADC_Alarm_HTTPS=!COyRepbP14aBtOrNzUFX+zqT5KjmGKfy1K4ntgOkP0e0pYaqwSIqV5oY+pTRfd4F00V9O5xDo6R94ow= at /usr/lib/node_modules/homebridge-node-alarm-dot-com/node_modules/node-alarm-dot-com/dist/index.js:91:23 at processTicksAndRejections (internal/process/task_queues.js:93:5)

On February 6, 2021 at 4:47 PM, Chase Lau notifications@github.com wrote:

Thanks! It's was just pushed up. You can ping me here or on the Discord if you find any problems.

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

chase9 commented 3 years ago

https://discord.gg/TBA3AHfF

Stugatza commented 3 years ago

Still getting errors on this:

[3/10/2021, 09:35:51] [Security System] Error: Failed to change light state: Error: POST https://www.alarm.com/web/api/devices/lights/94428553-1220/turnOn failed: 423 at /usr/local/lib/node_modules/homebridge-node-alarm-dot-com/node_modules/node-alarm-dot-com/dist/index.js:493:15 at runMicrotasks () at processTicksAndRejections (internal/process/task_queues.js:97:5)

I also have a Google Home module tied into HomeKit. That module puts all my switches into Google Home. They work fine there, but Apple Home is having issues. Even if i disable the Google Home Plugin, the issue persists.