Tertiush / ParadoxIP150v2

Python-based IP150 'middle-ware' that uses the IP module's software port for monitoring and control of the alarm via an MQTT Broker.
Eclipse Public License 1.0
73 stars 35 forks source link

Is it working? (IP150-MQTTv2.py running, logging into Alarm working, MQTT logging working, but nothing else?) #2

Closed ghost closed 8 years ago

ghost commented 8 years ago

Hi Tertius, I am very excited about this development. I loaded the 2nd version, but not sure it is working?

Got all in as per your instructions. I get in MQTT-Spy the standard output, one line for instance:

Paradox/Labels/BusModules 1:;2:;3:;4:;5:;6:;7:;8:;9:;10:;11:;12:;13:;14:;15:

Although this is seams like standard what should be there and not what is on my alarm.

But, I see - even with config.ini having Startup_Update_All_Labels = True, MQTT does not have Topic_Publish_Labels.

See for instance if I query about status of background task below, it seams it is running fine here....

pi@raspberrypi:~ $ sudo systemctl status IP150-MQTTv2.service ● IP150-MQTTv2.service - My Script Service Loaded: loaded (/lib/systemd/system/IP150-MQTTv2.service; disabled) Active: active (running) since Fri 2016-05-27 22:27:36 SAST; 15h ago Main PID: 1753 (python) CGroup: /system.slice/IP150-MQTTv2.service └─1753 /usr/bin/python /opt/ParadoxIP150v2/IP150-MQTTv2.py


And, if I start it by hand, "python IP150-MQTTv2.py", I get below, thus seams to be working, logging into MQTT and the alarm.

pi@raspberrypi:/opt/ParadoxIP150v2 $ python IP150-MQTTv2.py Reading config.ini file... config.ini file read successfully Attempting connection to MQTT Broker: 192.168.2.11:1883 MQTT client subscribed to control messages on topic: Paradox/C/# Connected to MQTT broker with result code 0 Logging into alarm system... Login to alarm panel successful

Updating all labels from alarm

But, If I try to interact with the alarm via MQTT, for instance, publishing topic "Paradox/C/P1/Arm" in MQTT-Spy, it is received on the console, but does nothing on the alarm? See console feedback:

MQTT Message: Paradox/C/P1/Arm Alarm control partition: 1 Alarm control state: Arm . Logging into alarm system... Login to alarm panel successful

Sending generic Alarm Control: Partition: 1, State: ARM

Tertiush commented 8 years ago

Hi

Which alarm do do you have? I know the EVO series is not yet compatible. The MG and SP series should work fine.

ghost commented 8 years ago

MG5050, firmware version 4.97

Tertiush commented 8 years ago

In the config file, switch the debug level to 2. Then post the result here, just remove the first raw data as that contains your password.

ghost commented 8 years ago

Like this?

JRMG5050-output.txt

Tertiush commented 8 years ago

If the debug level is set to 2 there should be considerably more output, especially the raw data which I'm after. Let me have a look at the code as to why there isn't more raw data....

ghost commented 8 years ago

Cut and past from nano config.ini

[MQTT Topics] Topic_Publish_Events = Paradox/Events ;The main topic used to publish all events Events_Payload_Numeric = 1 ;0=Events are reported using numeric value [not replaced by the dictionary]. 1=Events are translated to more meaningfull text from th$ Topic_Subscribe_Control = Paradox/C/ ;All controls are given through this high-level topic Startup_Publish_All_Info = True ;Upon startup publish all labels from the alarm (configured names of things), only application when reading (updating) labels Topic_Publish_Labels = Paradox/Labels ;The topic used to publish labels

[Application] Debug_Mode = 2 ;0=Minimal, 1=Basic, 2=Verbose Startup_Update_All_Labels = True ;Upon startup collect all labels from the alarm (configured names of things). Required for config item: Topic_Publish_Labels

Tertiush commented 8 years ago

There was a few issues in the code regarding debug message. I've just uploaded a new file. Download and try with debug mode 2 again, it should give a lot more data this time round.

ghost commented 8 years ago

Here you go, the output. (removed link - pwd)

Tertiush commented 8 years ago

I had a quick look but couldn't see anything definitive. Will have a look again tomorrow. You don't perhaps have anything else connected to the ip module at the same time? I know the script gives this behaviour when the port is in use by another application.

ghost commented 8 years ago

I have the iParadox app running on iPhone connected, but did not use it at all. Have it loaded on damily phones, will check all their apps are closed, will then recheck.

On Saturday, 28 May 2016, Tertius notifications@github.com wrote:

I had a quick look but couldn't see anything definitive. Will have a look again tomorrow. You don't perhaps have anything else connected to the ip module at the same time? I know the script gives this behaviour when the port is in use by another application.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/Tertiush/ParadoxIP150v2/issues/2#issuecomment-222318920, or mute the thread https://github.com/notifications/unsubscribe/APgUS0hXL-9f79eWXXfMKhP1cwBWJ3QGks5qGHZBgaJpZM4IpD3c .

Tertiush commented 8 years ago

Ok, I had a closer look. It seems like your login is successful, however for some reason the alarm is not unlocked [some additional step after login] so you cannot read back labels or send any controls. Have you checked whether events work?.... In the config file set the numeric topic publish to 1, then start the app and once it's polling trigger some motion sensors. If you see the events then I at least that's working for now. Let me know pls, I will see if I can pick up some pattern in your logs as to why the 'unlocking' is not working.

ghost commented 8 years ago

I do see the sensor events in the python interface ( if not started with background script) but not back in the mqtt interface. Your v1 did bring back to mqtt.

On Saturday, 28 May 2016, Tertius notifications@github.com wrote:

Ok, I had a closer look. It seems like your login is successful, however for some reason the alarm is not unlocked [some additional step after login] so you cannot read back labels or send any controls. Have you checked whether events work?.... In the config file set the numeric topic publish to 1, then start the app and once it's polling trigger some motion sensors. If you see the events then I at least that's working for now. Let me know pls, I will see if I can pick up some pattern in your logs as to why the 'unlocking' is not working.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/Tertiush/ParadoxIP150v2/issues/2#issuecomment-222328848, or mute the thread https://github.com/notifications/unsubscribe/APgUS1E8XMlNtykXxh3eZsn2RDbD-6nKks5qGKkxgaJpZM4IpD3c .

Tertiush commented 8 years ago

Its a bit of a long shot, but give this one a go: Paradox 2.0.zip

Just update the config file again with your alarm's settings. Regarding the events, subscribe to the entire Paradox/# topic and see if the topic is coming through correctly?

ghost commented 8 years ago

Hi Tertius, log file attached. I see it is saying it is reading the topics, but not coming through.

(removed file - pwd)

ghost commented 8 years ago

Tertius, trying to check on my setup what else except iParadox iPhone clients also connects to the IP150, and I have this Paradox internet service, with reverse DNS, for access over 3G to the alarm? On the IP150 web interface. paradoxmyhome

ghost commented 8 years ago

Also checked Python on the RasPi: Python 2.7.9 (default, Mar 8 2015, 00:52:26)

Tertiush commented 8 years ago

There's really only one way we can possibly fix this: You need to get a hold of Paradox's winload software and do a wireshark capture whilst logging in. Just make sure you disable encryption as mentioned in my readme page. Then I can look at the differences and compensate for them. I found a link here: http://www.didarc.com/downloads/paradox-software

ghost commented 8 years ago

I have got Winload, will do. What do I need to do on Winload for it to generate packets?

On Sunday, 29 May 2016, Tertius notifications@github.com wrote:

There's really only one way we can possibly fix this: You need to get a hold of Paradox's winload software and do a wireshark capture whilst logging in. Just make sure you disable encryption as mentioned in my readme page. Then I can look at the differences and compensate for them. I found a link here: http://www.didarc.com/downloads/paradox-software http://url

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/Tertiush/ParadoxIP150v2/issues/2#issuecomment-222347690, or mute the thread https://github.com/notifications/unsubscribe/APgUS6dK33BqiFGON_rTVdrAP10MPIJtks5qGUVjgaJpZM4IpD3c .

Tertiush commented 8 years ago

After disabling encryption, open winload and add a mg5050. Then connect to it with your ip address and IP module password. While connecting record with wireshark the packets.

ghost commented 8 years ago

Wireshark & Winload. Not sure if I did it correctly, the txt file I exported from wireshark, the other one (.pcapng) saved when I exited Wireshark. Let me know if I need to redo this. (removed file - pwd)

Tertiush commented 8 years ago

Its the right data, but its still encrypted. Set encryption to FALSE then redo pls.

From the readme: ...get Paradox's Winload software. Then within it's root folder find a file called COM.ini and change the 'IPEncrypted' setting to FALSE.

ghost commented 8 years ago

Apologies, did not understand. Correct info in the file now? (removed file - pwd)

Tertiush commented 8 years ago

Its unencrypted this time, but I cannot see the login. Did you have wireshark running whilst connecting or was it already connected? The first few packets up and down is important.

ghost commented 8 years ago

Was running, will do again.

ghost commented 8 years ago

And now? (removed file - pwd)

Tertiush commented 8 years ago

Lol, yes this one seems correct. I will have a look and get back some time later.

Tertiush commented 8 years ago

Ok, found something. give this one a go:

IP150-MQTTv2.zip

ghost commented 8 years ago

Sorry, missed that you posted again, will try 2row night

ghost commented 8 years ago

With the IP150-MQTTv2.zip above:

MQTT login successful, alarm login successful, but no labels yet. 8-(

pi@raspberrypi:/opt/ParadoxIP150v2 $ python IP150-MQTTv2.py Reading config.ini file... config.ini file read successfully Attempting connection to MQTT Broker: 192.168.2.11:1883 Connected to MQTT broker with result code 0 MQTT client subscribed to control messages on topic: Paradox/C/# Logging into alarm system... Login to alarm panel successful Updating all labels from alarm Labels detected for wirelessKeypadLabel: {1: '', 2: '', 3: '', 4: '', 5: '', 6: '', 7: '', 8: ''} Labels detected for wirelessSirenLabel: {1: '', 2: '', 3: '', 4: ''} Labels detected for siteNameLabel: {1: ''} Labels detected for partitionLabel: {1: '', 2: ''} Labels detected for wirelessRepeaterLabel: {1: '', 2: ''} Labels detected for outputLabel: {1: '', 2: '', 3: '', 4: '', 5: '', 6: '', 7: '', 8: '', 9: '', 10: '', 11: '', 12: '', 13: '', 14: '', 15: '', 16: ''} Labels detected for zoneLabel: {1: '', 2: '', 3: '', 4: '', 5: '', 6: '', 7: '', 8: '', 9: '', 10: '', 11: '', 12: '', 13: '', 14: '', 15: '', 16: '', 17: '', 18: '', 19: '', 20: '', 21: '', 22: '', 23: '', 24: '', 25: '', 26: '', 27: '', 28: '', 29: '', 30: '', 31: '', 32: '', 99: 'Any zone'} Labels detected for userLabel: {1: '', 2: '', 3: '', 4: '', 5: '', 6: '', 7: '', 8: '', 9: '', 10: '', 11: '', 12: '', 13: '', 14: '', 15: '', 16: '', 17: '', 18: '', 19: '', 20: '', 21: '', 22: '', 23: '', 24: '', 25: '', 26: '', 27: '', 28: '', 29: '', 30: '', 31: '', 32: ''} Labels detected for busModuleLabel: {1: '', 2: '', 3: '', 4: '', 5: '', 6: '', 7: '', 8: '', 9: '', 10: '', 11: '', 12: '', 13: '', 14: '', 15: ''} Listening for events...

.

Tertiush commented 8 years ago

Oh well was worth a try. Can you send the output with the debug @ 2. Remove the very first packet sent from the output as that contains your password. I'm eager to see where it fails this time round.

andrewb-nz commented 8 years ago

Hey, Not sure if it is the same problem being faced above or due to my alarm system being a different model (Paradox SP4000) When I connect I am getting the same blank labels. Log attached output.txt

Tertiush commented 8 years ago

In you instance it looks like the login and unlocking is successful, so not quite sure why the labels isn't updating. The quickest way for the to diagnose the issue is to have direct access to one of these alarms. If anyone is willing please pm me in the openhab forum. In the interim I'll have a closer look at the logs, maybe I'll pick something up.

ghost commented 8 years ago

Here we go.

(link removed)

Tertiush commented 8 years ago

The login seems fine. What I am suspecting is that the labels are actually stored in different registers than the MG5050. To confirm this I need someone to do a wireshark capture whilst using Winload to download the labels. To do this open winload, then on the left click the "Open Device Programming Sheet" button. Then for each tab with labels (Zones, PGM, Users, Keypads, etc....) read the labels => To do this, whilst the tab is open ensure at the bottom its selected to "Current Page" and the first button is selected as "Panel to PC", i.e. reading back. Then start the wireshark capture and in winload click "start" to start the read. Do this for each of the label types.

ghost commented 8 years ago

I will do it tomorrow night.

andrewb-nz commented 8 years ago

Unfortunately it appears the SP4000 that I have is not compatible with Winload, we i try and connect to the alarm with winload I get a connection error. I can however connect successfully with Babyware. Would the wireshark output work with this?

ghost commented 8 years ago

(removed link)

Tertiush commented 8 years ago

At least the good news is the registers seems to be the exact same! However, I found another minor discrepancy that after fixed still works with my alarm, so please try this script:

IP150-MQTTv2.zip

ghost commented 8 years ago

Now I get below output on MQTT, see log file, but have checked, nothing else logged into IP150.

State Machine 2, Failed to login & unlock to IP module, check if another app is using the port. Retrying...

Check the 4 x iPhones with access to the IP150 via iParadox, none were logged in.

paradox.txt

Tertiush commented 8 years ago

That's bizarre, your logins were always fine. Can you send a wireshark whilst the script is trying to login? Also are you sure your password and settings are still fine?

andrewb-nz commented 8 years ago

Still the same on my system with that version. log.txt

ghost commented 8 years ago

Oops, you are correct, forgot to point to latest password in config.ini. SORRY ! Trying again now.

ghost commented 8 years ago

Logging into alarm successful, but labels not coming down. paradox.txt

Tertiush commented 8 years ago

@jroux1 Try with this one and send the log afterwards please. thanks IP150-MQTTv2.zip

ghost commented 8 years ago

Yaaahhhhhhhh ....... ! IT working!!!!! Do you still need the file?

WELL DONE !!!!!!!!!!!!!!!!!!!!!!!!!! And thank you! mqtt output

Tertiush commented 8 years ago

That's fantastic! It feels like I cracked the Enigma Machine but not sure how, lol. No need for the logs then...

I'll push this code to the main thread soon as I believe others will have similar issues. Thanks for all the logs and captures!

@andrewb-nz I'll still look into your alarm panel issue, perhaps we should rather open a separate, more focused issue for that.