22 lines
863 B
Python
22 lines
863 B
Python
|
import asyncio
|
||
|
|
||
|
from lib.topic_message import TMQueue
|
||
|
from async_tasks.general_tasks import measure_sensors
|
||
|
|
||
|
async def main_wifi(uuid, sensors, mqtt_client, temperature_topic, inbound_topic):
|
||
|
from async_tasks.wireless_tasks import mqtt_publish_tmsgs
|
||
|
outbound_queue = TMQueue()
|
||
|
asyncio.create_task(measure_sensors(sensors, 1, uuid, outbound_queue, temperature_topic))
|
||
|
asyncio.create_task(mqtt_publish_tmsgs(mqtt_client, outbound_queue, 0.5))
|
||
|
|
||
|
while True:
|
||
|
await asyncio.sleep(5)
|
||
|
|
||
|
async def main_wired(uuid, sensors, temperature_topic, inbound_topic):
|
||
|
from async_tasks.wired_tasks import usb_send_data
|
||
|
outbound_queue = TMQueue()
|
||
|
asyncio.create_task(measure_sensors(sensors, 1, uuid, outbound_queue, temperature_topic))
|
||
|
asyncio.create_task(usb_send_data(outbound_queue, 0.5))
|
||
|
|
||
|
while True:
|
||
|
await asyncio.sleep(5)
|