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

Cyrillic zone labels #23

Open pzd060 opened 6 years ago

pzd060 commented 6 years ago

Hi Tertiush,

I've managed to run what you have done in hassbian as a daemon. I am reading from MQTT. However I am having some problems because my Zone Labels are in Cyrillic and it does not seem to recognize what needs to be printed. This is the error I am getting.

 Get zone definitions
Alarm Name:  Your Paradox System
Area Names:  ['"A\xe2\x85\x93ap\xc2\xbca\xc2\xb6e\xc2\xbd\xc2\xbc"', '"o\xc6\x92ap"', '"Area 3"', '"Area 4"', '"Area 5"', '"Area 6"', '"Area 7"', '"Area 8"']
Zone Names & Partition assignment:  ['1', '"Bxo"', '0', '" "', '1', '"Xo"', '0', '" "', '2', '"o\xc6\x92ap Xo"', '1', '"Kyx\xc2\xbd"', '2', '"o\xc6\x92ap Kyx\xc2\xbd"', '0', '" "', '1', '"\xc3\x8eoc\xc2\xbc\xc2\xbda"', '0', '" "', '1', '"e\xc2\xbcc a"', '0', '" "', '1', '"C\xe2\x85\x93a \xc2\xbd"', '0', '" "', '2', '"o\xc6\x92ap Bxo"', '0', '" "', '1', '"Bpa\xc2\xbca Kyx\xc2\xbd"', '1', '"\xc3\x8eo  \xc2\xb6a Bpa\xc2\xbca Xo"', '1', '"po\xc2\xa3 Kyx\xc2\xbd"', '1', '"po\xc2\xa3 Xo"', '1', '"Bpa\xc2\xbca C\xe2\x85\x93a \xc2\xbd"', '1', '"po\xc2\xa3 C\xe2\x85\x93a \xc2\xbd"', '1', '"po\xc2\xa3  e\xc2\xbcc a"', '1', '"Bpa\xc2\xbca  e\xc2\xbcc a"', '1', '"po\xc2\xa3 \xc3\x8eoc\xc2\xbc\xc2\xbda"', '0', '" "', '0', '" "', '0', '" "', '0', '" "', '0', '" "', '0', '" "', '0', '" "', '1', '"Bxo \xc2\xbda Bpa\xc2\xbca"', '0', '" "', '0', '" "', '0', '" "', '0', '" "', '0', '" "', '0', '" "', '0', '" "', '0', '" "', '0', '" "', '0', '" "', '0', '" "', '0', '" "', '0', '" "', '0', '" "', '0', '" "', '']
Zone Names (Total: 48):  ['1', '"Bxo"', '0', '" "', '1', '"Xo"', '0', '" "', '2', '"o\xc6\x92ap Xo"', '1', '"Kyx\xc2\xbd"', '2', '"o\xc6\x92ap Kyx\xc2\xbd"', '0', '" "', '1', '"\xc3\x8eoc\xc2\xbc\xc2\xbda"', '0', '" "', '1', '"e\xc2\xbcc a"', '0', '" "', '1', '"C\xe2\x85\x93a \xc2\xbd"', '0', '" "', '2', '"o\xc6\x92ap Bxo"', '0', '" "', '1', '"Bpa\xc2\xbca Kyx\xc2\xbd"', '1', '"\xc3\x8eo  \xc2\xb6a Bpa\xc2\xbca Xo"', '1', '"po\xc2\xa3 Kyx\xc2\xbd"', '1', '"po\xc2\xa3 Xo"', '1', '"Bpa\xc2\xbca C\xe2\x85\x93a \xc2\xbd"', '1', '"po\xc2\xa3 C\xe2\x85\x93a \xc2\xbd"', '1', '"po\xc2\xa3  e\xc2\xbcc a"', '1', '"Bpa\xc2\xbca  e\xc2\xbcc a"', '1', '"po\xc2\xa3 \xc3\x8eoc\xc2\xbc\xc2\xbda"', '0', '" "', '0', '" "', '0', '" "', '0', '" "', '0', '" "', '0', '" "', '0', '" "', '1', '"Bxo \xc2\xbda Bpa\xc2\xbca"', '0', '" "', '0', '" "', '0', '" "', '0', '" "', '0', '" "', '0', '" "', '0', '" "', '0', '" "', '0', '" "', '0', '" "', '0', '" "', '0', '" "', '0', '" "', '0', '" "', '0', '" "', '']
Going to State_Machine  3
Connected and polling data every 0.5s
.
Error within State_Machine: 3: UnicodeDecodeError('ascii', 'S:CLOSED,P:2,N:"o\xc6\x92ap Xo"', 17, 18, 'ordinal not in range(128)')
Going to State_Machine: 2
Attempting connection to IP module: 192.168.0.106:80
No connection to IP Module, are you already logged in? Attempting logout and trying again... (3)
Disconnect OK received from IP Module

