Closed jcuster closed 3 years ago
I was able to get things to compile successfully, but I'm not seeing states accurately reflect what the alarm system is doing (nothing changes when I open/close a door to change to ready -> not ready -> ready). Here are my changes:
@@ -103,7 +102,7 @@ custom_component:
VistaECP->onStatusChange([&](sysState led,bool open) {
switch(led) {
case sfire: id(fire).publish_state(open);break;
- case salarm: id(alarm).publish_state(open);break;
+ case salarm: id(myalarm).publish_state(open);break;
case strouble: id(trouble).publish_state(open);break;
case sarmedstay: id(stay).publish_state(open);break;
case sarmedaway: id(away).publish_state(open);break;
@@ -197,7 +196,7 @@ binary_sensor:
device_class: problem
- platform: template
- id: alarm
+ id: myalarm
name: "$systemName Alarm"
and I changed src/vistaEcpInterface/vistaAlarm.h
to reflect my pins:
//esp32 use pins 4,13,16-39
#ifdef ESP32
-#define D1 18
-#define D2 19
-#define D5 21
+#define D1 22
+#define D2 21
+#define D5 -1
#endif
The only wiring differences I have compared to your wiring diagram is that I'm using 22k and 10k Ohm resistors in series to create an effective 32k Ohm resistor (instead of 33k), and instead of a 330 Ohm, I'm using a 470 Ohm resistor. I'm using a LM2596 buck converter to step down to 5V, and I'm also using the 4n26 optoisolator.
unfortunately, I have not tested the esp32 hardware interface which is why you also got those compile errors since I've done a lot of changes since I tried an esp32 compile. It's really a work in progress. Are you getting data input from the debug prints? You can post some sample outputs so we can see what messages occur during the transitions. Please note that due to the lack of info from the panel , there is no accurate way of determining when a zone close/reset event happens as the panel does not send messages for those. Only for opens or alarms basically. This is why a time-to-live (ttl) setting is used to reset a zone when the panel stops sending open event messages for that it . You can adjust the ttl to a smaller value to make the transition happen faster.
As far as your hardware choices for components, those are fine. The values are not critical.
Thanks for getting back to me and thanks for your help!
A bit more information on what I've done since I left it out of the above. On my main keypad, whose address is 17, I searched for an unused keypad address (19) and activated it. I set keypadAddr
in the yaml and KP_ADDR
in vistaAlarm.h
to 19. The documentation doesn't talk about this, but I thought maybe this is what I am supposed to do instead of setting keypadAddr to the actual physical keypad address?
I commented out the define for MONITORTX
in vista.h
and enabled DEBUG
.
I understand there isn't a way to see when a zone is closed (hence the ttl). I can't even get the status for Ready to report properly (it's always Not Ready, even when the system is Ready), and AC is always reported as disconnected, etc. That is, it seems like nothing is being reported.
Here's a sample log over the span of a couple minutes:
11:13:19.627 -> Packet: FE
11:13:39.484 ->
11:13:39.484 -> Packet: E
11:13:49.372 ->
11:13:49.372 -> Packet: FC
11:13:49.372 ->
11:13:49.372 -> Packet: FC
11:13:50.583 -> [0;32m[I][CMD:334]: F8 00 00 00 00 00 00 00 00 00 00 00 [0m
11:13:50.583 -> [0;37m[V][app:081]: A component took a long time in a loop() cycle (1.15 s).[0m
11:13:50.583 -> [0;37m[V][app:082]: Components should block for at most 20-30ms in loop().[0m
11:13:50.966 ->
11:13:50.966 -> Packet: C0
11:14:09.191 ->
11:14:09.191 -> Packet: 1E
11:14:09.229 ->
11:14:09.229 -> Packet: 78
11:14:09.229 ->
11:14:09.229 -> Packet: F0
11:14:43.700 -> [0;32m[I][CMD:334]: F8 00 00 00 00 00 00 00 00 00 00 00 [0m
11:14:43.700 -> [0;37m[V][app:081]: A component took a long time in a loop() cycle (4.82 s).[0m
11:14:43.700 -> [0;37m[V][app:082]: Components should block for at most 20-30ms in loop().[0m
11:15:18.649 ->
11:15:18.649 -> Packet: FC
11:15:18.649 ->
11:15:18.649 -> Packet: 80
11:15:18.687 ->
11:15:18.687 -> Packet: E0
11:15:18.687 ->
11:15:18.687 -> Packet: FC
11:15:18.687 ->
11:15:18.687 -> Packet: FC
Setting keypaddaddr in the yaml is the only needed one. It overrides the vistaalarm default setting. You did it right. You just need to set it to an unused address. The "" a component took a long time in a loop" is obviously a warning from the esp32 library. I have not played enough with the esp32 variant to be familiar with it. The interrupts are time consuming for sure. I've tried to make them as efficient as possible considering what needs to happen. I will see what else can be optimized. This still doesnt explain the issue you are having. I will need to whip up a circuit to debug further. The cmd data you are showing does not make sense. Should not be zero's. Looks like the serial interrupt routine is not capturing data correctly.
Sorry, I think that last log was just noise. In my haste to convert from powering the esp32 from the panel to using USB, I had wired something wrong. I have everything wired properly now and I don't see any debug prints.
Here is an image of my circuit (setup for USB) if it's any help. I've assumed pin 1 on the optoisolator is the one with the dot.
Well, I just programmed an esp32 and wired it up on a protoboard and it works fine. I used gpio 18 for d1 and gpio19 for d2 because that's my defaults were. . The logs should show the same traffic as what is shown on your existing keypad. You can also try using keypad address 16 which is what I use currently.
Thanks. On a whim I decided to try moving the wires to different pins and I started getting data. However, now my physical keypad is reporting Check 100. Any idea what could be causing that?
Edit: I disconnected the module and I'm still getting that check code. I hope I didn't screw something up.
Edit edit: I should note that I have a 5881 wireless receiver. But, even though the check 100 is on, I still get zone faults from the wireless modules. Could the yaml config be setting something up that is interfering with that?
it's saying that it can't find the wireless module. Are you using the virtual zone expander? It might be conflicting with your wireless , so you might want to change your zone expander address if you are using it. You try clearing the error by entering your mastercode + 1 twice.
Once an error is set you do have to clear it even if the issue is resolved using mastercode + 1 (off)
I'll try disabling the virtual zone expander and see what happens.
Thanks!! I disabled all of these just to test and everything is working now:
expanderAddr1: "0" # 1st zone expander emulator (4229) address to use . Set to 0 to disable.
expanderAddr2: "0" # 2nd expander emulator address to use . Set to 0 to disable.
relayAddr1: "0" # relay module emulation (4204) addresses. Set to 0 to disable
relayAddr2: "0"
relayAddr3: "0"
relayAddr4: "0"
Woohoo! I can start playing around with a config and once I get everything setup, I can possibly add some notes to the documentation.
Excellent. I'll polish up the code to fix the esp32 compilation issues and push an update.
Yes, the documentation could use some work.
Hi,
I'm trying to compile for an ESP32 and it fails. Here are my changes:
I'd also appreciate knowing if there are any other changes I need to make to get this to work with an ESP32. I've connected GREEN to 21 and YELLOW to 22, respectively. And I'm not using the green monitor (not sure if I will yet or not).
Thanks for your help!
Here is the compilation output: