srcfl / srcful-gateway

Sourceful Energy Gateway: Connect your solar inverter or Utility meters to earn tokens.
https://sourceful.energy/
MIT License
5 stars 2 forks source link

gateway not beaconing (LoRa) #288

Open davmoz opened 2 weeks ago

davmoz commented 2 weeks ago

investigate why the gateway in some cases does not beacon.

h0bb3 commented 2 weeks ago

The ble container in the gw without concentrator seems to crash after a while:

check File "/code/ble_service.py", line 157, in <module>

13:44:372024-11-07 13:44:37
- srcful_gateway - INFO - Swarm id retrieved
13:44:372024-11-07 13:44:37
- helium_gateway - WARNING - Helium Gateway initialized
13:44:372024-11-07 13:44:37
Traceback (most recent call last):
13:44:372024-11-07 13:44:37
File "/code/venv/lib/python3.11/site-packages/urllib3/connection.py", line 199, in _new_conn
13:44:372024-11-07 13:44:37
sock = connection.create_connection(
13:44:372024-11-07 13:44:37
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
13:44:372024-11-07 13:44:37
File "/code/venv/lib/python3.11/site-packages/urllib3/util/connection.py", line 85, in create_connection
13:44:372024-11-07 13:44:37
raise err
13:44:372024-11-07 13:44:37
File "/code/venv/lib/python3.11/site-packages/urllib3/util/connection.py", line 73, in create_connection
13:44:372024-11-07 13:44:37
sock.connect(sa)
13:44:372024-11-07 13:44:37
ConnectionRefusedError: [Errno 111] Connection refused
13:44:372024-11-07 13:44:37
13:44:372024-11-07 13:44:37
The above exception was the direct cause of the following exception:
13:44:372024-11-07 13:44:37
13:44:372024-11-07 13:44:37
Traceback (most recent call last):
13:44:372024-11-07 13:44:37
File "/code/venv/lib/python3.11/site-packages/urllib3/connectionpool.py", line 789, in urlopen
13:44:372024-11-07 13:44:37
response = self._make_request(
13:44:372024-11-07 13:44:37
^^^^^^^^^^^^^^^^^^^
13:44:372024-11-07 13:44:37
File "/code/venv/lib/python3.11/site-packages/urllib3/connectionpool.py", line 495, in _make_request
13:44:372024-11-07 13:44:37
conn.request(
13:44:372024-11-07 13:44:37
File "/code/venv/lib/python3.11/site-packages/urllib3/connection.py", line 441, in request
13:44:372024-11-07 13:44:37
self.endheaders()
13:44:372024-11-07 13:44:37
File "/usr/local/lib/python3.11/http/client.py", line 1289, in endheaders
13:44:372024-11-07 13:44:37
self._send_output(message_body, encode_chunked=encode_chunked)
13:44:372024-11-07 13:44:37
File "/usr/local/lib/python3.11/http/client.py", line 1048, in _send_output
13:44:372024-11-07 13:44:37
self.send(msg)
13:44:372024-11-07 13:44:37
File "/usr/local/lib/python3.11/http/client.py", line 986, in send
13:44:372024-11-07 13:44:37
self.connect()
13:44:372024-11-07 13:44:37
File "/code/venv/lib/python3.11/site-packages/urllib3/connection.py", line 279, in connect
13:44:372024-11-07 13:44:37
self.sock = self._new_conn()
13:44:372024-11-07 13:44:37
^^^^^^^^^^^^^^^^
13:44:372024-11-07 13:44:37
File "/code/venv/lib/python3.11/site-packages/urllib3/connection.py", line 214, in _new_conn
13:44:372024-11-07 13:44:37
raise NewConnectionError(
13:44:372024-11-07 13:44:37
urllib3.exceptions.NewConnectionError: <urllib3.connection.HTTPConnection object at 0x7fa200c850>: Failed to establish a new connection: [Errno 111] Connection refused
13:44:372024-11-07 13:44:37
13:44:372024-11-07 13:44:37
The above exception was the direct cause of the following exception:
13:44:372024-11-07 13:44:37
13:44:372024-11-07 13:44:37
Traceback (most recent call last):
13:44:372024-11-07 13:44:37
File "/code/venv/lib/python3.11/site-packages/requests/adapters.py", line 564, in send
13:44:372024-11-07 13:44:37
resp = conn.urlopen(
13:44:372024-11-07 13:44:37
^^^^^^^^^^^^^
13:44:372024-11-07 13:44:37
File "/code/venv/lib/python3.11/site-packages/urllib3/connectionpool.py", line 843, in urlopen
13:44:372024-11-07 13:44:37
retries = retries.increment(
13:44:372024-11-07 13:44:37
^^^^^^^^^^^^^^^^^^
13:44:372024-11-07 13:44:37
File "/code/venv/lib/python3.11/site-packages/urllib3/util/retry.py", line 519, in increment
13:44:372024-11-07 13:44:37
raise MaxRetryError(_pool, url, reason) from reason # type: ignore[arg-type]
13:44:372024-11-07 13:44:37
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
13:44:372024-11-07 13:44:37
urllib3.exceptions.MaxRetryError: HTTPConnectionPool(host='localhost', port=3000): Max retries exceeded with url: /name (Caused by NewConnectionError('<urllib3.connection.HTTPConnection object at 0x7fa200c850>: Failed to establish a new connection: [Errno 111] Connection refused'))
13:44:372024-11-07 13:44:37
13:44:372024-11-07 13:44:37
During handling of the above exception, another exception occurred:
13:44:372024-11-07 13:44:37
13:44:372024-11-07 13:44:37
Traceback (most recent call last):
13:44:372024-11-07 13:44:37
File "/code/ble_service.py", line 157, in <module>
13:44:372024-11-07 13:44:37
asyncio.run(run(args.gpio_button_pin))
13:44:372024-11-07 13:44:37
File "/usr/local/lib/python3.11/asyncio/runners.py", line 190, in run
13:44:372024-11-07 13:44:37
return runner.run(main)
13:44:372024-11-07 13:44:37
^^^^^^^^^^^^^^^^
13:44:372024-11-07 13:44:37
File "/usr/local/lib/python3.11/asyncio/runners.py", line 118, in run
13:44:372024-11-07 13:44:37
return self._loop.run_until_complete(task)
13:44:372024-11-07 13:44:37
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
13:44:372024-11-07 13:44:37
File "/usr/local/lib/python3.11/asyncio/base_events.py", line 653, in run_until_complete
13:44:372024-11-07 13:44:37
return future.result()
13:44:372024-11-07 13:44:37
^^^^^^^^^^^^^^^
13:44:372024-11-07 13:44:37
File "/code/ble_service.py", line 79, in run
13:44:372024-11-07 13:44:37
gateway = Gateway(SERVER)
13:44:372024-11-07 13:44:37
^^^^^^^^^^^^^^^
13:44:372024-11-07 13:44:37
File "/code/gateway.py", line 31, in __init__
13:44:372024-11-07 13:44:37
self.helium_gw = HeliumGateway()
13:44:372024-11-07 13:44:37
^^^^^^^^^^^^^^^
13:44:372024-11-07 13:44:37
File "/code/helium_gateway.py", line 18, in __init__
13:44:372024-11-07 13:44:37
self.fetch_animal_name()
13:44:372024-11-07 13:44:37
File "/code/helium_gateway.py", line 22, in fetch_animal_name
13:44:372024-11-07 13:44:37
response = requests.get(url)
13:44:372024-11-07 13:44:37
^^^^^^^^^^^^^^^^^
13:44:372024-11-07 13:44:37
File "/code/venv/lib/python3.11/site-packages/requests/api.py", line 73, in get
13:44:372024-11-07 13:44:37
return request("get", url, params=params, **kwargs)
13:44:372024-11-07 13:44:37
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
13:44:372024-11-07 13:44:37
File "/code/venv/lib/python3.11/site-packages/requests/api.py", line 59, in request
13:44:372024-11-07 13:44:37
return session.request(method=method, url=url, **kwargs)
13:44:372024-11-07 13:44:37
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
13:44:372024-11-07 13:44:37
File "/code/venv/lib/python3.11/site-packages/requests/sessions.py", line 589, in request
13:44:372024-11-07 13:44:37
resp = self.send(prep, **send_kwargs)
13:44:372024-11-07 13:44:37
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
13:44:372024-11-07 13:44:37
File "/code/venv/lib/python3.11/site-packages/requests/sessions.py", line 703, in send
13:44:372024-11-07 13:44:37
r = adapter.send(request, **kwargs)
13:44:372024-11-07 13:44:37
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
13:44:372024-11-07 13:44:37
File "/code/venv/lib/python3.11/site-packages/requests/adapters.py", line 597, in send
13:44:372024-11-07 13:44:37
raise ConnectionError(e, request=request)
13:44:372024-11-07 13:44:37
requests.exceptions.ConnectionError: HTTPConnectionPool(host='localhost', port=3000): Max retries exceeded with url: /name (Caused by NewConnectionError('<urllib3.connection.HTTPConnection object at 0x7fa200c850>: Failed to establish a new connection: [Errno 111] Connection refused'))
davmoz commented 1 week ago

Looks like EU and AU gateways are beaconing just fine and that the issue is so far only observed in US gateways.