Closed B-Hartley closed 4 years ago
Now you mention it, that would be really handy. Would the idea be just expose a switch that's on when the alarm is on and off when it's off? Can you get the triggers you need for your lights from that? Anyone know whether the Texecom sends anything over the Crestron protocol when the alarm is set and unset?
Hi, Yes a switch that shows "on" or "off" would be good enough for me to do what I want. In an ideal future world it would be implemented as a "security system" which I think is a HomeKit thing.
Anyway, what gets sent when you arm is like a zone update but with a "A" instead of a "Z" and the number instead of being a Zone is an Area.
When you disarm, it sends the same with a "D".
Amazeballs. Am looking at this now and it's starting to work. What's that "U" status update between the "A" and the "D" I wonder? Does the A definitely mean armed rather than arming?
[4/4/2019, 8:41:56 PM] [Texecom] IP data received: "Z0110 [4/4/2019, 8:41:56 PM] [Texecom] Zone update received for zone 11 active: false [4/4/2019, 8:41:56 PM] [Texecom] Zone match found, updating zone status in HomeKit to false [4/4/2019, 8:41:56 PM] [Texecom] Dwell = 1000 [4/4/2019, 8:41:56 PM] [Texecom] Changing state with changeHandler to false [4/4/2019, 8:42:04 PM] [Texecom] IP data received: "A0011 [4/4/2019, 8:42:04 PM] [Texecom] Area 0 armed [4/4/2019, 8:42:11 PM] [Texecom] IP data received: "U0010 [4/4/2019, 8:42:14 PM] [Texecom] IP data received: "D0011 [4/4/2019, 8:42:14 PM] [Texecom] Area 0 disarmed
I don’t know what the U one is. It seems to relate to area 001 and is something “not set”.
The A is definitely armed and the D disarmed. I believe you can call ASTATUS and it will send you back the zone by zone armed status.
Actually. Maybe it’s “user”. So the U is sent when you put your code in ? And the D when you choose to disarm.
Does that fit. If you delay after putting your code in before choosing disarm. Do the timestamps fit ? Have you got it linked to a switch in HomeKit yet ?
I do actually have working code to do a lot of this properly, let me find a way to share what I have
Got this mostly working now, with it coming up as an actual security system: https://github.com/max-christian/homebridge-texecom
Config is like this:
{
"platform": "Texecom",
"ip_address": "192.168.0.17",
"ip_port": 10001,
"zones": [
<your zones here>
],
"areas": [
{"name": "Texecom Alarm","area_number": "1","area_type": "securitysystem","dwell": 1000}
]
}
@B-Hartley Yep, I'm sure you're right about the U being user! Good thinking.
Here's what it looks like in the Home app: https://imgur.com/gallery/zL4Yj8P
@kieranmjones Maybe have a look at the diff and let me know if you want me to create a pull request? It's all working except for setting the target armed status (only sets the current armed status at the moment). I can only test on IP and it needs testing on a serial connection as I have adjusted a few things that could break serial.
My code created the alarm system and could handle status, setting and unsetting to away, home, and night modes. The problem I was having was keeping track of modes, the only method I was able to use to determine if it was in night vs home vs full armed away mode was by using LCD text and string matching for that part arm text description on the LCD. It worked well, apart from if you were in away mode and tried to go to disarmed. Also it would get very confused and status get out of sync if the alarm went off and was disarmed via HomeKit as the messages on screen are wrong and it has to keep track of alarms.
The status aspect worked well really it was only when implementing control that things went awry. I can send over the code I have which is pre support for IP so would probably not merge well into a fork or something.
I'm happy to send it over via email and you can take a look and see what you think of what I did vs what you have?
Kieran. Have you tried calling ASTATUS
It will then send you back a string that shows the armed status of each area.
Could be the piece of the puzzle you need ?
How did you detect that it had been “part set” for night mode? I can’t figure that out?
Also, status viewing in HomeKit is really 99% of what I want. No particular need to be able to set and unset the alarm through it. So it sounds like what you have, with the network stuff linked in. Would work a treat.
I’ve got the max version running at the moment although it seems to stick on “arming:
Going to bed now, will look more tomorrow / weekend.
Thanks guys !
I've just updated it to fix getting stuck on "arming...". The only two states you should see now are "Off" and "Away". (I was intending to use the "Home" state, but having had a look at the docs it appears to be for when the alarm is armed, people are at home, and they are not asleep?)
The plugin assumes the current state is Off when Homebridge starts up; it doesn't yet read the status using ASTATUS.
@kieranmjones How were you reading the LCD, is that possible via Crestron or are you using a Texecom protocol? I'd say a cool Homebridge-y thing to do with the LCD text would be to dump it into the log each time it changes — people like to see a log of what their home's been up to in there.
Sending "LSTATUS" will give you back what is shown on the LCD.
any thoughts on how you can detect a "part set" status ? does it show different areas armed? or would you have to read the screen, (which would need to be in the config file to match whatever the user had as their part set name) ?
@max-christian - have you had Kieran's latest code yet for comparison with what you have written ?
also.... I think when you do var updated_area = Number(S(S(data).substring(2,5)));
That you should actually only be taking 3 digits. I think 3 digits are the area and the last two digits are the user that armed or disarmed. You could log the user who has armed / disarmed ?
I'm guessing you have seen this (or similar info)
// The value property of SecuritySystemCurrentState must be one of the following: Characteristic.SecuritySystemCurrentState.STAY_ARM = 0; Characteristic.SecuritySystemCurrentState.AWAY_ARM = 1; Characteristic.SecuritySystemCurrentState.NIGHT_ARM = 2; Characteristic.SecuritySystemCurrentState.DISARMED = 3; Characteristic.SecuritySystemCurrentState.ALARM_TRIGGERED = 4;
As far as I can tell, there is no notification when the alarm is actually triggered ? need to do more testing on that though.
.substring(2,5) is three digits :)
There's only one digit after that so probably not the user?
I was about to ask what comes through when the alarm is triggered, as it really ought to support that. And get ASTATUS polling implemented as well.
I have just sent over my code to you Bruce via email, for each type of part arm you can set an LCD text to display on screen, so I had a config option for what text the user had chosen for each part arm, I for example have one set to "Night Arm" and one set to "Home Arm" which the code then matches and determines from that which part arm state it's in. If I recall the ASTATUS tells us it's armed but doesn't differentiate the type of arming?
// Home arm text has been observed on LCD output } else if(S(data).contains(home_arm_text)) { for(var i = 0; i < zoneCount; i++){ if(zoneAccessories[i].zone_type == "area"){ if(currentState != "STAY_ARM"){ debug("Updating area status in HomeKit to home armed"); zoneAccessories[i].changeHandler("STAY_ARM"); currentState = "STAY_ARM"; } break; } } // Night arm text has been observed on LCD output } else if(S(data).contains(night_arm_text)) { for(var i = 0; i < zoneCount; i++){ if(zoneAccessories[i].zone_type == "area"){ if(currentState != "NIGHT_ARM"){ debug("Updating area status in HomeKit to night armed"); zoneAccessories[i].changeHandler("NIGHT_ARM"); currentState = "NIGHT_ARM"; } break; } } // Full arm text has been observed on LCD output } else if(S(data).contains('FULL ARMED')) { for(var i = 0; i < zoneCount; i++){ if(zoneAccessories[i].zone_type == "area"){ if(currentState != "AWAY_ARM"){ debug("Updating area status in HomeKit to full armed"); zoneAccessories[i].changeHandler("AWAY_ARM"); currentState = "AWAY_ARM"; } break; } } // Area status indicating no areas armed observed } else if(S(data).contains('NNNN')) { for(var i = 0; i < zoneCount; i++){ if(zoneAccessories[i].zone_type == "area"){ if(currentState != "DISARMED" && currentState != "ALARM_TRIGGERED"){ debug("Updating area status in HomeKit to disarmed"); zoneAccessories[i].changeHandler("DISARMED"); currentState = "DISARMED"; } break; } } // LCD text indicating an alarm state has been observed } else if(S(data).contains('Area in Alarm') || S(data).contains('Alarm from Zone')) { for(var i = 0; i < zoneCount; i++){ if(zoneAccessories[i].zone_type == "area"){ if(currentState != "ALARM_TRIGGERED" && AlarmTriggerSuppress == false){ debug("Updating area alarm status in HomeKit to triggered"); zoneAccessories[i].changeHandler("ALARM_TRIGGERED"); currentState = "ALARM_TRIGGERED"; } break; } }
Well, that formatted well... apologies! It should be properly formatted in what I emailed over.
Thanks for sharing the code. Was the reason for trying to parse the LCD text purely to get part arm status, or were you doing it anyway for something else?
I believe it was specifically to determine the type of arming, i.e. full, or one of the part arms, also I think I may have used it for determining faults but I can't recall right now as I've not looked at that code in a while. I believe that string matching is the only way to do that with the LCD text so as I say it looks for a config defined string for the night arm etc.
In terms of status reading it works great, that code just breaks down when trying to sync status with actually changing the alarm state through simulated keypad entry which is sadly the only way to do it on the alarm which sucks.
.substring(2,5) is three digits :)
There's only one digit after that so probably not the user?
Oh! you can tell I don't do a lot of javascript. I thought that meant take 5 chars, not take them from 2-5.
If there is a single "1" then I think it just means "armed" or "disarmed" or whatever. If it is 2 digits, then I think it is the user. Probably depends on which firmware you are running.
@max-christian - have you had the code via email ?
@kieranmjones - Just found your email, my email system had blocked it due to it having a .js attachment. Any chance you could send it over without a file extension, or with a .txt extension so I can get it. Thanks.
Thanks for sharing the code. Was the reason for trying to parse the LCD text purely to get part arm status, or were you doing it anyway for something else?
@max-christian - Have you managed to integrate any more of the Kieran code into your branch with IP support ?
Could there be some progress in the case? :P
I’m not clear what progress is expected? I still have it running on my home system and it seems solid.
Which version are you running ? Your version ? Or Kieran’s latest version with networking added ?
I’m using the version linked above: https://github.com/kieranmjones/homebridge-texecom/issues/8#issuecomment-480050705
Ok. Good stuff. Me too. If you ever feel like integrating Kieran’s latest code for detecting part sets etc. I look forward to that. Otherwise. It does the job pretty much as it is.
Is it necessary to arrange the panel language in English?
No, I don’t think so.
Hi guys, I've just set my alarm off to see what output there is when the alarm sounds. I got L0010. Can anyone confirm from docs that's correct for alarm triggering, 001 being the area number?
If so I'll get that implemented. I also want to change it so that the status of the alarm is always queried live from the alarm instead of being cached by the plugin. Went on holiday recently and that would have been more reassuring.
(I also got an X0010 just after the usual U0010 when I entered my code, anyone know what that means?)
Found the meaning of the letters in another project on github:
const char *msgZoneUpdate = "\"Z0";
const char *msgArmUpdate = "\"A0";
const char *msgDisarmUpdate = "\"D0";
const char *msgEntryUpdate = "\"E0";
const char *msgArmingUpdate = "\"X0";
const char *msgIntruderUpdate = "\"L0";
from: https://github.com/JumpMaster/TexecomManager/blob/master/src/texecom.h (interestingly that project is parsing the LCD display as well)
Cool, I look forward to your updates. So you'll pull the status using "ASTATUS" and "LSTATUS" ?
It sounds like there is a fairly good integration working here, I'm happy to integrate that into a release if others are? I kind of wanted full integration with ability to control arming but if you're happy with it being status only then I am as well. Perhaps submit a PR with some documentation and clear caveats that it's status only at this time?
Hi Kieran, thanks, I'm hopefully going to get time to improve this further in the next few days and then we can look to pushing out a release.
Now supports triggering of the alarm: https://github.com/max-christian/homebridge-texecom
That's great! Remind me what the current feature set is for this then?
I'd like to add polling using ASTATUS next but wondering if I might be too busy at the moment. If nobody else wants to do it, might be worth testing this version for a few days then thinking about a release. Needs a bit of documentation.
(I mean it supports reporting alarm triggers to HomeKit of course... not it setting your alarm off!)
Hi guys just wondering where this is at now , any recent updates ? Cheers Nath
Hi Nath, I’ve had the latest version on my account running for a couple of months without trouble. There’s no documentation yet but there’s a config example above.
That's good. Any chance of getting it merged and released on the "official" page so it can be installed more easily ?
I ought to update the instructions before Kieran does a release, but it won't be any time soon unfortunately.
Thanks max , not sure I have the skills to install it , but I’ll have a good look at it 👍
Hi,
Just wondered if you were making any progress on showing the alarm status (armed / disarmed). That's the feature that I'm keen to get. Would love to be able to use the "alarm set" as a way of knowing that we were all leaving the house. Lights should turn off etc.
I can have a go at hacking it into your script myself, but I'd be winging it. I considered faking it as a zone 101 or something and then capturing it with the "A" instead of the "Z" and adjusting it to an area number, but it seems a bit of a fudge !
So if you are already working on it, would rather wait for it to be done properly.
If I can offer any support / testing etc. please let me know.
I'm using your script through the Com-USB to a raspberry pi and it does work really well !
Thanks, Bruce.