Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot connect via https #31

Open
steppatrik opened this issue Mar 29, 2024 · 7 comments
Open

Cannot connect via https #31

steppatrik opened this issue Mar 29, 2024 · 7 comments

Comments

@steppatrik
Copy link

Describe the problem
Hi, I have problem right after installation - installation went OK with no issue, after that, I cannot load web page for configuring.. tryied https/http variant, various ports and logins, nothing worked.. I have raspberry 3B

localhost address giving me:
This site can’t be reached
192.168.1.110 refused to connect

Code after running main script:

pi@raspberrypi:/opt/AlarmPI $ sudo python3 run.py
Exception in thread Thread-1:
2024-03-29 23:13:57 [INFO] [notifier:__init__:445]  ------------ INIT FOR DOOR SENSOR CLASS! ----------------
Traceback (most recent call last):
  File "/usr/lib/python3.9/threading.py", line 954, in _bootstrap_inner
Exception ignored in: <function Client.__del__ at 0x751f9928>
Traceback (most recent call last):
  File "/usr/local/lib/python3.9/dist-packages/paho/mqtt/client.py", line 874, in __del__
    self.run()
  File "/usr/lib/python3.9/threading.py", line 892, in run
    self._reset_sockets()
  File "/usr/local/lib/python3.9/dist-packages/paho/mqtt/client.py", line 1133, in _reset_sockets
    self._target(*self._args, **self._kwargs)
  File "/opt/AlarmPI/alarmcode/logs.py", line 83, in trimLogFile
    with open(self.logfile, 'r') as f:
FileNotFoundError: [Errno 2] No such file or directory: '/opt/AlarmPI/alert.log'
    self._sock_close()
  File "/usr/local/lib/python3.9/dist-packages/paho/mqtt/client.py", line 1119, in _sock_close
    if not self._sock:
