Closed kaizersoje closed 1 year ago
What model is your network module? The plugin supports the NX-595E model exclusively; also, could you be so kind as to provide me with the version details of your installation? You can find those in the web interface -> Feature Setup, at the bottom of the page (firmware, hardware, boatload, web version and voice).
When the module is in programming mode, it's expected to not be able to log in. My personal setup uses CN_0.108O, so there might be some changes regarding the way the web interface handles login attempts in your firmware setup.
Could you please somehow provide me with the source files of your web interface? You can do that by using a web inspector at any modern browser (eg. Safari, Chrome, Firefox), view the page source (for the login page, at least initially), and then save the actual .html file on disk and attach it here - or at the very least, copy and paste the entire page source here.
Is there a particular page you want me to inspect/save?
Yes, as stated above, for starters let's try the login page if that's at all possible 👍🏻
This is the source for the login page
<!-- saved from url=(0030)http://192.168.0.194/login.htm -->
<html><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8"><meta name="color-scheme" content="light dark"></head><body><div class="line-gutter-backdrop"></div><form autocomplete="off"><label class="line-wrap-control">Line wrap<input type="checkbox" aria-label="Line wrap"></label></form><table><tbody><tr><td class="line-number" value="1"></td><td class="line-content"><span class="html-doctype"><!doctype html></span>
</td></tr><tr><td class="line-number" value="2"></td><td class="line-content"><span class="html-tag"><html></span>
</td></tr><tr><td class="line-number" value="3"></td><td class="line-content"><span class="html-tag"><head></span>
</td></tr><tr><td class="line-number" value="4"></td><td class="line-content"> <span class="html-tag"><meta <span class="html-attribute-name">charset</span>="<span class="html-attribute-value">UTF-8</span>"></span>
</td></tr><tr><td class="line-number" value="5"></td><td class="line-content"> <span class="html-tag"><title></span>ComNav :: Secure Network<span class="html-tag"></title></span>
</td></tr><tr><td class="line-number" value="6"></td><td class="line-content"> <span class="html-tag"><meta <span class="html-attribute-name">name</span>="<span class="html-attribute-value">viewport</span>" <span class="html-attribute-name">content</span>="<span class="html-attribute-value">initial-scale=1.0, width=device-width, maximum-scale = 1.0, minimum-scale = 1.0</span>" /></span>
</td></tr><tr><td class="line-number" value="7"></td><td class="line-content"> <span class="html-tag"><link <span class="html-attribute-name">href</span>="<a class="html-attribute-value html-resource-link" target="_blank" href="http://192.168.0.194/v_CN_0.109-B/m.css" rel="noreferrer noopener">/v_CN_0.109-B/m.css</a>" <span class="html-attribute-name">rel</span>="<span class="html-attribute-value">stylesheet</span>"></span>
</td></tr><tr><td class="line-number" value="8"></td><td class="line-content"> <span class="html-tag"><script <span class="html-attribute-name">src</span>="<a class="html-attribute-value html-resource-link" target="_blank" href="http://192.168.0.194/v_CN_0.109-B/lang_engau.js" rel="noreferrer noopener">/v_CN_0.109-B/lang_engau.js</a>" <span class="html-attribute-name">charset</span>="<span class="html-attribute-value">utf-8</span>"></span><span class="html-tag"></script></span>
</td></tr><tr><td class="line-number" value="9"></td><td class="line-content"> <span class="html-tag"><script></span>
</td></tr><tr><td class="line-number" value="10"></td><td class="line-content"> function changeLanguage()
</td></tr><tr><td class="line-number" value="11"></td><td class="line-content"> {
</td></tr><tr><td class="line-number" value="12"></td><td class="line-content"> document.getElementById('lang_sign_in').innerHTML = loginNames[0];
</td></tr><tr><td class="line-number" value="13"></td><td class="line-content"> document.getElementById('lang_username').innerHTML = loginNames[1];
</td></tr><tr><td class="line-number" value="14"></td><td class="line-content"> document.getElementById('lang_password').innerHTML = loginNames[2];
</td></tr><tr><td class="line-number" value="15"></td><td class="line-content"> document.getElementById('lang_but_sign_in').value = loginNames[0];
</td></tr><tr><td class="line-number" value="16"></td><td class="line-content"> }
</td></tr><tr><td class="line-number" value="17"></td><td class="line-content"> <span class="html-tag"></script></span>
</td></tr><tr><td class="line-number" value="18"></td><td class="line-content"> <span class="html-tag"></head></span>
</td></tr><tr><td class="line-number" value="19"></td><td class="line-content">
</td></tr><tr><td class="line-number" value="20"></td><td class="line-content"><span class="html-tag"><body <span class="html-attribute-name">onload</span>='<span class="html-attribute-value">changeLanguage()</span>'></span>
</td></tr><tr><td class="line-number" value="21"></td><td class="line-content"> <span class="html-tag"><div <span class="html-attribute-name">class</span>="<span class="html-attribute-value">ban</span>"></span>
</td></tr><tr><td class="line-number" value="22"></td><td class="line-content"> <span class="html-tag"><p></span>ComNav<span class="html-tag"></p></span>
</td></tr><tr><td class="line-number" value="23"></td><td class="line-content"> <span class="html-tag"></div></span>
</td></tr><tr><td class="line-number" value="24"></td><td class="line-content"> <span class="html-tag"><div <span class="html-attribute-name">class</span>="<span class="html-attribute-value">login</span>"></span>
</td></tr><tr><td class="line-number" value="25"></td><td class="line-content"> <span class="html-tag"><form <span class="html-attribute-name">method</span>="<span class="html-attribute-value">post</span>" <span class="html-attribute-name">action</span>="<span class="html-attribute-value">/login.cgi</span>" <span class="html-attribute-name">id</span>="<span class="html-attribute-value">login</span>" <span class="html-attribute-name">onsubmit</span>="<span class="html-attribute-value">return true;</span>"></span>
</td></tr><tr><td class="line-number" value="26"></td><td class="line-content"> <span class="html-tag"><h1 <span class="html-attribute-name">id</span>='<span class="html-attribute-value">lang_sign_in</span>'></span>Sign in<span class="html-tag"></h1></span>
</td></tr><tr><td class="line-number" value="27"></td><td class="line-content"> <span class="html-tag"><label <span class="html-attribute-name">id</span>='<span class="html-attribute-value">lang_username</span>'></span>Enter your username:<span class="html-tag"></label></span>
</td></tr><tr><td class="line-number" value="28"></td><td class="line-content"> <span class="html-tag"><input <span class="html-attribute-name">type</span>="<span class="html-attribute-value">text</span>" <span class="html-attribute-name">name</span>="<span class="html-attribute-value">lgname</span>" <span class="html-attribute-name">id</span>="<span class="html-attribute-value">lgname</span>" <span class="html-attribute-name">value</span>="" /></span>
</td></tr><tr><td class="line-number" value="29"></td><td class="line-content"> <span class="html-tag"><label <span class="html-attribute-name">id</span>='<span class="html-attribute-value">lang_password</span>'></span>Enter your password:<span class="html-tag"></label></span>
</td></tr><tr><td class="line-number" value="30"></td><td class="line-content"> <span class="html-tag"><input <span class="html-attribute-name">type</span>="<span class="html-attribute-value">password</span>" <span class="html-attribute-name">name</span>="<span class="html-attribute-value">lgpin</span>" <span class="html-attribute-name">id</span>="<span class="html-attribute-value">lgpin</span>" <span class="html-attribute-name">value</span>="" /></span>
</td></tr><tr><td class="line-number" value="31"></td><td class="line-content"> <span class="html-tag"><input <span class="html-attribute-name">id</span>='<span class="html-attribute-value">lang_but_sign_in</span>' <span class="html-attribute-name">type</span>="<span class="html-attribute-value">submit</span>" <span class="html-attribute-name">value</span>="<span class="html-attribute-value">Sign In</span>"/></span>
</td></tr><tr><td class="line-number" value="32"></td><td class="line-content"> <span class="html-tag"><script></span>
</td></tr><tr><td class="line-number" value="33"></td><td class="line-content"> document.getElementById('lgname').focus();
</td></tr><tr><td class="line-number" value="34"></td><td class="line-content"> <span class="html-tag"></script></span>
</td></tr><tr><td class="line-number" value="35"></td><td class="line-content"> <span class="html-tag"></form></span>
</td></tr><tr><td class="line-number" value="36"></td><td class="line-content"> <span class="html-tag"></div></span>
</td></tr><tr><td class="line-number" value="37"></td><td class="line-content"><span class="html-tag"></body></span>
</td></tr><tr><td class="line-number" value="38"></td><td class="line-content">
</td></tr><tr><td class="line-number" value="39"></td><td class="line-content"><span class="html-tag"></html></span>
</td></tr><tr><td class="line-number" value="40"></td><td class="line-content"><span class="html-end-of-file"></span></td></tr></tbody></table></body></html>
I also setup this integration but again only when the system is in program mode. The entites get a state of unavailable
when the system exits program mode.
Something is off with the contents of the file, as if it has been refactored to appear as a static HTML table. Regardless, I reversed the HTML special entities encoding and was able to bring it closer to its original form. It seems the login process is pretty much the same as in previous versions, so the plugin should pass the login page normally, therefore something else happens after that.
Could you please log in the web interface and send me the page that loads after that? In order to avoid reformatting, try saving the file from the web inspector (Sources tab in Safari and Chrome, Debug tab->Sources in Firefox, then right click on the file in the sidebar and select Save File), and then attach it here.
Regarding the integration you mention, it's developed by @caronc for Home Assistant, and this plugin was derived in its infancy from his original work on his ultrasync library, which is written in Python. The two projects have split off since then: the HA assistant has support for xGen and Zerowire panels, my version offers support for HomeKit and other features. It stands to reason that since this is a ComNav panel (as indicated by the v_CN***** firmware version), if it doesn't work with one of the two plugins, it won't work with the other without any extra work.
Send me the file I requested and I'll try and find out what the problem seems to be.
Hope this is what you are after. login.txt
If I haven't said it before, thx for your help in looking into this.
No worries ^^
Yes, your build works a bit differently from previous ones. In particular, there are four additional lines starting at line 28:
var manualFireAlarms = 0;
var manualPanicAlarms = 0;
var manualMedicalAlarms = 0;
var keypadSOSIndex = new Array(0,0,0,0,0,0,0,0);
And that is what forces to plugin to timeout, since the line where it expects to detect the session ID is 29, while in your setup it exists at line 33. Theoretically this is fixable, but I want to try and do this right, and not just assume that all the remaining web interface works in the same way.
If you're willing to help me out on this, I would like some extra details from you, if it's not much of a bother. For starters you can send me:
1) A screenshot of your alarm homepage after logging in, 2) A screenshot of your Zones page, 3) The source code of the zones page, and 4) The source code of the status.js file (found from the Sources tab, as you did before).
I may have to ask you for some extra details after these, but for now these will give me something to work with. Thanks!
PS: This interests me greatly because it appears that your version of the interface supports manual Medical and Fire alarms; the code might give me an idea on how to trigger manual alarms and/or how to report on medical and fire alarms, which is the one big thing I haven't been able to figure out how to implement in my plugin. Here's to hoping this pans out 🤞
Thanks, I took a peek. Seems like the panel works very much in the same way as with previous versions, with the added exception of including options for reporting manual burglar, fire, and medical alarms. I would like for you to send me the lang_engeu.js and master.js files as well. Fixing your problem will be easy, and maybe I could add manual alarm recognition to the plugin as well (for versions from yours on up, unfortunately for the rest of us :).
What's funny is, the alarm system actually has status codes for the custom alarms from previous versions on, but for some reason they don't get reported on the web interface when manually triggered. In CN_0.109B they have added extra data on the panel's .xml response that correspond to those (and I'm guessing extra strings to account for the web interface changes, that's why I'm asking for the extra files).
Let's see what we can do with this.
Well, it's good to hear that this is fixable. Here are the 2 files.
I just pushed v.1.3.0, which should fix your issue; please try it out and let me know if it works :)
Okay so here's the good news and the bad news
The good news is that IT WORKED 👍🏼 I can see the alarm and binary sensors in Home Assistant. However, I did see this in the logs
[Comnav] Error while polling: Request denied by server with code 302
[Comnav] Error while polling: Request denied by server with code 302
[Comnav] Error while polling: Login unsuccessful.
The bad news is that it still only gets set when the system is in program mode. I get the same error.
[Comnav] timeout of 10000ms exceeded
So with the system in normal mode it does not connect?
Could you please restart homebridge with the -D switch enabled and copy/paste the console output here?
Do you mean the "debug" mode turned on?
This is what I can see with the debug mode on.
[4/23/2023, 8:45:24 AM] [Comnav] Loading accessory from cache: Area 1
[4/23/2023, 8:45:24 AM] [Comnav] Loading accessory from cache: Front Door
[4/23/2023, 8:45:24 AM] [Comnav] Loading accessory from cache: Living Room
[4/23/2023, 8:45:24 AM] [Comnav] Loading accessory from cache: Hall
[4/23/2023, 8:45:24 AM] [Comnav] Loading accessory from cache: Rumpus
[4/23/2023, 8:45:24 AM] [Comnav] Loading accessory from cache: Side Door
[4/23/2023, 8:45:24 AM] [Comnav] Loading accessory from cache: Master Bedroom
[4/23/2023, 8:45:24 AM] [Comnav] Executed didFinishLaunching callback
[4/23/2023, 8:45:24 AM] [Comnav] Attempting login...
[4/23/2023, 8:45:34 AM] [Comnav] timeout of 10000ms exceeded
these are some errors I saw in the log now
[4/23/2023, 2:52:10 PM] [Comnav] Error while polling: Request denied by server with code 302
[4/23/2023, 2:54:33 PM] [Comnav] Error while polling: Request denied by server with code 302
[4/23/2023, 2:56:19 PM] [Comnav] Error while polling: Request failed with status code 403
[4/23/2023, 2:56:32 PM] [Comnav] Error while polling: Request failed with status code 403
[4/23/2023, 2:57:35 PM] [Comnav] Error while polling: timeout of 10000ms exceeded
[4/23/2023, 2:57:46 PM] [Comnav] Error while polling: timeout of 10000ms exceeded
[4/23/2023, 2:57:56 PM] [Comnav] Error while polling: timeout of 10000ms exceeded
[4/23/2023, 2:58:08 PM] [Comnav] Error while polling: timeout of 10000ms exceeded
[4/23/2023, 2:58:25 PM] [Comnav] Error while polling: connect EPIPE 192.168.0.194:80
[4/23/2023, 2:58:36 PM] [Comnav] Error while polling: timeout of 10000ms exceeded
[4/23/2023, 2:58:46 PM] [Comnav] Error while polling: timeout of 10000ms exceeded
[4/23/2023, 2:58:57 PM] [Comnav] Error while polling: timeout of 10000ms exceeded
[4/23/2023, 2:58:58 PM] [Comnav] Error while polling: socket hang up
[4/23/2023, 2:59:09 PM] [Comnav] Error while polling: timeout of 10000ms exceeded
[4/23/2023, 2:59:36 PM] [Comnav] Error while polling: timeout of 10000ms exceeded
[4/23/2023, 2:59:36 PM] [Comnav] Error while polling: socket hang up
It can't just timeout entirely, the login occurred at least once if it could pull zones and areas from the module. Try clearing your logs, take the system off programming mode and restart homebridge. What is the detailed output of the log?
I have attached the log here after clearing the logs
I came across a post on a forum where someone has mentioned that they were also having the same issue in getting the web access to work outside of programming mode. post
I will look into it when I get the chance and spare time; in the meanwhile, do you have issues accessing the web interface when outside programming mode regardless of the plug-in as well? If what the OP says applies, then you should have an issue logging in on your own as well when out of programming mode.
Yes, I cannot access the web interface outside of programming mode. It might have to do with the firmware of the module.
On another note, I have also installed the Ultrasync Alarm Panel integration as well. However, I noticed the radar sensors do not seem to be turning on even though the corresponding ultrasync sensor has fired.
I have "radarPersistence": 500
and "pollTimer": 500
I would guess this is a Home Assistant integration and not a homebridge plugin, right?
Yes, it would appear that the latest firmware does not allow for web access other that when in programming mode or through the Ultrasync+ app, for security reasons. I will look into whether it's possible to use the actual zerowire proxy server as a fallback (to at least communicate over the Internet with the panel), but this is practically a dealbreaker on the manufacturer's side.
FOLLOWUP: I did some snooping around on the subject. I'm afraid it's not good news: it appears that the manufacturer has indeed restricted local network access in the most recent versions of the module software. In upgraded installations, the only ways to control the system (other than DMTF and manual control from the access panel) is either the official UltraConnect/UltraSync+ apps for Android and iOS, or the DLX900 client that installers have available and use. The smartphone apps communicate with the manufacturer's proxy server using an encrypted SSL connection and a private certificate, which normally is not available to the public. While it is technically possible to extract it and use it to create a version of the plug-in that uses a roundabout connection via the proxy server, it's practically impossible (for the evident security reasons) to release it.
In essence, this means that all owners of upgraded NX-595E modules are officially borked regarding any kind of network access except for the official apps. DLX900 access might be a possible alternative, but it's a proprietary protocol that requires reverse engineering and time. I might look into it at some time, but not definitively.
Sorry to disappoint :(
Thanks mate.. Yes, that's a HA integration. Is that why the homebridge plugin sensors are not "realtime"?
I would guess this is a Home Assistant integration and not a homebridge plugin, right?
Yes, it would appear that the latest firmware does not allow for web access other that when in programming mode or through the Ultrasync+ app, for security reasons. I will look into whether it's possible to use the actual zerowire proxy server as a fallback (to at least communicate over the Internet with the panel), but this is practically a dealbreaker on the manufacturer's side.
Both pieces of software function in the same way, so they both are "real-time", as in they both poll the system in regular intervals for changes and reflect them. However, for that to work, both pieces of software need web access to the panel. Does the Ultrasync HA integration work normally on your setup?
The Ultrasync HA intergration works only when in programming mode. It didn't seem "real-time" to me which is evident from the screenshot.
Both the HA integration and this plug-in use virtually identical methods for connecting to the web interface, so both communicate when in programming mode. Recognizing the trigger is a matter of polling interval, which has a default value of 500 ms, but can be changed. Sensor persistence is a more customized matter, which involves both the way HA/homebridge work and the way the individuals pieces of software are coded. In this case, sensor persistence determines the time in milliseconds that the triggered sensor remains "on" for after being triggered.
I was referring to "recognizing the trigger". It seemed the plugin did not seem to recognize whereas the integration was pretty much real-time.
As long as the plugin has an open connection to the panel (which, in your case, necessitates for the system to be in programming mode), it will poll based on the pollTimer value (which means, twice every second). If I gather correctly, you are using homebridge through HA, which is a method I'm not familiar with and might work differently than expected. In any case, the necessity for program mode unfortunately makes the whole practical usage scenario pointless.
I have setup the plugin with the following details
However, I get this error
When I put the alarm system in program mode, I get the error below
I have setup the user with these permissions.