This is the part that is problematic: Error within State_Machine: 3: UnicodeDecodeError('ascii', 'S:CLOSED,P:2,N:"o\xc6\x92ap Xo"', 17, 18, 'ordinal not in range(128)')

Can you lend a hand of encoding with utf-8 when I'm reading the lables.

Thanks, Plamen

pzd060 commented 6 years ago

Update: I saw I used the first version (IP150-MQTT.py). I tried using IP150-MQTTv2.py which is the latest. However, it is again with an error, I think again because of the encoding:

root@hassbian:/home/pi/paradox2# python IP150-MQTTv2.py
logging to file /var/log/paradoxip.log
reading  config
INFO:root:logging complete
2017-12-17 21:07:35,663 INFO logging complete
ERROR:root:test
2017-12-17 21:07:35,664 ERROR test
INFO:root:Setting loglevel to debug
2017-12-17 21:07:35,665 INFO Setting loglevel to debug
DEBUG:root:Logging Set to debug
2017-12-17 21:07:35,666 DEBUG Logging Set to debug
INFO:root:logging set to debug
2017-12-17 21:07:35,667 INFO logging set to debug
INFO:root:config.ini file read successfully: 2
2017-12-17 21:07:35,668 INFO config.ini file read successfully: 2
config read
INFO:root:State01:Attempting connection to MQTT Broker: 127.0.0.1:1883
2017-12-17 21:07:35,668 INFO State01:Attempting connection to MQTT Broker: 127.0.0.1:1883
INFO:root:Connected to MQTT broker with result code 5
2017-12-17 21:07:35,673 INFO Connected to MQTT broker with result code 5
INFO:root:State01:MQTT client subscribed to control messages on topic: Paradox/C/#
2017-12-17 21:07:35,674 INFO State01:MQTT client subscribed to control messages on topic: Paradox/C/#
INFO:root:State02:Connecting to IP Module
2017-12-17 21:07:35,676 INFO State02:Connecting to IP Module
trying to connect 192.168.0.106
INFO:root:Connecting to 192.168.0.106
2017-12-17 21:07:35,676 INFO Connecting to 192.168.0.106
connected
INFO:root:Logging into alarm system...
2017-12-17 21:07:35,680 INFO Logging into alarm system...
DEBUG:root:32->   0xaa 0xa 0x0 0x3 0x8 0xf0 0x0 0xa 0xee 0xee 0xee 0xee 0xee 0xee 0xee 0xee 0x69 0x76 0x70 0x6c 0x7a 0x64 0x31 0x39 0x36 0x35 0xee 0xee 0xee 0xee 0xee 0xee
2017-12-17 21:07:35,681 DEBUG 32->   0xaa 0xa 0x0 0x3 0x8 0xf0 0x0 0xa 0xee 0xee 0xee 0xee 0xee 0xee 0xee 0xee 0x69 0x76 0x70 0x6c 0x7a 0x64 0x31 0x39 0x36 0x35 0xee 0xee 0xee 0xee 0xee 0xee
INFO:root:Connected to MQTT broker with result code 5
2017-12-17 21:07:36,678 INFO Connected to MQTT broker with result code 5
INFO:root:Connected to MQTT broker with result code 5
2017-12-17 21:07:37,684 INFO Connected to MQTT broker with result code 5
ERROR:root:State02:Error attempting connection to IP module (3): string index out of range
2017-12-17 21:07:37,934 ERROR State02:Error attempting connection to IP module (3): string index out of range
INFO:root:Connected to MQTT broker with result code 5