Page 1 of 2

Webapp not working after latest updates

PostPosted: Mon May 27, 2019 5:51 am
by andersondg
I logged into the web app on my my AD2PI a few days ago and recieved the "Updates Available" message. I applied the latest library and webapp updates, restarted, and am now getting "Services might still be starting - please wait and try again. If this continues, please let us know on GitHub. You can also email us at Support." and "502 Bad Gateway". I am able to telnet and SSH to the AD2PI, but my technical troubleshooting skills are somewhat limited beyond that.

Thank you in advance for your help, and Happy Memorial Day!

Re: Webapp not working after latest updates

PostPosted: Mon May 27, 2019 9:06 pm
by andersondg
The latest webapp update causes an issue with the webapp which results in a "502 Bad Gateway" message in the browser. I updated what had been a stable version, and then attempted to troubleshoot to no avail. I downloaded the current image (alarm decoder-raspbian-2018-05-29.img) and started over. After going through the initial config I updated the webapp again through alarmdecoder.local/update/ with the same result after restart (IE: 502 Bad Gateway). Unfortunately my ability to troubleshoot further is limited.

Re: Webapp not working after latest updates

PostPosted: Wed May 29, 2019 9:05 am
by delphimon
I have the same exact same symptoms and problem. Unfortunately, I didn't do an export of settings beforehand (since updates through the UI have always worked for me in the past), so I don't want to blow everything away and reinstall again, set up devices, SmartThings integration, new devices there again, etc. Any suggestions?

Re: Webapp not working after latest updates

PostPosted: Wed May 29, 2019 5:26 pm
by delphimon
OK, to answer my own question, I had to update the version of Flask using pip, and then I ran into another issue with problem loading ext.cache. This turned out to be a problem with the flask_cache package. I ended up taking the path of least resistance and just manually changed the jinja2ext.py file at line 33 to import from flast_cache rather than flask.ext.cache. I'm sure there is a more elegant solution, but I really didn't want to deal with any more dependencies, and this worked for me.

Re: Webapp not working after latest updates

PostPosted: Mon Jun 17, 2019 10:41 am
by clif
I just updated today and got the same 502 Bad Gateway error. I wasn't expecting to have to reload my image. :(
I found the sqlite3 DB with the logins, etc. Unless someone has an easy fix to keep things moving forward, I plan go grab the DB and config files and try to get a fresh image back to the way I previously had it. I hope this is not the normal upgrade path.

Re: Webapp not working after latest updates

PostPosted: Tue Jun 18, 2019 5:03 am
by clif
Following up. I got back up and running by saving most of my configuration and then doing the PiBakery image.
I saved the Sqlite3 DB on the old image before re-install.

Code: Select all
scp pi@alarmdecoder.mynetwork:opt/alarmdecoder-webapp/instance/db.sqlite .


After I reloaded with the latest PiBakery image, I restored the DB.

Code: Select all
scp db.sqlite pi@alarmdecoder.mynetwork:.
ssh pi@alarmdecoder.mynetwork
$  cd opt/alarmdecoder-webapp/instance
$  mv db.sqlite db.sqlite_orig
$  mv ~/db.sqlite .
$ sync
$ reboot


That saves your config. logins, etc.

Re: Webapp not working after latest updates

PostPosted: Tue Jun 18, 2019 5:32 pm
by mathewss
Thanks Clif. That is a perfect explanation of what I have been doign to help fix peoples systems the past few weeks :)

.....
You will need to download a new image from our site you must have had an older Raspian 8 image and they can not be updated and are not supported by Debian group any longer.

If you need to recover your settings and did not make a backup using the web interfaces prior to updates and now have a 502 error they can be extracted from the system using putty scp and copy the file in /opt/alarmdecoder-webapp/instances/db.sqlite to your local system and after you flash a new disk and power it up you can put this file back and then just reboot the pi and your settings should be restored.

If you have a backup just restore the image power it up and run through the setup with dummy data. Go into setings advanced and re import your settings. Reboot.

