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

TypeError: string indices must be integers #189

Closed carels closed 1 year ago

carels commented 3 years ago

Alarm system

SP600 Panel IP150 with Insite Gold v4.42.002 firmware

Environment

Hassio

Git branch

I've tested both current dev and production

Describe the bug

Unable to connect to the IP150. Getting an error which seems to suggest the serial number is in the incorrect format.

To Reproduce

This is a recently installed alarm, I can reach the web interface on port 80 and enter my code to access the IP150, but with very limited setting (no zone statuses, etc). Insite Gold is active and working. My config (I have replaced sensitive parts):

CONNECTION_TYPE: IP IP_CONNECTION_HOST: aaa.bbb.ccc.ddd IP_CONNECTION_PORT: 10000 IP_CONNECTION_PASSWORD: paradox IP_CONNECTION_SITEID: MYHOUSE IP_CONNECTION_EMAIL: xxxxx@aaaa.bbb IP_CONNECTION_PANEL_SERIAL: 1111AA2BB IP_CONNECTION_BARE: false PASSWORD: '1111'

Logs

Attached. pai-debug-log-2020-11-15.txt

carels commented 3 years ago

Still getting this error:

2020-12-02 19:08:37,442 - ERROR    - PAI - Unable to connect to alarm
2020-12-02 19:08:38,454 - ERROR    - PAI.paradox.connections.ip.connection - Unhandled exception while connecting (try 1/3)
Traceback (most recent call last):
  File "/usr/local/lib/python3.7/site-packages/paradox/connections/ip/connection.py", line 30, in connect
    await self._try_connect()
  File "/usr/local/lib/python3.7/site-packages/paradox/connections/ip/connection.py", line 147, in _try_connect
    await self.stun_session.connect()
  File "/usr/local/lib/python3.7/site-packages/paradox/connections/ip/stun_session.py", line 49, in connect
    module["panelSerial"]
TypeError: string indices must be integers

It appears module["panelSerial"] is expected to be an integer, but my serial number is in hex. Any thoughts about possible causes?

I don't know Python that well otherwise I would do some debugging myself...

Kind Regards, Carel

yozik04 commented 3 years ago

Please use local connection instead of stun. In hassio it really hard to install debug versions and we will not be able to debug properly.

carels commented 3 years ago

Is this by setting:

IP_CONNECTION_BARE: true ?

It looks better, but I'm now getting:

2020-12-03 18:53:59,004 - INFO     - PAI.paradox.paradox - Connecting to Panel
2020-12-03 18:54:04,022 - ERROR    - PAI.paradox.paradox - Timeout while connecting to panel. Is an other connection active?
2020-12-03 18:54:04,025 - ERROR    - PAI - Unable to connect to alarm

I don't have anything else connected, but the panel is on Onsite Gold. Should that be removed first or will it be able to run with both active?

Kind Regards, Carel

jpbarraca commented 3 years ago

The panels only support one connection at a time.

carels commented 3 years ago

The panels only support one connection at a time.

Hi jpbarraca, that doesn't really answer my question. The PAI addon is a client, connecting to port 10,000 on the IP150 on their "software" port. There is also the web interface on port 80 which gives you access to configure some parts of the IP150 module. Both these connections are from a client to the IP150 which acts as a service. "One connection at a time" is very vague. Is this one connection to each of the services that are running on the IP150? i.e. if someone is logged in on the web port (port 80), does that mean the software port (port 10,000) is also unavailable? Or does it just mean one connection on port 80 at a time?

Also, Onsite Gold is an outbound connection as there are no inbound firewall rules set up. If this counts as the "one connection at a time", then why can I log in to the web port while onsite gold is configured and enabled?

Kind Regards, Carel

yozik04 commented 3 years ago

IP_CONNECTION_BARE needs to be False in your setup. You are using ip150. One connection at a time means: Nothing should be connected to your ip150 module. It can be connection from its own web page or insite gold or Babyware or other configuration programs.

yozik04 commented 3 years ago

if you have not entered user pin code in Insite Gold then it should not be connected. If you plan to use PAI you will have to forget about Insite Gold. Both wont work at the same time.

carels commented 3 years ago

OK, in case this helps someone else with the same issue:

Fix to the TypeError: string indices must be integers error:

However, I am now getting: 2021-01-05 13:55:19,027 - ERROR - PAI.paradox.paradox - Timeout while connecting to panel. Is an other connection active?

I have change the config settings: IP_CONNECTION_SITEID: None IP_CONNECTION_EMAIL: None IP_CONNECTION_PANEL_SERIAL: None

However, still the same error. I have:

Any suggestions here?

Thanks, Carel

yozik04 commented 3 years ago

IP_CONNECTION_BARE is not your case. It is for people without IP150 module who hooked up their DIY stuff to panels serial port.

yozik04 commented 3 years ago

Please follow the manual: https://github.com/ParadoxAlarmInterface/pai/wiki/Connection-methods#ip-module-connection-IP100-IP150

carels commented 3 years ago

Thanks for that link, I have:

Still got the same error, however, I set IP_CONNECTION_BARE back to false and that got around the issue.

This resulted in an "Invalid PC Password" error, so I connected via Babyware and set a PC Password since "None" didn't work.

So, now it does seem to partially work. I get connected to the IP150, sometimes some zones are being retrieved, but usually I get these warnings and errors:

ERROR    - PAI.paradox.paradox - Timeout while connecting to panel. Is an other connection active?
ERROR    - PAI - Unable to connect to alarm

I then copied the LIMIT sample from the sample config across and modified for yaml and removed partitions from the list. As similar thing happens (looks like the longer it runs the better it communicates with the paradox. First it disconnected on the above error after "Updating Definitions from Panel", it then reconnected and managed to pass this point and read the zones, then it disconnected and went through and seems like it is configured now (with the LIMIT configured) and the zones, doors, keypads, etc (but not partitions) loaded and a "Running" status in the logs.

Got the integration going as per doc (https://github.com/ParadoxAlarmInterface/pai/wiki/Home-Assistant-integration) and appears to be working (can't test arm/disarm right now, but will shortly).

So other than not having been able to fully test yet, it would appear the only issues I have are:

Thanks for the assistance, took me 2 months, but managed to get there! :)

yozik04 commented 3 years ago

Why you have not found the wiki page? It was always there.