mrjackyliang / homebridge-adt-pulse

Homebridge security system platform for ADT Pulse
MIT License
36 stars 7 forks source link

Night Mode Support #6

Closed golish closed 5 years ago

golish commented 5 years ago

Both ADT Pulse and HomeKit seem to support the Night mode but when using homebridge-adt, this mode isn’t correctly mapped between the two systems:

I know Night mode isn’t enabled in many ADT systems so let me know if I can help with more info on this.

mrjackyliang commented 5 years ago

Yes, I remapped the Night mode to stay mode, because my system doesn't support it (afaik).

I will make this a priority in my next update, so to support night mode in the system. Will comment on it later on the instructions to retrieve the night mode information!

mrjackyliang commented 5 years ago

Before you start, place your system into TEST MODE. You can do that at the MyADT website.

Here are the instructions to grab the Night Mode URLs from ADT Pulse's website:

  1. Launch Google Chrome.
  2. Go to this site: https://portal.adtpulse.com/myhome/summary/summary.jsp.
  3. Disarm your system.
  4. Right-click (or ⌘+Click) and then select Inspect.
  5. Click the Console tab.
  6. Copy each line of code shown below, and paste the response:
    jQuery("#divOrbSecurityButtons").html();
  7. Arm your system to night mode.
  8. Copy each line of code shown below, and paste the response:
    jQuery("#divOrbSecurityButtons").html();
    jQuery("#divOrbTextSummary .p_boldNormalTextLarge").html();
  9. Disarm your system.
  10. Open a window or door (do not close it).
  11. Arm your system to night mode BUT DO NOT ATTEMPT TO FORCE ARM.
  12. Copy each line of code shown below, and paste the response:
    jQuery("#arm_button_1").html();
  13. Disarm your system and close the window/door.
  14. Logout (important)!

P.S. Remember to let me know which mode you are in when following 6, 8, and 12!

golish commented 5 years ago

A couple of questions:

  1. AFAIR if I open a door/window and then try to arm via the panel, it won't let me do it; if I try to arm via the ADT Pulse app, it will ask for a sensor override - what do you mean by "force arm"?
  2. By "which mode your are in following 6, 8 and 12" do you mean what I see on Home app or in ADT Pulse?
mrjackyliang commented 5 years ago
  1. Yes, force arm is essentially sensor override. Force arm basically does a sensor override then arms your system for you.
  2. In your own words. So if you just armed night or opened window/door, just state the current status.
golish commented 5 years ago

Here are the details:

<div><input type="button" id="security_button_0" name="security_button_0" value="Arm Away" alt="Arm Away" class="p_btn p_btnMnormal" onclick="setArmState('quickcontrol/armDisarm.jsp','Arming Away','0','2','false','href=rest/adt/ui/client/security/setArmState&amp;armstate=off&amp;arm=away')" onmouseover="javascript:btnHover(this,'M')" onmouseout="javascript:btnNormal(this,'M')" onmousedown="javascript:btnDown(this,'M')" onmouseup="javascript:btnNormal(this,'M')" data-fitlabel="ellips"><style type="text/css">#testSizesecurity_button_0 {position: absolute; visibility: hidden; height: auto; width: auto; white-space: nowrap; min-width: 0}</style><div id="testSizesecurity_button_0" class="p_btn p_btnMnormal">Arm Away</div></div><div style="margin-top: 6px;"><input type="button" id="security_button_1" name="security_button_1" value="Arm Stay" alt="Arm Stay" class="p_btn p_btnMnormal" onclick="setArmState('quickcontrol/armDisarm.jsp','Arming Stay','1','2','false','href=rest/adt/ui/client/security/setArmState&amp;armstate=off&amp;arm=stay')" onmouseover="javascript:btnHover(this,'M')" onmouseout="javascript:btnNormal(this,'M')" onmousedown="javascript:btnDown(this,'M')" onmouseup="javascript:btnNormal(this,'M')" data-fitlabel="ellips"><style type="text/css">#testSizesecurity_button_1 {position: absolute; visibility: hidden; height: auto; width: auto; white-space: nowrap; min-width: 0}</style><div id="testSizesecurity_button_1" class="p_btn p_btnMnormal">Arm Stay</div></div>
<div><input type="button" id="security_button_0" name="security_button_0" value="Arm Away" alt="Arm Away" class="p_btn p_btnMnormal" onclick="setArmState('quickcontrol/armDisarm.jsp','Arming Away','0','2','false','href=rest/adt/ui/client/security/setArmState&amp;armstate=off&amp;arm=away')" onmouseover="javascript:btnHover(this,'M')" onmouseout="javascript:btnNormal(this,'M')" onmousedown="javascript:btnDown(this,'M')" onmouseup="javascript:btnNormal(this,'M')" data-fitlabel="ellips"><style type="text/css">#testSizesecurity_button_0 {position: absolute; visibility: hidden; height: auto; width: auto; white-space: nowrap; min-width: 0}</style><div id="testSizesecurity_button_0" class="p_btn p_btnMnormal">Arm Away</div></div><div style="margin-top: 6px;"><input type="button" id="security_button_1" name="security_button_1" value="Arm Stay" alt="Arm Stay" class="p_btn p_btnMnormal" onclick="setArmState('quickcontrol/armDisarm.jsp','Arming Stay','1','2','false','href=rest/adt/ui/client/security/setArmState&amp;armstate=off&amp;arm=stay')" onmouseover="javascript:btnHover(this,'M')" onmouseout="javascript:btnNormal(this,'M')" onmousedown="javascript:btnDown(this,'M')" onmouseup="javascript:btnNormal(this,'M')" data-fitlabel="ellips"><style type="text/css">#testSizesecurity_button_1 {position: absolute; visibility: hidden; height: auto; width: auto; white-space: nowrap; min-width: 0}</style><div id="testSizesecurity_button_1" class="p_btn p_btnMnormal">Arm Stay</div></div>
"Armed Night.&nbsp;All Quiet."
mrjackyliang commented 5 years ago

