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

Cannot import name 'user' #66

Closed radokristof closed 5 years ago

radokristof commented 5 years ago

System IP150 panel

Describe the bug Hi everyone! I'm trying to migrate my system to this interface. However I'm facing issues even with starting it. I'm trying to use it with Docker. I have modified the conf file and mounted it to the appropriate file in the container. However starting the container produces this error:

Traceback (most recent call last): File "run.py", line 1, in <module> from paradox import main File "/opt/paradox/paradox/main.py", line 16, in <module> from config import user as cfg ImportError: cannot import name 'user' I don't really know what the problem can be. Maybe someone can help?

Thanks!

radokristof commented 5 years ago

Also where the logs stored in the container? What is the easiest way to have a look at the logs? (But I assume that there are not too much, because this happens right on startup).

radokristof commented 5 years ago

I was able to get it running manually. However it would be great to have it in Docker. Also I get a lot of connection error in the log now, is this normal? (codec can't decode byte... and then unable to connect, but after it connects). Secondly, I can only see paradox/events and paradox/interface/MQTTinterface topic in MQTT, all others are missing.

Hope someone can help me out...

Ps.: Now I see that this is the error why it can't get through (however if some zone is open I can see that it detects it), but this error causes to reinitiate the connection.

This is exactly the error I get: Traceback (most recent call last): File "/etc/pai/paradox/paradox.py", line 157, in connect self.panel.update_labels() File "/etc/pai/paradox/hardware/spectra_magellan/panel.py", line 62, in update_labels super(Panel, self).update_labels() File "/etc/pai/paradox/hardware/panel.py", line 150, in update_labels label_offset=elem_def['label_offset']) File "/etc/pai/paradox/hardware/panel.py", line 195, in load_labels .decode('utf-8') UnicodeDecodeError: 'utf-8' codec can't decode byte 0x9d in position 4: invalid start byte ERROR:PAI.paradox.paradox:Connect error Traceback (most recent call last): File "/etc/pai/paradox/paradox.py", line 157, in connect self.panel.update_labels() File "/etc/pai/paradox/hardware/spectra_magellan/panel.py", line 62, in update_labels super(Panel, self).update_labels() File "/etc/pai/paradox/hardware/panel.py", line 150, in update_labels label_offset=elem_def['label_offset']) File "/etc/pai/paradox/hardware/panel.py", line 195, in load_labels .decode('utf-8') UnicodeDecodeError: 'utf-8' codec can't decode byte 0x9d in position 4: invalid start byte

yozik04 commented 5 years ago

What panel it is about?

radokristof commented 5 years ago

It is an SP5500 (which is also detected correctly by this script as I can see it in the logs).

radokristof commented 5 years ago

Also I don't know where I have to set the Panel User Code which I have to enter when I want to access the module. I can only set the Module Password.

yozik04 commented 5 years ago

Do you have any special symbols in partition/zone names?

radokristof commented 5 years ago

What translates here as special characters? I have spaces and dots in some of the names but nothing unusual except these (only English characters)

yozik04 commented 5 years ago

Then you need to send full debug log to @jpbarraca so he can check what is wrong.

jpbarraca commented 5 years ago

Yes. Please use gitter or my email

radokristof commented 5 years ago

I have sent a private message on Gitter

yozik04 commented 5 years ago

Docker jpbarraca/pai:dev should work, I think.

yozik04 commented 5 years ago

docker run -v <host_conf_path>:/etc/pai:ro -v <host_log_path>:/var/log/pai:rw jpbarraca/pai:dev

yozik04 commented 5 years ago

when you run first time it should create default pai.conf in

radokristof commented 5 years ago

Thanks, I will use it that way in my final config (Docker). However now the second problem is more important, because it will happen anyway, so we have to fix it that one first (@jpbarraca is currently looking into my issue). Hope someone else will also benefit from this problem...

yozik04 commented 5 years ago

Was it resolved?

I see @jpbarraca did some commits about label encoding.

radokristof commented 5 years ago

Yes, using alternative encoding (latin2) it works. I haven't tried it with Docker yet, but I suppose it works there also.

yozik04 commented 5 years ago

Great!

radokristof commented 5 years ago

It is working with Docker too, except 1 thing... It won't publish to MQTT. I can see it in the log that zone states changes, but not in MQTT... Running manually from Python with the same config (the same config file is added to Docker as a volume), it works. What I'm missing?

Ps.: I think I know by now I wrote down this... Network is not exposed to Docker...