feat(gateway): add configuration file

Add config.json with gateway ID, MQTT broker settings and GATT UUIDs.
Avoids hardcoding environment-specific values in source code.
This commit is contained in:
DjeAvd
2026-04-08 09:19:55 +01:00
committed by Klagarge
parent 0076532845
commit 2a1111b6b5
4 changed files with 15 additions and 23 deletions

View File

@@ -1,13 +0,0 @@
import asyncio
from bleak import BleakScanner
async def scan():
print("Scan en cours (10 secondes)...")
devices = await BleakScanner.discover(timeout=10.0, return_adv=True)
for address, (device, adv) in devices.items():
if device.name and "Djelal" in device.name:
print(f"\n{device.name} | {address}")
print(f" Service UUIDs : {adv.service_uuids}")
print(f" Local name : {adv.local_name}")
asyncio.run(scan())

15
gateway/config.json Normal file
View File

@@ -0,0 +1,15 @@
{
"gateway_id": "gateway_lausanne_01",
"mqtt": {
"broker": "localhost",
"port": 1883
},
"ble": {
"service_uuid": "ef680100-9b35-4933-9b10-52ffa9740042",
"characteristics": {
"temperature": "ef680201-9b35-4933-9b10-52ffa9740042",
"co2": "ef680204-9b35-4933-9b10-52ffa9740042",
"humidity": "ef680203-9b35-4933-9b10-52ffa9740042"
}
}
}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 277 KiB

View File

@@ -1,10 +0,0 @@
import asyncio
from bleak import BleakScanner
async def scan():
print("Scan BLE en cours (5 secondes)...")
devices = await BleakScanner.discover(timeout=5.0)
for d in devices:
print(f"{d.name} | {d.address}")
asyncio.run(scan())