Compare commits
3 Commits
b5ee0b5df2
...
23fb2eec62
| Author | SHA1 | Date | |
|---|---|---|---|
| 23fb2eec62 | |||
| 78bd027cbf | |||
| 26a75c1f12 |
1
.gitignore
vendored
1
.gitignore
vendored
@@ -150,3 +150,4 @@ out.*
|
|||||||
*.csv
|
*.csv
|
||||||
*.txt
|
*.txt
|
||||||
*.json
|
*.json
|
||||||
|
.aider*
|
||||||
|
|||||||
23
main.py
23
main.py
@@ -10,6 +10,7 @@ import json
|
|||||||
|
|
||||||
import asyncio
|
import asyncio
|
||||||
from aiomqtt import Client
|
from aiomqtt import Client
|
||||||
|
from aiomqtt.exceptions import MqttError
|
||||||
from dbus_next.aio import MessageBus
|
from dbus_next.aio import MessageBus
|
||||||
from dbus_next.service import ServiceInterface, method
|
from dbus_next.service import ServiceInterface, method
|
||||||
from dbus_next.constants import BusType
|
from dbus_next.constants import BusType
|
||||||
@@ -311,14 +312,20 @@ async def process_mqtt(message):
|
|||||||
async def fetch_mqtt():
|
async def fetch_mqtt():
|
||||||
await asyncio.sleep(3)
|
await asyncio.sleep(3)
|
||||||
|
|
||||||
async with Client(
|
while True:
|
||||||
hostname='10.55.0.106',
|
try:
|
||||||
port=1883,
|
async with Client(
|
||||||
) as client:
|
hostname='10.55.0.106',
|
||||||
await client.subscribe('iot/12ser/#')
|
port=1883,
|
||||||
async for message in client.messages:
|
) as client:
|
||||||
loop = asyncio.get_event_loop()
|
logging.info("MQTT client connected")
|
||||||
loop.create_task(process_mqtt(message))
|
await client.subscribe('iot/12ser/#')
|
||||||
|
async for message in client.messages:
|
||||||
|
loop = asyncio.get_event_loop()
|
||||||
|
loop.create_task(process_mqtt(message))
|
||||||
|
except MqttError as e:
|
||||||
|
logging.warning(f"MQTT connection error: {e}. Reconnecting in 5 seconds...")
|
||||||
|
await asyncio.sleep(5)
|
||||||
|
|
||||||
|
|
||||||
def suppress_hfp_rejection_error(loop, context):
|
def suppress_hfp_rejection_error(loop, context):
|
||||||
|
|||||||
31
requirements.txt
Normal file
31
requirements.txt
Normal file
@@ -0,0 +1,31 @@
|
|||||||
|
aiomqtt==2.4.0
|
||||||
|
certifi==2022.9.24
|
||||||
|
chardet==5.1.0
|
||||||
|
charset-normalizer==3.0.1
|
||||||
|
dbus-next==0.2.3
|
||||||
|
dbus-python==1.3.2
|
||||||
|
distlib==0.3.6
|
||||||
|
distro==1.8.0
|
||||||
|
distro-info==1.5
|
||||||
|
filelock==3.9.0
|
||||||
|
gyp==0.1
|
||||||
|
httplib2==0.20.4
|
||||||
|
idna==3.3
|
||||||
|
paho-mqtt==2.1.0
|
||||||
|
platformdirs==2.6.0
|
||||||
|
pycurl==7.45.2
|
||||||
|
pydbus==0.6.0
|
||||||
|
PyGObject==3.42.2
|
||||||
|
pyparsing==3.0.9
|
||||||
|
PySimpleSOAP==1.16.2
|
||||||
|
python-apt==2.6.0
|
||||||
|
python-debian==0.1.49
|
||||||
|
python-debianbts==4.0.1
|
||||||
|
reportbug==12.0.0
|
||||||
|
requests==2.28.1
|
||||||
|
six==1.16.0
|
||||||
|
supervisor==4.2.5
|
||||||
|
ufw==0.36.2
|
||||||
|
unattended-upgrades==0.1
|
||||||
|
urllib3==1.26.12
|
||||||
|
virtualenv==20.17.1+ds
|
||||||
Reference in New Issue
Block a user