ParadoxAlarmInterface / pai

Paradox Magellan, Spectra and EVO, with MQTT, Signal, Pushbullet, Pushover and others
https://gitter.im/paradox-alarm-interface
Eclipse Public License 2.0
340 stars 91 forks source link

[feature] Fully passive mode on panel serial port #63

Closed kobuki closed 4 years ago

kobuki commented 5 years ago

System SP5500, IP150 v4.10, Linux server (currently)

Describe the bug It's actually a feature request or request for help. I'd like to connect to the serial of my panel to receive events passively (ie. only the panel serial TX connected to a Pi Zero, for instance). I can control my system via other means, but I want to integrate the MQTT event messages in my smart home system.

Is that possible? What would be needed to be changed in the code to accomplish that? There was some discussion in this issue, but OP provided no information on how he did it, nor a PR or fork was provided.

yozik04 commented 5 years ago

It is certainly a feature request. In Babyware it is possible to set events to be broadcasted to serial port without any authentication. So if you read serial TX, then events can be parsed by PAI. There are some drawbacks. PAI can not fetch current alarm status.

kobuki commented 5 years ago

It should be fine as long as I receive arm/disarm events and alerts. From your wording it seems PAI as is now, will attempt authentication, even if I don't issue commands?

yozik04 commented 5 years ago

Yes it will always attempt to authenticate.

kobuki commented 5 years ago

In Babyware it is possible to set events to be broadcasted to serial port without any authentication.

Sorry, it might not be the best place to ask this, but I started BabyWare, connected to the panel, and I'm unable to find such an option. Where should I lookI checked report paths and also communication settings to no avail.

yozik04 commented 5 years ago

Somewhere in panel settings. I saw it for EVO. No idea if SP/MG has this. Do not have Babyware on Mac to lookup...

kobuki commented 5 years ago

I see, thanks. According to this old post by Harizanov, his SP7000 spit out the 37-byte blocks on the serial without much fiddling with anything, so maybe the Spectra series is a bit different. I'll try this out later.

jpbarraca commented 5 years ago

MG and SP will always send events to the serial port.

Currently PAI needs to initialize the panel to load the panel type, and the labels of each zone, partition, module, etc... A simple modification could enable passive mode, and would send all raw events to MQTT. But the panel state cannot be determined with this information..

kobuki commented 5 years ago

Hm, yeah, I guess without basic panel info it's not even possible to correctly decode the events. I think it would work if that basic info dump could be cached in some local data storage and reused when switching on passive mode. Of course, there has to be a first run when one can have PAI store that basic data set.

Or, PAI has a proxy/relay mode. When that's activated, does it publish the events it sees while proxying? This would enable existing tools/official apps/etc to work and also make it possible to receive events via MQTT as in normal operating modes.

jpbarraca commented 5 years ago

It has a proxy mode. Just point winload or babyware to the server where PAI is running, port 10000. But if a connection is detected, it will stop processing all messages. With the new async code this may be possible, but it requires some investigation

yellowonblack commented 5 years ago

I would love to see the same feature as @kobuki requested. Last days I was experimenting with serial connection to my EVO panel (@yozik04 is helping with supporting the new EVO192 firmware version on serial port), and last thing I did last night was to connect the IP150 back to the panel and in the same time hook on Tx and GND pins with a CP2102 USB to UART Bridge Controller to a RPi. In advance I also enabled option in the EVO Panel - Transmit Zone Status on Serial Port. Results: IP150 connection works perfect and on the RPi I can see the packets which are sent by the panel, most probably the 37 Bytes chunks. Also, when the zone status changes, I can see also the zone label in clear text. This might a very good method to receive instant zone status from the panel, because trying the IP method it has quite big delays until you receive a zone status change on MQTT topic.

jpbarraca commented 4 years ago

I created branch to test this concept. Check it out. In order to test, please set: PASSIVE=True CONNECTION_TYPE = 'Serial' PASSIVE_PANEL_TYPE to a string according to your panel. See: paradox/hardware/__init__.py

It will open the serial port and not write anything. Elements and properties will be created as they are found. Errors should be ignored.... Have no idea what in which ways it may crash. Tested with a MG5050 but WITHOUT an IP150. It did not crashed, events went to the appropriate interfaces, and had the correct names, properties and values.

kobuki commented 4 years ago

Hmm, it looks interesting. I'll try this soon.

stale[bot] commented 4 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

zit501 commented 2 years ago

Apologies if this is opening an old thread, but I would really like to know if the above feature is still available in PAI?

I (temporarily) set up PAI to connect to my SP6000 via my IP150 and it worked great! But I always kinda new it would keep a session open on the IP150, and therefore I couldn't connect to the SP6000 via Insight Gold whilst PAI was running. This is an issue for me. All I really want is the status's from the SP6000 to be brought into Home Assistant, and it seems that this could really help.

If it's still available I'll move my Home Assistant Raspberry Pi closer to my IP150 so I can direct connect to the IP150 serial out and simply make use of the passive serial output.

Unless anyone else has any ideas of multiple connections to the SP6000? Panel eBus?

kobuki commented 2 years ago

Unfortunately when I got to try this, the relevant branch was removed and since I didn't want to bother the devs any more I dropped the idea, although if it worked in some way, I'd still use it, for the same purpose - status checks in HA.

yozik04 commented 2 years ago

As we did not had any feedback on the feature I think the code was dropped. It is a large overhead to maintain separate branches.

zit501 commented 2 years ago

That's understood Yozik. If the code is still available somehow, I would like to test/use it.

In order to maintain my native Paradox IP functionality, I simply want to get zone and alarm status from the IP150. I can drive Arm/Disarm and PGM from Home assistant via a separate ESP relay board using key-switch zone input.

I'm wondering though. Surely the PCS250, when connected via an IP150, doesn't hold a serial connection open with the panel. So does the PCS250 simply listen to the serial bus for status info, and send SMS's out based on this. Then if I sent an SMS to arm the system, the PCS250 opens a serial connection and arms the system, then closes the serial connection?

yozik04 commented 2 years ago

PAI Works Babyware way. If you connect with Babyware to the panel it will also be locked out for other connections.

zit501 commented 2 years ago

Yes sure. I only rarely connect via Babyware to make changes to the configuration of the panel. The main reason for keeping the Swan service alive is that it's easier for other users of the alarm to simply use the Insight Gold app, and I don't need to have full functionality of the panel programmed into my Home Assistant.

yozik04 commented 2 years ago

I understand the frustration of inability to use Insite Gold together with PAI. But this is what we have now. We could implement connection via Insite Gold protocol but it requires a lot of reverse engineering effort, plenty of time and big motivation + skills. I would be happy to accept any Pull Requests.

zit501 commented 2 years ago

Of course, I understand. Thanks for the efforts on what's here already. It worked flawlessly for me when I tried it.