Skip to content

Commit 8f4a55e

Browse files
committed
add type dans historique
1 parent fcf772a commit 8f4a55e

3 files changed

Lines changed: 20 additions & 3 deletions

File tree

Decoder.py

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19330,6 +19330,21 @@ def decode_uplink(self, encoded_data, deveui=None):
1933019330
if res and res.get('parsed'):
1933119331
if len(res['parsed']) > 0:
1933219332
res['parsed']['_driver'] = drv.name
19333+
19334+
# Inject Manufacturer (Fabricant)
19335+
if manuf:
19336+
res['parsed']['Fabricant'] = manuf.capitalize()
19337+
elif 'nexelec' in drv.name.lower():
19338+
res['parsed']['Fabricant'] = 'Nexelec'
19339+
elif 'watteco' in drv.name.lower():
19340+
res['parsed']['Fabricant'] = 'Watteco'
19341+
elif 'adeunis' in drv.name.lower():
19342+
res['parsed']['Fabricant'] = 'Adeunis'
19343+
elif 'dragino' in drv.name.lower():
19344+
res['parsed']['Fabricant'] = 'Dragino'
19345+
elif 'milesight' in drv.name.lower():
19346+
res['parsed']['Fabricant'] = 'Milesight'
19347+
1933319348
return res['parsed']
1933419349
except Exception: pass
1933519350

@@ -19340,7 +19355,9 @@ def decode_uplink(self, encoded_data, deveui=None):
1934019355
if 'nexelec' in d.name.lower() or 'atmo' in d.name.lower():
1934119356
try:
1934219357
res = d.parse({"payload": raw_payload}, None)
19343-
if res and res.get('parsed'): return res['parsed']
19358+
if res and res.get('parsed'):
19359+
res['parsed']['Fabricant'] = 'Nexelec'
19360+
return res['parsed']
1934419361
except: pass
1934519362

1934619363
return {"error": "No driver found", "raw": raw_payload, "info": f"Manuf: {manuf}"}

app.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ def load_config():
2525
CHIRPSTACK_API_TOKEN = config.get("CHIRPSTACK_API_TOKEN", os.getenv("CHIRPSTACK_API_TOKEN", "your_token_here"))
2626
GITHUB_REPO = config.get("GITHUB_REPO", os.getenv("GITHUB_REPO", "Princeddn/chirp-api"))
2727
GITHUB_BRANCH = config.get("GITHUB_BRANCH", os.getenv("GITHUB_BRANCH", "data-backup"))
28-
GITHUB_PAT = config.get("GITHUB_PAT", os.getenv("GITHUB_PAT", ""))
28+
GITHUB_PAT = config.get("GITHUB_PAT", config.get("TOKEN_GITHUB", os.getenv("GITHUB_PAT", "")))
2929

3030

3131
def restore_database_from_github(force=False):

assets/js/dashboard.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -327,7 +327,7 @@ function renderTable(page) {
327327
tr.innerHTML = `
328328
<td>${d.received_at}</td>
329329
<td>${d.device_name}</td>
330-
<td>${d.decoded.Product_type || '-'}</td>
330+
<td>${d.decoded.Fabricant || d.decoded.product_type || d.decoded.Product_type || '-'}</td>
331331
<td><pre style="margin:0; font-size:0.8em">${d.raw_payload || ''}</pre></td>
332332
<td><pre style="margin:0; font-size:0.8em; color:var(--text-muted)">${JSON.stringify(d.decoded, null, 2)}</pre></td>
333333
`;

0 commit comments

Comments
 (0)