ChaseDurand / Pool-Pi

Hardware+software solution for controlling a Goldline/Hayward Aqualogic pool control board over WiFi via a Raspberry Pi.
Other
9 stars 7 forks source link

can't obtain socket from wsgi enviroment #5

Closed cwalker1960 closed 1 year ago

cwalker1960 commented 1 year ago

After a long struggle it seems to be running but when I open the web page i get "awaiting connection from rpi" I see runtime error in the files cannot obtain socket. I know very little about programming was just hoping i could get this to work Thanks in advance for any help you might offer me.

login as: pi pi@pi's password: Linux pi 6.1.21+ #1642 Mon Apr 3 17:19:14 BST 2023 armv6l

The programs included with the Debian GNU/Linux system are free software; the exact distribution terms for each program are described in the individual files in /usr/share/doc/*/copyright.

Debian GNU/Linux comes with ABSOLUTELY NO WARRANTY, to the extent permitted by applicable law. Last login: Sun Jun 4 07:59:23 2023 from 2603:6080:dbf0:8c40:8f6:ec76:d7a4:ef55 pi@pi:~ $ systemctl status poolpi.service ● poolpi.service - Pool-Pi Service Loaded: loaded (/etc/systemd/system/poolpi.service; enabled; vendor preset> Active: active (running) since Sun 2023-06-04 00:05:41 EDT; 10h ago Main PID: 409 (python3) Tasks: 2 (limit: 414) CPU: 30.894s CGroup: /system.slice/poolpi.service └─409 /usr/bin/python3 /home/pi/Pool-Pi/src/pool-pi.py

Jun 04 00:06:21 pi python3[409]: self._target(*self._args, *self._kwargs) Jun 04 00:06:21 pi python3[409]: Environment: production Jun 04 00:06:21 pi python3[409]: WARNING: This is a development server. Do n> Jun 04 00:06:21 pi python3[409]: Use a production WSGI server instead. Jun 04 00:06:21 pi python3[409]: * Debug mode: off Jun 04 00:06:21 pi python3[409]: File "/home/pi/Pool-Pi/src/pool-pi.py", line> Jun 04 00:06:21 pi python3[409]: serialHandler = SerialHandler() Jun 04 00:06:21 pi python3[409]: File "/home/pi/Pool-Pi/src/model.py", line 1> Jun 04 00:06:21 pi python3[409]: self.ser = serial0.Serial0( Jun 04 00:06:21 pi python3[409]: NameError: name 'serial0' is not defined lines 1-19/19 (END) ● poolpi.service - Pool-Pi Service Loaded: loaded (/etc/systemd/system/poolpi.service; enabled; vendor preset: enabled) Active: active (running) since Sun 2023-06-04 00:05:41 EDT; 10h ago Main PID: 409 (python3) Tasks: 2 (limit: 414) CPU: 30.894s CGroup: /system.slice/poolpi.service └─409 /usr/bin/python3 /home/pi/Pool-Pi/src/pool-pi.py

Jun 04 00:06:21 pi python3[409]: self._target(*self._args, *self._kwargs) Jun 04 00:06:21 pi python3[409]: Environment: production Jun 04 00:06:21 pi python3[409]: WARNING: This is a development server. Do not use it in a production dep> Jun 04 00:06:21 pi python3[409]: Use a production WSGI server instead. Jun 04 00:06:21 pi python3[409]: Debug mode: off Jun 04 00:06:21 pi python3[409]: File "/home/pi/Pool-Pi/src/pool-pi.py", line 279, in main Jun 04 00:06:21 pi python3[409]: serialHandler = SerialHandler() Jun 04 00:06:21 pi python3[409]: File "/home/pi/Pool-Pi/src/model.py", line 104, in init Jun 04 00:06:21 pi python3[409]: self.ser = serial0.Serial0( Jun 04 00:06:21 pi python3[409]: NameError: name 'serial0' is not defined ~ ~ ~ ~ pi@pi:~ $ tail /home/pi/Pool-Pi/logs/pool-pi.log 2023-06-04 00:12:01 INFO 192.168.1.112 - - [04/Jun/2023 00:12:01] "POST /socket.io/?EIO=4&transport=polli ng&t=OY4cj4V&sid=rTkwyevVy-z9BylTAAAM HTTP/1.1" 200 - 2023-06-04 00:12:26 INFO 192.168.1.112 - - [04/Jun/2023 00:12:26] "GET /socket.io/?EIO=4&transport=pollin g&t=OY4cj4W&sid=rTkwyevVy-z9BylTAAAM HTTP/1.1" 200 - 2023-06-04 00:12:26 INFO 192.168.1.112 - - [04/Jun/2023 00:12:26] "POST /socket.io/?EIO=4&transport=polli ng&t=OY4cpCU&sid=rTkwyevVy-z9BylTAAAM HTTP/1.1" 200 - 2023-06-04 00:12:52 INFO 192.168.1.112 - - [04/Jun/2023 00:12:52] "GET /socket.io/?EIO=4&transport=pollin g&t=OY4cpCV&sid=rTkwyevVy-z9BylTAAAM HTTP/1.1" 200 - 2023-06-04 00:12:52 INFO 192.168.1.112 - - [04/Jun/2023 00:12:52] "POST /socket.io/?EIO=4&transport=polli ng&t=OY4cvKR&sid=rTkwyevVy-z9BylTAAAM HTTP/1.1" 200 - 2023-06-04 00:13:17 INFO 192.168.1.112 - - [04/Jun/2023 00:13:17] "GET /socket.io/?EIO=4&transport=pollin g&t=OY4cvKS&sid=rTkwyevVy-z9BylTAAAM HTTP/1.1" 200 - 2023-06-04 00:13:17 INFO 192.168.1.112 - - [04/Jun/2023 00:13:17] "POST /socket.io/?EIO=4&transport=polli ng&t=OY4c_SR&sid=rTkwyevVy-z9BylTAAAM HTTP/1.1" 200 - 2023-06-04 00:06:21 INFO Started pool-pi.py 2023-06-04 00:06:21 WARNING Werkzeug appears to be used in a production deployment. Consider switching to a production web server instead. 2023-06-04 00:06:21 INFO Running on http://0.0.0.0:5000/ (Press CTRL+C to quit) pi@pi:~ $ tail /home/pi/Pool-Pi/logs/pool-pi.log return getattr(self, 'upgrade' + transport)(environ, File "/usr/local/lib/python3.9/dist-packages/engineio/socket.py", line 158, in _upgrade_websocket return ws(environ, start_response) File "/usr/local/lib/python3.9/dist-packages/engineio/async_drivers/threading.py", line 22, in call self.ws = Server(environ) File "/usr/local/lib/python3.9/dist-packages/simple_websocket/ws.py", line 319, in init raise RuntimeError('Cannot obtain socket from WSGI environment.') RuntimeError: Cannot obtain socket from WSGI environment. 2023-06-04 10:26:14 INFO 192.168.1.112 - - [04/Jun/2023 10:26:14] "GET /socket.io/?EIO=4&transport=pollin g&t=OY6pCCq&sid=_dYI8eg7hPCRQQUxAAAA HTTP/1.1" 200 - 2023-06-04 10:26:14 INFO 192.168.1.112 - - [04/Jun/2023 10:26:14] "POST /socket.io/?EIO=4&transport=polli ng&t=OY6pI6X&sid=_dYI8eg7hPCRQQUxAAAA HTTP/1.1" 200 - pi@pi:~ $

ChaseDurand commented 1 year ago

Hello! Thank you for reporting this issue.

The error says that "serial0" is not defined in model.py line 104, and says "self.ser = serial0.Serial0(". Is this a change from the original code? I show the following:

        self.ser = serial.Serial(
            port="/dev/ttyAMA0",
            baudrate=19200,
            parity=serial.PARITY_NONE,
            stopbits=serial.STOPBITS_TWO,
        )

Another user reported that they had to change "ttyAMA0" to "serial0", but I'm not sure if anything else needs to be modified.

If you made changes to the code, would you mind sharing them so I can try to help?

Thanks!

cwalker1960 commented 1 year ago

yes i did change those trying to get past the no attribute for serial, I've changed things back and forth many times now so hard to remember what worked , I know at first it would display a web page but it always said waiting for pi to connect, then after changing some of the things in serial , it finally started showing the pool stautus in the log files things like pool temp , salt level, pool on, etc, but then it wouldn't load a web page,, I'm wiping the sd card for about the 10th time now and starting from scratch and i will record each log file and report what changes was made each time. and yeas I also followed (Rich?)s instructions from start to see if that worked ,, just changing ttyAMA0 to serial0 didn't fix the serial has no attribute problem for me. I remember it was when i pip3 uninstall serial was when it finally started getting data from the pool controller and thats when it would no longer open a web page , it would just say this site isn't responding or cant be reached or something to that effect ,, anyhow like i said starting from scratch and this time I'll record each change., And thank you very much for the help and the program. I do hope i can get it working. the display on my panel quit , panel still works but i can't tell what i'm doing,

cwalker1960 commented 1 year ago

this is after install as you have posted,pool pi is running, and a website is available but it says awaiting connection from raspberry pi, login as: pi pi@pi's password: Linux pi 6.1.21+ #1642 Mon Apr 3 17:19:14 BST 2023 armv6l

The programs included with the Debian GNU/Linux system are free software; the exact distribution terms for each program are described in the individual files in /usr/share/doc/*/copyright.