AttributeError: 'Client' object has no attribute '_sock'
2024-03-29 23:13:57 [ERROR] [run:<module>:53]  Unknown error has occured Contact Author:
Traceback (most recent call last):
  File "/opt/AlarmPI/run.py", line 50, in <module>
    myserver.startMyApp()
  File "/opt/AlarmPI/alarmcode/alarmpi.py", line 367, in startMyApp
    self.users[user]['obj'] = Worker(
  File "/opt/AlarmPI/alarmcode/Worker.py", line 44, in __init__
    self.mynotify = Notify(self.wd, self.settings, self.optsUpdateUI, self.mylogs)
  File "/opt/AlarmPI/alarmcode/notifier.py", line 449, in __init__
    self.mqtt = notifyMQTT(self.settings, self.optsUpdateUI, self.mylogs, self.callbacks)
  File "/opt/AlarmPI/alarmcode/notifier.py", line 103, in __init__
    self.setupMQTT()
  File "/opt/AlarmPI/alarmcode/notifier.py", line 122, in setupMQTT
    self.mqttclient = mqtt.Client(client_id=str(random.randint(1,10000)), clean_session=False)
TypeError: __init__() missing 1 required positional argument: 'callback_api_version'

OS Version

pi@raspberrypi:/opt/AlarmPI $ lsb_release -a
No LSB modules are available.
Distributor ID:	Raspbian
Description:	Raspbian GNU/Linux 11 (bullseye)
Release:	11
Codename:	bullseye

AlarmPI version

pi@raspberrypi:/opt/AlarmPI $ sudo git rev-parse HEAD
5f7beedc8e3ce2a283912becc427d21cf7b1276a

Error Logs - last run after restart

2024-03-29 23:17:22 [INFO] [notifier:__init__:445]  �[95m------------ INIT FOR DOOR SENSOR CLASS! ----------------�[0m
2024-03-29 23:17:22 [ERROR] [run:<module>:53]  Unknown error has occured Contact Author:
Traceback (most recent call last):
  File "/opt/AlarmPI/run.py", line 50, in <module>
    myserver.startMyApp()
  File "/opt/AlarmPI/alarmcode/alarmpi.py", line 367, in startMyApp
    self.users[user]['obj'] = Worker(
  File "/opt/AlarmPI/alarmcode/Worker.py", line 44, in __init__
    self.mynotify = Notify(self.wd, self.settings, self.optsUpdateUI, self.mylogs)
  File "/opt/AlarmPI/alarmcode/notifier.py", line 449, in __init__
    self.mqtt = notifyMQTT(self.settings, self.optsUpdateUI, self.mylogs, self.callbacks)
  File "/opt/AlarmPI/alarmcode/notifier.py", line 103, in __init__
    self.setupMQTT()
  File "/opt/AlarmPI/alarmcode/notifier.py", line 122, in setupMQTT
    self.mqttclient = mqtt.Client(client_id=str(random.randint(1,10000)), clean_session=False)
TypeError: __init__() missing 1 required positional argument: 'callback_api_version'

Configuration

{
  "http": {
    "enable": false,
    "host": "",
    "https": true,
    "password": "",
    "port": 443,
    "username": "test1"
  },
  "mail": {
    "enable": false,
    "messageBody": "Alert",
    "messageSubject": "Home Security",
    "password": "",
    "recipients": [],
    "smtpPort": 587,
    "smtpServer": "smtp.gmail.com",
    "username": ""
  },
  "mqtt": {
    "authentication": false,
    "command_topic": "home/alarm2/set",
    "enable": false,
    "host": "",
    "password": "",
    "port": 1883,
    "state_topic": "home/alarm2",
    "username": "",
    "homeassistant": false
  },
  "sensors": {},
  "serene": {
    "enable": false,
    "http_start": "",
    "http_stop": "",
    "pin": 14
  },
  "settings": {
    "alarmState": "disarmed",
    "timezone": "Europe/Athens",
    "trim": 1000
  },
  "voip": {
    "domain": "",
    "enable": false,
    "numbersToCall": [],
    "password": "",
    "timesOfRepeat": "",
    "username": ""
  }
}

Thanks in advance.
I really like your work, hope I can run it sometime :) 👍

@bkbilly
Copy link
Owner

bkbilly commented Mar 30, 2024

I've looked into it and it seems that the latest versions of paho-mqtt have changed how it's used.
You could try installing an older version until I fix it:

pip install paho-mqtt==1.6.1

EDIT: I've pushed a fix for this. You can do a git pull to get the latest version.

@steppatrik
Copy link
Author

Firstly I tried just update through:
bash <(curl -s "https://raw.githubusercontent.com/bkbilly/AlarmPI/master/install.sh")
but still I cant run web interface after that..
Then tried:
pip install paho-mqtt==1.6.1
and now I can log in via http, but only with default credentials test1/secret, even if I had changed that during installation and double check it in settings.json file - from here:

{
  "ui": {
    "https": true,
    "key": "my.cert.key",
    "cert": "my.cert.crt",
    "port": 5000
  },
  "users": {
    "pi": {
      "admin": false,
      "logfile": "alert.log",
      "pw": "xxx",
      "settings": "settings.json"
    }
  }
}

:/

@bkbilly
Copy link
Owner

bkbilly commented Mar 31, 2024

This is the server.json file which once changed, the AlarmPI should be restarted.

@steppatrik
Copy link
Author

I did restart but still, I can use only defaults.. But I assume, that this is another problem, maybe in my setting.. Original post is solved :) Thx

@steppatrik
Copy link
Author

steppatrik commented Apr 1, 2024 via email

@bkbilly
Copy link
Owner

bkbilly commented Apr 1, 2024

Unfortunately push notifications are not supported...
The only supported notifications I've created are the email, voip and mqtt.
If you need other methods, I would recommend using the Home Assistant MQTT integration.

@steppatrik
Copy link
Author

steppatrik commented Apr 2, 2024 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants