diff --git a/simulator.py b/simulator.py index 50b86e05..9859bfc5 100644 --- a/simulator.py +++ b/simulator.py @@ -515,6 +515,8 @@ def publish_orion(sid: str, sensor: dict) -> bool: entity = _ngsi_payload(sid, sensor, source="simulator", topic=topic) # Orion-LD est exposé sur localhost:2026 (hôte) base = "http://localhost:2026/ngsi-ld/v1" + # Debug: afficher l'ID de l'entité + print(f" 🌐 Orion-LD: ID={entity['id']}") # 1. Essayer de créer (POST) try: body = json.dumps(entity).encode() @@ -527,6 +529,8 @@ def publish_orion(sid: str, sensor: dict) -> bool: if e.code != 409: print(f" ⚠️ Orion-LD → {e.code}: {e.read().decode()[:200]}") return False + else: + print(f" ⚠️ Orion-LD → 409 Conflict (entity exists)") # 2. Déjà existant (409) → PATCH sur les attributs (avec @context complet requis par Orion-LD) try: # Orion-LD exige @context même dans le PATCH