Debian GNU/Linux comes with ABSOLUTELY NO WARRANTY, to the extent permitted by applicable law. Last login: Tue Jun 6 21:17:55 2023 from 2603:6080:dbf0:8c40::1bc8 pi@pi:~ $ sudo timedatectl set-timezone YOUR_TIME_ZONE Failed to set time zone: Invalid or not installed time zone 'YOUR_TIME_ZONE' pi@pi:~ $ timedatectl list-timezones Africa/Abidjan Africa/Accra Africa/Algiers Africa/Bissau Africa/Cairo Africa/Casablanca Africa/Ceuta Africa/El_Aaiun Africa/Johannesburg Africa/Juba Africa/Khartoum Africa/Lagos Africa/Maputo Africa/Monrovia Africa/Nairobi Africa/Ndjamena Africa/Sao_Tome Africa/Tripoli Africa/Tunis Africa/Windhoek America/Adak America/Anchorage America/Araguaina pi@pi:~ $ sudo timedatectl set-timezone YOUR_TIME_ZONE Failed to set time zone: Invalid or not installed time zone 'YOUR_TIME_ZONE' pi@pi:~ $ git clone --depth 1 git@github.com:ChaseDurand/Pool-Pi.git Cloning into 'Pool-Pi'... The authenticity of host 'github.com (140.82.112.3)' can't be established. ECDSA key fingerprint is SHA256:p2QAMXNIC1TJYWeIOttrVc98/R1BUFWu3/LiyKgUfQM. Are you sure you want to continue connecting (yes/no/[fingerprint])? y Please type 'yes', 'no' or the fingerprint: yes Warning: Permanently added 'github.com,140.82.112.3' (ECDSA) to the list of known hosts. remote: Enumerating objects: 49, done. remote: Counting objects: 100% (49/49), done. remote: Compressing objects: 100% (49/49), done. remote: Total 49 (delta 2), reused 28 (delta 0), pack-reused 0 Receiving objects: 100% (49/49), 16.03 MiB | 1.62 MiB/s, done. Resolving deltas: 100% (2/2), done. pi@pi:~ $ sudo timedatectl set-timezone YOUR_TIME_ZONE Failed to set time zone: Invalid or not installed time zone 'YOUR_TIME_ZONE' pi@pi:~ $ systemctl status poolpi.service Unit poolpi.service could not be found. pi@pi:~ $ sudo /home/pi/Pool-Pi/setup/setup.sh Setting up pool-pi. Installing required python packages. Looking in indexes: https://pypi.org/simple, https://www.piwheels.org/simple Requirement already satisfied: flask in /usr/lib/python3/dist-packages (from -r /home/pi/Pool-Pi/setup/requirements.txt (line 1)) (1.1.2) Collecting flask_socketio Downloading https://www.piwheels.org/simple/flask-socketio/Flask_SocketIO-5.3.4-py3-none-any.whl (17 kB) Collecting serial Downloading https://www.piwheels.org/simple/serial/serial-0.0.97-py2.py3-none-any.whl (40 kB) |████████████████████████████████| 40 kB 122 kB/s Requirement already satisfied: gpiozero in /usr/lib/python3/dist-packages (from -r /home/pi/Pool-Pi/setup/requirements.txt (line 4)) (1.6.2) Collecting simple-websocket Downloading https://www.piwheels.org/simple/simple-websocket/simple_websocket-0.10.1-py3-none-any.whl (7.5 kB) Collecting python-socketio>=5.0.2 Downloading https://www.piwheels.org/simple/python-socketio/python_socketio-5.8.0-py3-none-any.whl (56 kB) |████████████████████████████████| 56 kB 129 kB/s Collecting bidict>=0.21.0 Downloading https://www.piwheels.org/simple/bidict/bidict-0.22.1-py3-none-any.whl (35 kB) Collecting python-engineio>=4.3.0 Downloading https://www.piwheels.org/simple/python-engineio/python_engineio-4.4.1-py3-none-any.whl (53 kB) |████████████████████████████████| 53 kB 155 kB/s Collecting pyyaml>=3.13 Downloading https://www.piwheels.org/simple/pyyaml/PyYAML-6.0-cp39-cp39-linux_armv6l.whl (45 kB) |████████████████████████████████| 45 kB 60 kB/s Collecting future>=0.17.1 Downloading https://www.piwheels.org/simple/future/future-0.18.3-py3-none-any.whl (492 kB) |████████████████████████████████| 492 kB 295 kB/s Collecting iso8601>=0.1.12 Downloading https://www.piwheels.org/simple/iso8601/iso8601-1.1.0-py3-none-any.whl (9.9 kB) Collecting wsproto Downloading https://www.piwheels.org/simple/wsproto/wsproto-1.2.0-py3-none-any.whl (24 kB) Collecting h11<1,>=0.9.0 Downloading https://www.piwheels.org/simple/h11/h11-0.14.0-py3-none-any.whl (58 kB) |████████████████████████████████| 58 kB 197 kB/s Installing collected packages: python-engineio, h11, bidict, wsproto, pyyaml, python-socketio, iso8601, future, simple-websocket, serial, flask-socketio Successfully installed bidict-0.22.1 flask-socketio-5.3.4 future-0.18.3 h11-0.14.0 iso8601-1.1.0 python-engineio-4.4.1 python-socketio-5.8.0 pyyaml-6.0 serial-0.0.97 simple-websocket-0.10.1 wsproto-1.2.0 Configuring systemd. Created symlink /etc/systemd/system/multi-user.target.wants/poolpi.service → /etc/systemd/system/poolpi.service. Setup script complete. pi@pi:~ $ tail /home/pi/Pool-Pi/logs/pool-pi.log 2023-06-07 08:46:49 INFO Started pool-pi.py 2023-06-07 08:46:49 WARNING Werkzeug appears to be used in a production deployment. Consider switching to a production web server instead. 2023-06-07 08:46:49 INFO * Running on http://0.0.0.0:5000/ (Press CTRL+C to quit) pi@pi:~ $ tail /home/pi/Pool-Pi/logs/pool-pi.log 2023-06-07 09:23:19 INFO 192.168.1.112 - - [07/Jun/2023 09:23:19] "GET /socket.io/?EIO=4&transport=polling&t=OYM1aLC&sid=1uUxHSxRw1yFnU6rAAAA HTTP/1.1" 200 - 2023-06-07 09:23:19 INFO 192.168.1.112 - - [07/Jun/2023 09:23:19] "POST /socket.io/?EIO=4&transport=polling&t=OYM1gT1&sid=1uUxHSxRw1yFnU6rAAAA HTTP/1.1" 200 - 2023-06-07 09:23:44 INFO 192.168.1.112 - - [07/Jun/2023 09:23:44] "GET /socket.io/?EIO=4&transport=polling&t=OYM1gT2&sid=1uUxHSxRw1yFnU6rAAAA HTTP/1.1" 200 - 2023-06-07 09:23:44 INFO 192.168.1.112 - - [07/Jun/2023 09:23:44] "POST /socket.io/?EIO=4&transport=polling&t=OYM1mal&sid=1uUxHSxRw1yFnU6rAAAA HTTP/1.1" 200 - 2023-06-07 09:24:09 INFO 192.168.1.112 - - [07/Jun/2023 09:24:09] "GET /socket.io/?EIO=4&transport=polling&t=OYM1mam&sid=1uUxHSxRw1yFnU6rAAAA HTTP/1.1" 200 - 2023-06-07 09:24:09 INFO 192.168.1.112 - - [07/Jun/2023 09:24:09] "POST /socket.io/?EIO=4&transport=polling&t=OYM1sic&sid=1uUxHSxRw1yFnU6rAAAA HTTP/1.1" 200 - 2023-06-07 09:24:34 INFO 192.168.1.112 - - [07/Jun/2023 09:24:34] "GET /socket.io/?EIO=4&transport=polling&t=OYM1sie&sid=1uUxHSxRw1yFnU6rAAAA HTTP/1.1" 200 - 2023-06-07 09:24:34 INFO 192.168.1.112 - - [07/Jun/2023 09:24:34] "POST /socket.io/?EIO=4&transport=polling&t=OYM1yqD&sid=1uUxHSxRw1yFnU6rAAAA HTTP/1.1" 200 - 2023-06-07 09:24:59 INFO 192.168.1.112 - - [07/Jun/2023 09:24:59] "GET /socket.io/?EIO=4&transport=polling&t=OYM1yqE&sid=1uUxHSxRw1yFnU6rAAAA HTTP/1.1" 200 - 2023-06-07 09:24:59 INFO 192.168.1.112 - - [07/Jun/2023 09:24:59] "POST /socket.io/?EIO=4&transport=polling&t=OYM22y6&sid=1uUxHSxRw1yFnU6rAAAA HTTP/1.1" 200 - pi@pi:~ $ Screenshot (60)

