jpmens / homie-ota

OTA "server" in Python for Homie
128 stars 50 forks source link

Changing configuration file requires clean install #20

Closed peterhanzlik closed 8 years ago

peterhanzlik commented 8 years ago

After I change configuration file "homie-ota.ini" (I changed property: MQTT_SENSOR_PREFIX) the homie-ota will not start, throwing errors. The only way to get it working is to remove the whole folder and copy a clean one.

jpmens commented 8 years ago

Can you show us the errors please? (BTW, this is quite possible; there are a number of cases we didn't test, as this was basically intended to be a quick-and-dirty utility; nevertheless, if we can catch them, all the better. :-)

peterhanzlik commented 8 years ago

Hi Jan-Piet, the OTA server is just fantastic, I fully understand that the aim was to quickly develop an OTA intereface.

Believe me or not, yesterday I got the error at least 10 times, over and over again. Now I get the just the following error message that gets fixed by restarting the server:

pecnet@ota:~/ota$ python homie-ota.py
Bottle v0.12.9 server starting up (using WSGIRefServer())...
Listening on http://0.0.0.0:9080/
Hit Ctrl-C to quit.

Traceback (most recent call last):
  File "homie-ota.py", line 486, in <module>
    run(host=OTA_HOST, port=OTA_PORT, debug=DEBUG)
  File "/usr/local/lib/python2.7/dist-packages/bottle.py", line 3117, in run
    server.run(app)
  File "/usr/local/lib/python2.7/dist-packages/bottle.py", line 2771, in run
    srv = make_server(self.host, self.port, app, server_cls, handler_cls)
  File "/usr/lib/python2.7/wsgiref/simple_server.py", line 144, in make_server
    server = server_class((host, port), handler_class)
  File "/usr/lib/python2.7/SocketServer.py", line 419, in __init__
    self.server_bind()
  File "/usr/lib/python2.7/wsgiref/simple_server.py", line 48, in server_bind
    HTTPServer.server_bind(self)
  File "/usr/lib/python2.7/BaseHTTPServer.py", line 108, in server_bind
    SocketServer.TCPServer.server_bind(self)
  File "/usr/lib/python2.7/SocketServer.py", line 430, in server_bind
    self.socket.bind(self.server_address)
  File "/usr/lib/python2.7/socket.py", line 224, in meth
    return getattr(self._sock,name)(*args)
socket.error: [Errno 98] Address already in use
Exception in thread Thread-1 (most likely raised during interpreter shutdown):
Traceback (most recent call last):
  File "/usr/lib/python2.7/threading.py", line 810, in __bootstrap_inner
  File "/usr/lib/python2.7/threading.py", line 763, in run
  File "/usr/local/lib/python2.7/dist-packages/paho/mqtt/client.py", line 2580, in _thread_main
  File "/usr/local/lib/python2.7/dist-packages/paho/mqtt/client.py", line 1378, in loop_forever
  File "/usr/local/lib/python2.7/dist-packages/paho/mqtt/client.py", line 897, in loop
  File "/usr/local/lib/python2.7/dist-packages/paho/mqtt/client.py", line 1172, in loop_read
<type 'exceptions.TypeError'>: 'NoneType' object is not callable
pecnet@ota:~/ota$

This message looks like bottle incorrectly closed the connection, doesn't look to be a homie-ota issue. However yesterday, the error message I got after restarting the server and starting bottle, was a problem with "fwname" (the error message was also displayed on the web page). I will try to simulate it again and then sent you also the second error message.

Thank you Peter

jpmens commented 8 years ago

socket.error: [Errno 98] Address already in use

indicates there is already a process (another homie-ota?) listening on that address/port

was a problem with "fwname"

that is caused by something publishing without the fwname (firmware name) topic; this is a bug, and we'll try to fix that.