Hmm... this is unexpected. I don't see the Arm Night buttons in the code you pasted. Can you confirm that there is an Arm Night button in the web portal?

And, during Steps 10 to 13, are you also Arming Night in the web portal? It should pop out a dialog where it asks to Arm Anyway.

Possibly a screenshot might work out.

golish commented 5 years ago

Oh, sorry - no, there is no Arm Night button in the portal, I'm arming in night mode only through the panel. The state does get correctly reflected in the portal, though. I wonder if they just don't expose through the portal since it's not enabled in their systems by default? And if it's not exposed, I wonder if their REST APIs support it? Is there some experimenting I can do to help find the right parameters?

mrjackyliang commented 5 years ago

Ah, no wonder. In order for me to enable full functionality for Arm Night on the plugin, it must be exposed in the Web Portal.

Icontrol One (a white labeled panel that ADT Pulse uses) doesn't have an actual REST API I can use, so I'm forced to reverse engineer the code so I can implement it into HomeKit.

But on the other hand, I can definitely update the plugin to show that the system is in Armed Night mode.

golish commented 5 years ago

What I mean is that the portal is just a UI on top of ADT's REST APIs as far as I can tell - maybe we can test if those underlying APIs support night mode, even if there's no button for it in the portal.

mrjackyliang commented 5 years ago

I can try to come up with some URLs that might be able to Arm Night the system remotely (not that optimistic that it will work), will update you on that later.

Just a curious question. How do you Arm Night using your Security Panel? If you have that function, I might also be able to debug it from my side.

golish commented 5 years ago

I have it mapped to a function key but the official way is: security code + [3] + [3] Not sure if it will work for you, though - I had the night mode enabled by the system installer before I was able to start using it.

mrjackyliang commented 5 years ago

Gotcha. I'll also call ADT and see what answers I can get from them in addition to testing this on my system if it works.

mrjackyliang commented 5 years ago

Good news! I called ADT customer support, and they told me there isn't an official way to Arm Night in ADT Pulse, but with some common sense hack I found the URLs required to Arm Night the system.

Set the system from Disarmed to Arm Night:

https://portal.adtpulse.com/myhome/quickcontrol/armDisarm.jsp?href=rest/adt/ui/client/security/setArmState&armstate=disarmed&arm=night

Set the system from Arm Night to Disarmed:

https://portal.adtpulse.com/myhome/quickcontrol/armDisarm.jsp?href=rest/adt/ui/client/security/setArmState&armstate=night&arm=off

Go ahead and try these two URLs while you are logged into the Web Portal. And let me know if it works for you!

golish commented 5 years ago

Those two work perfectly - the system gets armed and disarmed as it should and the change is reflected both in ADT portal and on the panel!

mrjackyliang commented 5 years ago

Perfect! I'm working on the functions now. Will update you when the next version is released, thanks for letting me know!

mrjackyliang commented 5 years ago

Night mode is now supported as of v1.3.0! Closing this issue now😎

github-actions[bot] commented 9 months ago

This issue is now locked and considered resolved. If you have questions or inquiries, you may start a new issue.