At some point I will likely find a way to add an upload at the start of the setup wizard since it is a pointless step when one is rebuilding.

https://www.alarmdecoder.com/wiki/index ... spberry_Pi

Best
Sean M

Re: Webapp not working after latest updates

PostPosted: Sat Jul 13, 2019 2:26 pm
by jasonsf
I also just updated my pi to the PiBakery image. Restored my db.sqlite and am up and running. Question: the logs page gets an error and it looks like the call to alarmdecoder.local/log/retrieve_events_paging_data? is failing with flask errors.

Is there anything I should do with the pibakery image once it is running? Update apt modules? pip modules, etc?

Follow up: The web app notified me of updates so I installed them. Now I'm back where I was before reimaging. The Keypad of the web app shows "Please Wait Loading" and stays that way.

Additional information: App errors keep repeating this (192.168.11.253=alarmdecoder, 192.168.11.251=smartthings hub)
Code: Select all
2019-07-16 07:36:27,379 INFO: SUBSCRIBE host:192.168.11.253:5000 callback: <http://192.168.11.251:39500/notify> timeout: Second-28800 [in /opt/alarmdecoder-webapp/ad2web/api/views.py:243]
2019-07-16 07:36:27,380 INFO: add_subscriber: 3bf03370-a739-11e9-b80a-b827ebf642c7 [in /opt/alarmdecoder-webapp/ad2web/notifications/types.py:203]
2019-07-16 07:41:18,519 INFO: Checking for version updates - last check at: 07-16-2019 07:31:15 [in /opt/alarmdecoder-webapp/ad2web/decoder.py:616]
2019-07-16 07:41:27,417 INFO: SUBSCRIBE host:192.168.11.253:5000 callback: <http://192.168.11.251:39500/notify> timeout: Second-28800 [in /opt/alarmdecoder-webapp/ad2web/api/views.py:243]
2019-07-16 07:41:27,419 INFO: add_subscriber: 3bf03370-a739-11e9-b80a-b827ebf642c7 [in /opt/alarmdecoder-webapp/ad2web/notifications/types.py:203]
2019-07-16 07:46:27,053 INFO: SUBSCRIBE host:192.168.11.253:5000 callback: <http://192.168.11.251:39500/notify> timeout: Second-28800 [in /opt/alarmdecoder-webapp/ad2web/api/views.py:243]
2019-07-16 07:46:27,055 INFO: add_subscriber: 3bf03370-a739-11e9-b80a-b827ebf642c7 [in /opt/alarmdecoder-webapp/ad2web/notifications/types.py:203]
2019-07-16 07:51:21,392 INFO: Checking for version updates - last check at: 07-16-2019 07:41:18 [in /opt/alarmdecoder-webapp/ad2web/decoder.py:616]
2019-07-16 07:51:29,176 INFO: SUBSCRIBE host:192.168.11.253:5000 callback: <http://192.168.11.251:39500/notify> timeout: Second-28800 [in /opt/alarmdecoder-webapp/ad2web/api/views.py:243]
2019-07-16 07:51:29,178 INFO: add_subscriber: 3bf03370-a739-11e9-b80a-b827ebf642c7 [in /opt/alarmdecoder-webapp/ad2web/notifications/types.py:203]
2019-07-16 07:56:27,127 INFO: SUBSCRIBE host:192.168.11.253:5000 callback: <http://192.168.11.251:39500/notify> timeout: Second-28800 [in /opt/alarmdecoder-webapp/ad2web/api/views.py:243]
2019-07-16 07:56:27,132 INFO: add_subscriber: 3bf03370-a739-11e9-b80a-b827ebf642c7 [in /opt/alarmdecoder-webapp/ad2web/notifications/types.py:203]
2019-07-16 08:01:25,425 INFO: Checking for version updates - last check at: 07-16-2019 07:51:21 [in /opt/alarmdecoder-webapp/ad2web/decoder.py:616]
2019-07-16 08:01:27,006 INFO: SUBSCRIBE host:192.168.11.253:5000 callback: <http://192.168.11.251:39500/notify> timeout: Second-28800 [in /opt/alarmdecoder-webapp/ad2web/api/views.py:243]
2019-07-16 08:01:27,008 INFO: add_subscriber: 3bf03370-a739-11e9-b80a-b827ebf642c7 [in /opt/alarmdecoder-webapp/ad2web/notifications/types.py:203]
2019-07-16 08:06:26,811 INFO: SUBSCRIBE host:192.168.11.253:5000 callback: <http://192.168.11.251:39500/notify> timeout: Second-28800 [in /opt/alarmdecoder-webapp/ad2web/api/views.py:243]
2019-07-16 08:06:26,813 INFO: add_subscriber: 3bf03370-a739-11e9-b80a-b827ebf642c7 [in /opt/alarmdecoder-webapp/ad2web/notifications/types.py:203]
2019-07-16 08:11:27,175 INFO: SUBSCRIBE host:192.168.11.253:5000 callback: <http://192.168.11.251:39500/notify> timeout: Second-28800 [in /opt/alarmdecoder-webapp/ad2web/api/views.py:243]
2019-07-16 08:11:27,176 INFO: add_subscriber: 3bf03370-a739-11e9-b80a-b827ebf642c7 [in /opt/alarmdecoder-webapp/ad2web/notifications/types.py:203]
2019-07-16 08:11:28,046 INFO: Checking for version updates - last check at: 07-16-2019 08:01:25 [in /opt/alarmdecoder-webapp/ad2web/decoder.py:616]
2019-07-16 08:16:27,826 INFO: SUBSCRIBE host:192.168.11.253:5000 callback: <http://192.168.11.251:39500/notify> timeout: Second-28800 [in /opt/alarmdecoder-webapp/ad2web/api/views.py:243]
2019-07-16 08:16:27,828 INFO: add_subscriber: 3bf03370-a739-11e9-b80a-b827ebf642c7 [in /opt/alarmdecoder-webapp/ad2web/notifications/types.py:203]
2019-07-16 08:21:26,929 INFO: SUBSCRIBE host:192.168.11.253:5000 callback: <http://192.168.11.251:39500/notify> timeout: Second-28800 [in /opt/alarmdecoder-webapp/ad2web/api/views.py:243]
2019-07-16 08:21:26,931 INFO: add_subscriber: 3bf03370-a739-11e9-b80a-b827ebf642c7 [in /opt/alarmdecoder-webapp/ad2web/notifications/types.py:203]
2019-07-16 08:21:31,115 INFO: Checking for version updates - last check at: 07-16-2019 08:11:28 [in /opt/alarmdecoder-webapp/ad2web/decoder.py:616]


Thanks-
Jason

Re: Webapp not working after latest updates

PostPosted: Tue Jul 16, 2019 7:58 am
by jasonsf
At this point, it looks like the only problem I'm having is the Smartthings communication. This started with the latest webapp update, I believe.

From pi to smartthings hub:
Code: Select all
pi@AlarmDecoder:~ $ sudo nmap -p 5000 192.168.11.251

Starting Nmap 7.40 ( https://nmap.org ) at 2019-07-16 08:47 PDT
Nmap scan report for 192.168.11.251
Host is up (0.011s latency).
PORT     STATE  SERVICE
5000/tcp closed upnp
MAC Address: D0:52:A8:35:90:B9 (Physical Graph)

Nmap done: 1 IP address (1 host up) scanned in 0.98 seconds


Code: Select all
<e:property><panelstate><panel_perimeter_only>False</panel_perimeter_only><panel_chime>False</panel_chime><panel_alarming>False</panel_alarming><panel_battery_trouble>False</panel_battery_trouble><panel_entry_delay_off>False</panel_entry_delay_off><panel_ready>True</panel_ready><panel_fire_detected>False</panel_fire_detected><panel_powered>True</panel_powered><panel_exit>False</panel_exit><panel_panicked>False</panel_panicked><panel_armed_stay>False</panel_armed_stay><panel_type>ADEMCO</panel_type><panel_bypassed>False</panel_bypassed><panel_armed>False</panel_armed><panel_relay_status /><panel_zones_faulted /><last_message_received><!-- --><![CDATA[[10000001000000003A--],008,[f70200051008001c08020000000000],"****DISARMED****  Ready to Arm  "]]><!-- --></last_message_received></panelstate></e:property>
</e:propertyset> [in /opt/alarmdecoder-webapp/ad2web/notifications/types.py:462]
2019-07-16 08:55:33,978 INFO: Event UPNPPush Notification Failed: [Errno 113] No route to host line: 464 [in /opt/alarmdecoder-webapp/ad2web/notifications/types.py:467]
2019-07-16 08:55:33,989 INFO: Event: 0451449:0:0:0:0:0:0 [in /opt/alarmdecoder-webapp/ad2web/notifications/types.py:422]
2019-07-16 08:55:34,081 ERROR: Error sending notification for UPNPPush: line: 138 UPNPPushNotification Failed: [Errno 113] No route to host line: 464 [in /opt/alarmdecoder-webapp/ad2web/decoder.py:459]

Re: Webapp not working after latest updates

PostPosted: Wed Jul 31, 2019 12:04 pm
by Gordon
I’m sure glad someone raised this issue here… I am another one who was confounded when trying to update.

I had not used my system in at least four months due to a move, and not done updates before that for a time since it was working fine. At the new house I got it up and running in short order yesterday. But then I tired to do the update and bricked the app with little clue why. So I restored my RasPi image and rebooted and it worked again, but only until I tried to update again.

Then I found this forum thread and figured out my system was too old to update via the web-app.

Its a bit of a project for me because I run the RasPi on WiFi and access it remotely, so I had to disconnect the wiring at the alarm panel and set up a workstation with keyboard and monitor and the RasPi. I started to set up PiBakery on my Win PC but with my very slow DSL I was looking at hours to download or maybe hours to compile, so I got the image file and logged on via shell to set up the WiFi manually, and restored the sql database as described above. So, all-in-all it was about eight hours to figure out the problem and get it updated but it seems OK now.

I don’t know if this is an issue or not but the App log shows (in part):

NoDeviceError: ('Error opening device at localhost:10000', error(111, 'Connection refused'))
2019-07-31 12:17:21,376 ERROR: Device not found: Error opening device at localhost:10000 [in /opt/alarmdecoder-webapp/ad2web/decoder.py:545]
2019-07-31 12:17:26,385 INFO: Attempting to reconnect to the AlarmDecoder [in /opt/alarmdecoder-webapp/ad2web/decoder.py:541]
2019-07-31 12:17:26,633 WARNING: Open failed: Error opening device at localhost:10000 [in /opt/alarmdecoder-webapp/ad2web/decoder.py:305]
Traceback (most recent call last):
File "/opt/alarmdecoder-webapp/ad2web/decoder.py", line 302, in open
self.device.open(baudrate=self._device_baudrate, no_reader_thread=no_reader_thread)
File "/opt/alarmdecoder/alarmdecoder/decoder.py", line 277, in open
no_reader_thread=no_reader_thread)
File "/opt/alarmdecoder/alarmdecoder/devices/socket_device.py", line 208, in open
raise NoDeviceError('Error opening device at {0}:{1}'.format(self._host, self._port), err)
NoDeviceError: ('Error opening device at localhost:10000', error(111, 'Connection refused'))
2019-07-31 12:17:26,663 ERROR: Device not found: Error opening device at localhost:10000 [in /opt/alarmdecoder-webapp/ad2web/decoder.py:545]
2019-07-31 12:38:22,991 INFO: AlarmDecoder Webapp booting up - v0.8.4-20-g5c16ef5 [in /opt/alarmdecoder-webapp/ad2web/decoder.py:230]