cwalker1960 commented 1 year ago

sorry added this . checking the status of poolpi at the end it says attribute error module serial has no attribute login as: pi pi@pi's password: Linux pi 6.1.21+ #1642 Mon Apr 3 17:19:14 BST 2023 armv6l

The programs included with the Debian GNU/Linux system are free software; the exact distribution terms for each program are described in the individual files in /usr/share/doc/*/copyright.

Debian GNU/Linux comes with ABSOLUTELY NO WARRANTY, to the extent permitted by applicable law. Last login: Tue Jun 6 21:17:55 2023 from 2603:6080:dbf0:8c40::1bc8 pi@pi:~ $ sudo timedatectl set-timezone YOUR_TIME_ZONE Failed to set time zone: Invalid or not installed time zone 'YOUR_TIME_ZONE' pi@pi:~ $ timedatectl list-timezones Africa/Abidjan Africa/Accra Africa/Algiers Africa/Bissau Africa/Cairo Africa/Casablanca Africa/Ceuta Africa/El_Aaiun Africa/Johannesburg Africa/Juba Africa/Khartoum Africa/Lagos Africa/Maputo Africa/Monrovia Africa/Nairobi Africa/Ndjamena Africa/Sao_Tome Africa/Tripoli Africa/Tunis Africa/Windhoek America/Adak America/Anchorage America/Araguaina pi@pi:~ $ sudo timedatectl set-timezone YOUR_TIME_ZONE Failed to set time zone: Invalid or not installed time zone 'YOUR_TIME_ZONE' pi@pi:~ $ git clone --depth 1 git@github.com:ChaseDurand/Pool-Pi.git Cloning into 'Pool-Pi'... The authenticity of host 'github.com (140.82.112.3)' can't be established. ECDSA key fingerprint is SHA256:p2QAMXNIC1TJYWeIOttrVc98/R1BUFWu3/LiyKgUfQM. Are you sure you want to continue connecting (yes/no/[fingerprint])? y Please type 'yes', 'no' or the fingerprint: yes Warning: Permanently added 'github.com,140.82.112.3' (ECDSA) to the list of known hosts. remote: Enumerating objects: 49, done. remote: Counting objects: 100% (49/49), done. remote: Compressing objects: 100% (49/49), done. remote: Total 49 (delta 2), reused 28 (delta 0), pack-reused 0 Receiving objects: 100% (49/49), 16.03 MiB | 1.62 MiB/s, done. Resolving deltas: 100% (2/2), done. pi@pi:~ $ sudo timedatectl set-timezone YOUR_TIME_ZONE Failed to set time zone: Invalid or not installed time zone 'YOUR_TIME_ZONE' pi@pi:~ $ systemctl status poolpi.service Unit poolpi.service could not be found. pi@pi:~ $ sudo /home/pi/Pool-Pi/setup/setup.sh Setting up pool-pi. Installing required python packages. Looking in indexes: https://pypi.org/simple, https://www.piwheels.org/simple Requirement already satisfied: flask in /usr/lib/python3/dist-packages (from -r /home/pi/Pool-Pi/setup/requirements.txt (line 1)) (1.1.2) Collecting flask_socketio Downloading https://www.piwheels.org/simple/flask-socketio/Flask_SocketIO-5.3.4-py3-none-any.whl (17 kB) Collecting serial Downloading https://www.piwheels.org/simple/serial/serial-0.0.97-py2.py3-none-any.whl (40 kB) |████████████████████████████████| 40 kB 122 kB/s Requirement already satisfied: gpiozero in /usr/lib/python3/dist-packages (from -r /home/pi/Pool-Pi/setup/requirements.txt (line 4)) (1.6.2) Collecting simple-websocket Downloading https://www.piwheels.org/simple/simple-websocket/simple_websocket-0.10.1-py3-none-any.whl (7.5 kB) Collecting python-socketio>=5.0.2 Downloading https://www.piwheels.org/simple/python-socketio/python_socketio-5.8.0-py3-none-any.whl (56 kB) |████████████████████████████████| 56 kB 129 kB/s Collecting bidict>=0.21.0 Downloading https://www.piwheels.org/simple/bidict/bidict-0.22.1-py3-none-any.whl (35 kB) Collecting python-engineio>=4.3.0 Downloading https://www.piwheels.org/simple/python-engineio/python_engineio-4.4.1-py3-none-any.whl (53 kB) |████████████████████████████████| 53 kB 155 kB/s Collecting pyyaml>=3.13 Downloading https://www.piwheels.org/simple/pyyaml/PyYAML-6.0-cp39-cp39-linux_armv6l.whl (45 kB) |████████████████████████████████| 45 kB 60 kB/s Collecting future>=0.17.1 Downloading https://www.piwheels.org/simple/future/future-0.18.3-py3-none-any.whl (492 kB) |████████████████████████████████| 492 kB 295 kB/s Collecting iso8601>=0.1.12 Downloading https://www.piwheels.org/simple/iso8601/iso8601-1.1.0-py3-none-any.whl (9.9 kB) Collecting wsproto Downloading https://www.piwheels.org/simple/wsproto/wsproto-1.2.0-py3-none-any.whl (24 kB) Collecting h11<1,>=0.9.0 Downloading https://www.piwheels.org/simple/h11/h11-0.14.0-py3-none-any.whl (58 kB) |████████████████████████████████| 58 kB 197 kB/s Installing collected packages: python-engineio, h11, bidict, wsproto, pyyaml, python-socketio, iso8601, future, simple-websocket, serial, flask-socketio Successfully installed bidict-0.22.1 flask-socketio-5.3.4 future-0.18.3 h11-0.14.0 iso8601-1.1.0 python-engineio-4.4.1 python-socketio-5.8.0 pyyaml-6.0 serial-0.0.97 simple-websocket-0.10.1 wsproto-1.2.0 Configuring systemd. Created symlink /etc/systemd/system/multi-user.target.wants/poolpi.service → /etc/systemd/system/poolpi.service. Setup script complete. pi@pi:~ $ tail /home/pi/Pool-Pi/logs/pool-pi.log 2023-06-07 08:46:49 INFO Started pool-pi.py 2023-06-07 08:46:49 WARNING Werkzeug appears to be used in a production deployment. Consider switching to a production web server instead. 2023-06-07 08:46:49 INFO * Running on http://0.0.0.0:5000/ (Press CTRL+C to quit) pi@pi:~ $ tail /home/pi/Pool-Pi/logs/pool-pi.log 2023-06-07 09:23:19 INFO 192.168.1.112 - - [07/Jun/2023 09:23:19] "GET /socket.io/?EIO=4&transport=polling&t=OYM1aLC&sid=1uUxHSxRw1yFnU6rAAAA HTTP/1.1" 200 - 2023-06-07 09:23:19 INFO 192.168.1.112 - - [07/Jun/2023 09:23:19] "POST /socket.io/?EIO=4&transport=polling&t=OYM1gT1&sid=1uUxHSxRw1yFnU6rAAAA HTTP/1.1" 200 - 2023-06-07 09:23:44 INFO 192.168.1.112 - - [07/Jun/2023 09:23:44] "GET /socket.io/?EIO=4&transport=polling&t=OYM1gT2&sid=1uUxHSxRw1yFnU6rAAAA HTTP/1.1" 200 - 2023-06-07 09:23:44 INFO 192.168.1.112 - - [07/Jun/2023 09:23:44] "POST /socket.io/?EIO=4&transport=polling&t=OYM1mal&sid=1uUxHSxRw1yFnU6rAAAA HTTP/1.1" 200 - 2023-06-07 09:24:09 INFO 192.168.1.112 - - [07/Jun/2023 09:24:09] "GET /socket.io/?EIO=4&transport=polling&t=OYM1mam&sid=1uUxHSxRw1yFnU6rAAAA HTTP/1.1" 200 - 2023-06-07 09:24:09 INFO 192.168.1.112 - - [07/Jun/2023 09:24:09] "POST /socket.io/?EIO=4&transport=polling&t=OYM1sic&sid=1uUxHSxRw1yFnU6rAAAA HTTP/1.1" 200 - 2023-06-07 09:24:34 INFO 192.168.1.112 - - [07/Jun/2023 09:24:34] "GET /socket.io/?EIO=4&transport=polling&t=OYM1sie&sid=1uUxHSxRw1yFnU6rAAAA HTTP/1.1" 200 - 2023-06-07 09:24:34 INFO 192.168.1.112 - - [07/Jun/2023 09:24:34] "POST /socket.io/?EIO=4&transport=polling&t=OYM1yqD&sid=1uUxHSxRw1yFnU6rAAAA HTTP/1.1" 200 - 2023-06-07 09:24:59 INFO 192.168.1.112 - - [07/Jun/2023 09:24:59] "GET /socket.io/?EIO=4&transport=polling&t=OYM1yqE&sid=1uUxHSxRw1yFnU6rAAAA HTTP/1.1" 200 - 2023-06-07 09:24:59 INFO 192.168.1.112 - - [07/Jun/2023 09:24:59] "POST /socket.io/?EIO=4&transport=polling&t=OYM22y6&sid=1uUxHSxRw1yFnU6rAAAA HTTP/1.1" 200 - pi@pi:~ $ systemctl status poolpi.service ● poolpi.service - Pool-Pi Service Loaded: loaded (/etc/systemd/system/poolpi.service; enabled; vendor preset> Active: active (running) since Wed 2023-06-07 08:46:38 EDT; 49min ago Main PID: 5821 (python3) Tasks: 5 (limit: 414) CPU: 17.394s CGroup: /system.slice/poolpi.service └─5821 /usr/bin/python3 /home/pi/Pool-Pi/src/pool-pi.py

Jun 07 08:46:49 pi python3[5821]: self._target(*self._args, *self._kwargs) Jun 07 08:46:49 pi python3[5821]: Environment: production Jun 07 08:46:49 pi python3[5821]: File "/home/pi/Pool-Pi/src/pool-pi.py", lin> Jun 07 08:46:49 pi python3[5821]: serialHandler = SerialHandler() Jun 07 08:46:49 pi python3[5821]: WARNING: This is a development server. Do > Jun 07 08:46:49 pi python3[5821]: Use a production WSGI server instead. Jun 07 08:46:49 pi python3[5821]: * Debug mode: off Jun 07 08:46:49 pi python3[5821]: File "/home/pi/Pool-Pi/src/model.py", line > Jun 07 08:46:49 pi python3[5821]: self.ser = serial.Serial( Jun 07 08:46:49 pi python3[5821]: AttributeError: module 'serial' has no attrib> lines 1-19/19 (END)

cwalker1960 commented 1 year ago

i need to mention that i have already disabled serial console and enabled use serail ports

cwalker1960 commented 1 year ago

this is after changing ttyama0 to serial0 per rich , still have attribute error. still get a website , but no info from pool controller. login as: pi pi@pi's password: Linux pi 6.1.21+ #1642 Mon Apr 3 17:19:14 BST 2023 armv6l

The programs included with the Debian GNU/Linux system are free software; the exact distribution terms for each program are described in the individual files in /usr/share/doc/*/copyright.

Debian GNU/Linux comes with ABSOLUTELY NO WARRANTY, to the extent permitted by applicable law. Last login: Tue Jun 6 21:17:55 2023 from 2603:6080:dbf0:8c40::1bc8 pi@pi:~ $ sudo timedatectl set-timezone YOUR_TIME_ZONE Failed to set time zone: Invalid or not installed time zone 'YOUR_TIME_ZONE' pi@pi:~ $ timedatectl list-timezones Africa/Abidjan Africa/Accra Africa/Algiers Africa/Bissau Africa/Cairo Africa/Casablanca Africa/Ceuta Africa/El_Aaiun Africa/Johannesburg Africa/Juba Africa/Khartoum Africa/Lagos Africa/Maputo Africa/Monrovia Africa/Nairobi Africa/Ndjamena Africa/Sao_Tome Africa/Tripoli Africa/Tunis Africa/Windhoek America/Adak America/Anchorage America/Araguaina pi@pi:~ $ sudo timedatectl set-timezone YOUR_TIME_ZONE Failed to set time zone: Invalid or not installed time zone 'YOUR_TIME_ZONE' pi@pi:~ $ git clone --depth 1 git@github.com:ChaseDurand/Pool-Pi.git Cloning into 'Pool-Pi'... The authenticity of host 'github.com (140.82.112.3)' can't be established. ECDSA key fingerprint is SHA256:p2QAMXNIC1TJYWeIOttrVc98/R1BUFWu3/LiyKgUfQM. Are you sure you want to continue connecting (yes/no/[fingerprint])? y Please type 'yes', 'no' or the fingerprint: yes Warning: Permanently added 'github.com,140.82.112.3' (ECDSA) to the list of known hosts. remote: Enumerating objects: 49, done. remote: Counting objects: 100% (49/49), done. remote: Compressing objects: 100% (49/49), done. remote: Total 49 (delta 2), reused 28 (delta 0), pack-reused 0 Receiving objects: 100% (49/49), 16.03 MiB | 1.62 MiB/s, done. Resolving deltas: 100% (2/2), done. pi@pi:~ $ sudo timedatectl set-timezone YOUR_TIME_ZONE Failed to set time zone: Invalid or not installed time zone 'YOUR_TIME_ZONE' pi@pi:~ $ systemctl status poolpi.service Unit poolpi.service could not be found. pi@pi:~ $ sudo /home/pi/Pool-Pi/setup/setup.sh Setting up pool-pi. Installing required python packages. Looking in indexes: https://pypi.org/simple, https://www.piwheels.org/simple Requirement already satisfied: flask in /usr/lib/python3/dist-packages (from -r /home/pi/Pool-Pi/setup/requirements.txt (line 1)) (1.1.2) Collecting flask_socketio Downloading https://www.piwheels.org/simple/flask-socketio/Flask_SocketIO-5.3.4-py3-none-any.whl (17 kB) Collecting serial Downloading https://www.piwheels.org/simple/serial/serial-0.0.97-py2.py3-none-any.whl (40 kB) |████████████████████████████████| 40 kB 122 kB/s Requirement already satisfied: gpiozero in /usr/lib/python3/dist-packages (from -r /home/pi/Pool-Pi/setup/requirements.txt (line 4)) (1.6.2) Collecting simple-websocket Downloading https://www.piwheels.org/simple/simple-websocket/simple_websocket-0.10.1-py3-none-any.whl (7.5 kB) Collecting python-socketio>=5.0.2 Downloading https://www.piwheels.org/simple/python-socketio/python_socketio-5.8.0-py3-none-any.whl (56 kB) |████████████████████████████████| 56 kB 129 kB/s Collecting bidict>=0.21.0 Downloading https://www.piwheels.org/simple/bidict/bidict-0.22.1-py3-none-any.whl (35 kB) Collecting python-engineio>=4.3.0 Downloading https://www.piwheels.org/simple/python-engineio/python_engineio-4.4.1-py3-none-any.whl (53 kB) |████████████████████████████████| 53 kB 155 kB/s Collecting pyyaml>=3.13 Downloading https://www.piwheels.org/simple/pyyaml/PyYAML-6.0-cp39-cp39-linux_armv6l.whl (45 kB) |████████████████████████████████| 45 kB 60 kB/s Collecting future>=0.17.1 Downloading https://www.piwheels.org/simple/future/future-0.18.3-py3-none-any.whl (492 kB) |████████████████████████████████| 492 kB 295 kB/s Collecting iso8601>=0.1.12 Downloading https://www.piwheels.org/simple/iso8601/iso8601-1.1.0-py3-none-any.whl (9.9 kB) Collecting wsproto Downloading https://www.piwheels.org/simple/wsproto/wsproto-1.2.0-py3-none-any.whl (24 kB) Collecting h11<1,>=0.9.0 Downloading https://www.piwheels.org/simple/h11/h11-0.14.0-py3-none-any.whl (58 kB) |████████████████████████████████| 58 kB 197 kB/s Installing collected packages: python-engineio, h11, bidict, wsproto, pyyaml, python-socketio, iso8601, future, simple-websocket, serial, flask-socketio Successfully installed bidict-0.22.1 flask-socketio-5.3.4 future-0.18.3 h11-0.14.0 iso8601-1.1.0 python-engineio-4.4.1 python-socketio-5.8.0 pyyaml-6.0 serial-0.0.97 simple-websocket-0.10.1 wsproto-1.2.0 Configuring systemd. Created symlink /etc/systemd/system/multi-user.target.wants/poolpi.service → /etc/systemd/system/poolpi.service. Setup script complete. pi@pi:~ $ tail /home/pi/Pool-Pi/logs/pool-pi.log 2023-06-07 08:46:49 INFO Started pool-pi.py 2023-06-07 08:46:49 WARNING Werkzeug appears to be used in a production deployment. Consider switching to a production web server instead. 2023-06-07 08:46:49 INFO * Running on http://0.0.0.0:5000/ (Press CTRL+C to quit) pi@pi:~ $ tail /home/pi/Pool-Pi/logs/pool-pi.log 2023-06-07 09:23:19 INFO 192.168.1.112 - - [07/Jun/2023 09:23:19] "GET /socket.io/?EIO=4&transport=polling&t=OYM1aLC&sid=1uUxHSxRw1yFnU6rAAAA HTTP/1.1" 200 - 2023-06-07 09:23:19 INFO 192.168.1.112 - - [07/Jun/2023 09:23:19] "POST /socket.io/?EIO=4&transport=polling&t=OYM1gT1&sid=1uUxHSxRw1yFnU6rAAAA HTTP/1.1" 200 - 2023-06-07 09:23:44 INFO 192.168.1.112 - - [07/Jun/2023 09:23:44] "GET /socket.io/?EIO=4&transport=polling&t=OYM1gT2&sid=1uUxHSxRw1yFnU6rAAAA HTTP/1.1" 200 - 2023-06-07 09:23:44 INFO 192.168.1.112 - - [07/Jun/2023 09:23:44] "POST /socket.io/?EIO=4&transport=polling&t=OYM1mal&sid=1uUxHSxRw1yFnU6rAAAA HTTP/1.1" 200 - 2023-06-07 09:24:09 INFO 192.168.1.112 - - [07/Jun/2023 09:24:09] "GET /socket.io/?EIO=4&transport=polling&t=OYM1mam&sid=1uUxHSxRw1yFnU6rAAAA HTTP/1.1" 200 - 2023-06-07 09:24:09 INFO 192.168.1.112 - - [07/Jun/2023 09:24:09] "POST /socket.io/?EIO=4&transport=polling&t=OYM1sic&sid=1uUxHSxRw1yFnU6rAAAA HTTP/1.1" 200 - 2023-06-07 09:24:34 INFO 192.168.1.112 - - [07/Jun/2023 09:24:34] "GET /socket.io/?EIO=4&transport=polling&t=OYM1sie&sid=1uUxHSxRw1yFnU6rAAAA HTTP/1.1" 200 - 2023-06-07 09:24:34 INFO 192.168.1.112 - - [07/Jun/2023 09:24:34] "POST /socket.io/?EIO=4&transport=polling&t=OYM1yqD&sid=1uUxHSxRw1yFnU6rAAAA HTTP/1.1" 200 - 2023-06-07 09:24:59 INFO 192.168.1.112 - - [07/Jun/2023 09:24:59] "GET /socket.io/?EIO=4&transport=polling&t=OYM1yqE&sid=1uUxHSxRw1yFnU6rAAAA HTTP/1.1" 200 - 2023-06-07 09:24:59 INFO 192.168.1.112 - - [07/Jun/2023 09:24:59] "POST /socket.io/?EIO=4&transport=polling&t=OYM22y6&sid=1uUxHSxRw1yFnU6rAAAA HTTP/1.1" 200 - pi@pi:~ $ systemctl status poolpi.service ● poolpi.service - Pool-Pi Service Loaded: loaded (/etc/systemd/system/poolpi.service; enabled; vendor preset> Active: active (running) since Wed 2023-06-07 08:46:38 EDT; 49min ago Main PID: 5821 (python3) Tasks: 5 (limit: 414) CPU: 17.394s CGroup: /system.slice/poolpi.service └─5821 /usr/bin/python3 /home/pi/Pool-Pi/src/pool-pi.py

Jun 07 08:46:49 pi python3[5821]: self._target(*self._args, *self._kwargs) Jun 07 08:46:49 pi python3[5821]: Environment: production Jun 07 08:46:49 pi python3[5821]: File "/home/pi/Pool-Pi/src/pool-pi.py", lin> Jun 07 08:46:49 pi python3[5821]: serialHandler = SerialHandler() Jun 07 08:46:49 pi python3[5821]: WARNING: This is a development server. Do > Jun 07 08:46:49 pi python3[5821]: Use a production WSGI server instead. Jun 07 08:46:49 pi python3[5821]: * Debug mode: off Jun 07 08:46:49 pi python3[5821]: File "/home/pi/Pool-Pi/src/model.py", line > Jun 07 08:46:49 pi python3[5821]: self.ser = serial.Serial( Jun 07 08:46:49 pi python3[5821]: AttributeError: module 'serial' has no attrib> pi@pi:~ $ cd Pool-Pi/src pi@pi:~/Pool-Pi/src $ nano model.py pi@pi:~/Pool-Pi/src $ python3 pool-pi.py Exception in thread Thread-2: Traceback (most recent call last): File "/usr/lib/python3.9/threading.py", line 954, in _bootstrap_inner

Jun 07 08:46:49 pi python3[5821]: self._target(*self._args, *self._kwargs) Jun 07 08:46:49 pi python3[5821]: Environment: production Jun 07 08:46:49 pi python3[5821]: File "/home/pi/Pool-Pi/src/pool-pi.py", lin> Jun 07 08:46:49 pi python3[5821]: serialHandler = SerialHandler() Jun 07 08:46:49 pi python3[5821]: WARNING: This is a development server. Do > Jun 07 08:46:49 pi python3[5821]: Use a production WSGI server instead. Jun 07 08:46:49 pi python3[5821]: * Debug mode: off Jun 07 08:46:49 pi python3[5821]: File "/home/pi/Pool-Pi/src/model.py", line > Jun 07 08:46:49 pi python3[5821]: self.ser = serial.Serial( Jun 07 08:46:49 pi python3[5821]: AttributeError: module 'serial' has no attrib> lines 1-19/19 (END)

cwalker1960 commented 1 year ago

I know you didn't post this for people to aggravate you with it and I'm sorry that I'm the one doing it but all i can figure is something has been changed in the dependencies that is causing the attribute error. I know I have followed the install instructions to the letter and i have followed everything I can find on the internet as to how to clear it up with no success.

ChaseDurand commented 1 year ago

Hi cwalker. My apologies for just now getting back to you.

I believe the issue was that the python packages in requirements.txt included "serial" and not "pyserial". "pyserial" is the correct package- even though it is imported in the code as "serial". I believe the reason this went unnoticed on my end is because I had likely manually installed pyserial while developing pool-pi and then retroactively created the requirements file for the ease of others. "pip3 list" showed both serial and pyserial packages installed on my raspberry pi. Uninstalling all packages and installing with the original requirements file resulted in the same AttributeError you saw. Correcting the requirements file from serial to pyserial and reinstalling seems to have resolved that issue.

I have corrected the requirements file with commit cd9d96d. Please let me know if this works for you!

cwalker1960 commented 1 year ago

Chase, Thank you, thank you, thank you,, everything is working except the filter button. that just puts it in a waiting loop and i have to stop and restart the service. I'll work on that myself and try not to bother you with it. i don't know if it inherited my panel layout or not but all the buttons are even labeled properly.

ChaseDurand commented 1 year ago

Awesome! I'm glad it's up and running. Would you mind sharing a picture of your hardware setup for my own curiosity?

The auxiliary buttons are labeled for my own setup and I unfortunately haven't implemented a simple way to modify them (ex change AUX5 to fountain or something).

Concerning the filter button, I'm not sure why it's not working but I'd like to fix it if possible. Do you have a multi speed pump?

Thank you for all the details you've provided throughout the debug process.

cwalker1960 commented 1 year ago

My hardware setup? HaHa, Surely you are joking me? There's the photos i do intend to mount it all in a box now that it's working. Also i was in a hurry the other day and i thought everything was working except the filter button. I have a single speed pump. It seems the cleaner pump button does the same thing, if i turn it on and off at the panel outside it works okay and shows the proper status on the web ui but if i touch the buttons for either of them on the web ui it locks the system up and i have to stop and restart it. Next thing the pool light button and the spa light button show to be working on the web ui the light on the web ui changes status to indicate it's working but it doesn't turn the pool lights on or off and i have to stop and restart the service before the buttons on the pool panel will control them again . The spa blower and the water fall pump works as they should from either location as do changing the valves from pool to spa and i was able to set my timers through the web ui . The only thing i can think of that i haven't checked yet is the heater and yes my panel was already set up exactly like yours. I am still on the 265 software though if that matters.

20230612_173925 20230612_174017 20230612_174021

cwalker1960 commented 1 year ago

one thing comes to mind, im only pulling the 2 signal wires from the pool controller , i intend to connect power to the pi and the 485 adapter from the pool panel but it a little piece away so i just ran two wires inside the house so i could set everything up and get it working . i may be getting some send errors by not having a common ground between them. as you can see my dining room table became my workspace for this project. i was setting out to pull the goldline controller out and control everything with esp32 and a bluetooth app on my phone when i ran across your project , You prolly wishing i hadn't found it by now. LOL

cwalker1960 commented 1 year ago

i can usually work out the hardware part of this stuff but i know just enough about programming to get me in deep shit. fortunately I'm proficient at formatting and rewriting sd cards

cwalker1960 commented 1 year ago

since the serial attribute issue is fixed shouldn't we close this and start a different issue for configuring stuff? just to let you know i am learning from this , first i went out to my panel and i turned the pool light on and off twice , then the spa light twice then the cleaner twice then the filter pump twice , went back inside and shut down poolpi. pulled up the log files and located the lines where i done all this from the outside panel so I now have the data that the control panel is sending, I just have to figure out how to get it in the config file. also there are some other things that have to be done to the rpi config files before this works , 1) turn off serial console as noted by rich and disable bluetooth so ttyAMA0 is available for use on serial0. once im completely up and running I will document the entire procedure and hopefully it'll save you from having to deal with the next "me" I do want to sincerely thank you for helping me with this. I owe you many beers now.

mhmatttu commented 1 year ago

@cwalker1960 @ChaseDurand Good evening. I am getting this same error message with same results of "awaiting connection from raspberry pi". I have tried to change the serial to serial0 from ttyAMA0 in model.py with no change. I am using a raspberry pi 2b vs a zero. My unit does not have bluetooth but did turn off serial console. I apprediate any help.

Below are my logs:

2023-09-02 18:57:24 INFO 10.0.0.75 - - [02/Sep/2023 18:57:24] "GET / HTTP/1.1" 200 - 2023-09-02 18:57:26 INFO 10.0.0.75 - - [02/Sep/2023 18:57:26] "GET /static/styles.css HTTP/1.1" 200 - 2023-09-02 18:57:26 INFO 10.0.0.75 - - [02/Sep/2023 18:57:26] "GET /static/loading.gif HTTP/1.1" 200 - 2023-09-02 18:57:27 INFO 10.0.0.75 - - [02/Sep/2023 18:57:27] "GET /static/apple-touch-icon.png HTTP/1.1" 200 - 2023-09-02 18:57:28 INFO 10.0.0.75 - - [02/Sep/2023 18:57:28] "GET /socket.io/?EIO=4&transport=polling&t=OfOL83r HTTP/1.1" 200 - 2023-09-02 18:57:44 INFO Client connected. 2023-09-02 18:57:44 INFO 10.0.0.75 - - [02/Sep/2023 18:57:44] "POST /socket.io/?EIO=4&transport=polling&t=OfOLBqb&sid=XVuOHf2pm5PEosgSAAAE HTTP/1.1" 200 - 2023-09-02 18:57:44 INFO 10.0.0.75 - - [02/Sep/2023 18:57:44] "GET /socket.io/?EIO=4&transport=polling&t=OfOLBq-&sid=XVuOHf2pm5PEosgSAAAE HTTP/1.1" 200 - 2023-09-02 18:57:44 INFO 10.0.0.75 - - [02/Sep/2023 18:57:44] "GET /socket.io/?EIO=4&transport=websocket&sid=XVuOHf2pm5PEosgSAAAE HTTP/1.1" 500 - 2023-09-02 18:57:44 ERROR Error on request: Traceback (most recent call last): File "/usr/lib/python3/dist-packages/werkzeug/serving.py", line 323, in run_wsgi execute(self.server.app) File "/usr/lib/python3/dist-packages/werkzeug/serving.py", line 312, in execute application_iter = app(environ, start_response) File "/usr/lib/python3/dist-packages/flask/app.py", line 2464, in call return self.wsgi_app(environ, start_response) File "/usr/local/lib/python3.9/dist-packages/flask_socketio/init.py", line 43, in call return super(_SocketIOMiddleware, self).call(environ, File "/usr/local/lib/python3.9/dist-packages/engineio/middleware.py", line 63, in call return self.engineio_app.handle_request(environ, start_response) File "/usr/local/lib/python3.9/dist-packages/socketio/server.py", line 607, in handle_request return self.eio.handle_request(environ, start_response) File "/usr/local/lib/python3.9/dist-packages/engineio/server.py", line 412, in handle_request packets = socket.handle_get_request( File "/usr/local/lib/python3.9/dist-packages/engineio/socket.py", line 103, in handle_get_request return getattr(self, 'upgrade' + transport)(environ, File "/usr/local/lib/python3.9/dist-packages/engineio/socket.py", line 159, in _upgrade_websocket return ws(environ, start_response) File "/usr/local/lib/python3.9/dist-packages/engineio/async_drivers/threading.py", line 22, in call self.ws = Server(environ) File "/usr/local/lib/python3.9/dist-packages/simple_websocket/ws.py", line 319, in init raise RuntimeError('Cannot obtain socket from WSGI environment.') RuntimeError: Cannot obtain socket from WSGI environment. 2023-09-02 18:57:53 INFO 10.0.0.75 - - [02/Sep/2023 18:57:53] "GET /socket.io/?EIO=4&transport=polling&t=OfOLCID&sid=XVuOHf2pm5PEosgSAAAE HTTP/1.1" 200 - 2023-09-02 18:57:53 INFO 10.0.0.75 - - [02/Sep/2023 18:57:53] "POST /socket.io/?EIO=4&transport=polling&t=OfOLEL6&sid=XVuOHf2pm5PEosgSAAAE HTTP/1.1" 200 - 2023-09-02 18:58:18 INFO 10.0.0.75 - - [02/Sep/2023 18:58:18] "GET /socket.io/?EIO=4&transport=polling&t=OfOLELI&sid=XVuOHf2pm5PEosgSAAAE HTTP/1.1" 200 -

mhmatttu commented 1 year ago

no longer getting this error after a full re-build. able to get accurate LED and display info but commands not working. will post a new issue.