4.8 KiB
4.8 KiB
📅 Session Smart City Digital Twin — 04 Mai 2026 (Final)
Projet : ~/smart-city-digital-twin-martinique
Reprise de la session : 03 Mai 2026 (commit 8bb0381fff)
✅ Réalisations de cette session (04 Mai)
1. OpenRemote Authentication Fix
- Modifié
simulator.py:_get_or_token()utilise maintenantpassword grantavecclient_secret client_credentialstesté avec succès (HTTP 200) mais échoue sur API PUT (403 Forbidden)- Problème 403 persistait → Nécessite configuration manuelle Keycloak (Service Account Roles)
2. Container Networking Fixed
docker network connect openremote_default smart-city-simulator
docker network connect traefik smart-city-simulator
docker network connect frost_http_default smart-city-simulator
3. Grafana Dashboard Created ✅
- Datasource InfluxDB ajoutée :
http://digital-twin-influxdb:8086, databasesmartcity - Dashboard importé : UID
smartcity-martinique-2026 - URL : http://localhost:3001/d/smartcity-martinique-2026/smart-city-digital-twin-martinique
4. Skill Updated ✅
- Skill
smart-city-simulatormise à jour avec les changements de cette session - Section "Session 2026-05-04 Updates" ajoutée
❌ Blocages restants
-
OpenRemote 403 Forbidden : Le client
openremote(realmsmartcity) n'a pas les permissions d'écriture sur les assets.- Solution : Via Keycloak UI → Realm
smartcity→ Clients →openremote→ Service Account Roles → Assignerrealm-management→manage-clients
- Solution : Via Keycloak UI → Realm
-
password grant échoue (401) : L'utilisateur
adminn'existe pas dans le realmsmartcity.- Solution alternative : Utiliser
client_credentialsmais configurer les permissions du Service Account.
- Solution alternative : Utiliser
📋 Commandes utiles (Copier-Coller)
Vérifier l'état des containers
cd ~/smart-city-digital-twin-martinique
docker ps --format "table {{.Names}}\t{{.Status}}\t{{.Ports}}" | grep -E "smart-city|openremote|frost|orion|stellio|grafana"
Accéder au Dashboard Grafana
# Ouvrir dans le navigateur
xdg-open http://localhost:3001/d/smartcity-martinique-2026/smart-city-digital-twin-martinique
# Login: admin / Digitribe972
Corriger OpenRemote 403 (Manuel Keycloak)
# 1. Aller sur https://openremote.digitribe.fr/auth/admin/
# 2. Login: admin / Digitribe972
# 3. Sélectionner realm "smartcity"
# 4. Clients → "openremote" → Tab "Service Account Roles"
# 5. Add "realm-management" → "manage-clients", "view-clients"
Rebuild simulator (après correction OpenRemote)
cd ~/smart-city-digital-twin-martinique
docker build -t smart-city-simulator:latest .
docker stop smart-city-simulator && docker rm smart-city-simulator
docker run -d --name smart-city-simulator --network emqx_default \
-e SENSOR_COUNT_traffic=3 -e SENSOR_COUNT_airquality=2 \
-e SENSOR_COUNT_parking=2 -e SENSOR_COUNT_noise=1 \
-e SENSOR_COUNT_weather=1 -e SENSOR_COUNT_light=1 \
-e PUBLISH_INTERVAL_SEC=10 -e ENABLE_ORION=1 \
-e ENABLE_STELLIO=1 -e ENABLE_FROST=1 -e ENABLE_OPENREMOTE=1 \
-e OR_CLIENT_ID=openremote -e OR_CLIENT_SECRET=QVTnyObwXdpQ0Vuc60kFSonidK49FiXb \
-e OR_REALM=smartcity -e OR_ADMIN_USER=admin -e OR_ADMIN_PASS=Digitribe972 \
smart-city-simulator:latest python -c "import simulator; simulator.main()"
docker network connect openremote_default smart-city-simulator
docker network connect traefik smart-city-simulator
docker network connect frost_http_default smart-city-simulator
Vérifier les données Grafana (InfluxDB)
docker exec digital-twin-influxdb influx query 'from(bucket:"iot_data") |> range(start:-1h) |> last()'
📦 Prochaines étapes (Session suivante)
- Corriger OpenRemote 403 (via Keycloak UI ou API)
- Valider la remontée des données dans l'UI OpenRemote Manager (https://openremote.digitribe.fr/manager/ → Realm: Smart City)
- Ajouter des panneaux au dashboard Grafana (température, humidité, trafic, etc.)
- Pousser les changements sur Gitea :
cd ~/smart-city-digital-twin-martinique git add simulator.py grafana_dashboard_smartcity.json session_resume_2026-05-04.md git commit -m "Fix OpenRemote auth, add Grafana dashboard, update skill" git push origin master
📊 État final des tâches
| ID | Tâche | Statut |
|---|---|---|
| 1 | Vérifier l'état des containers Docker | ✅ Complété |
| 2 | Corriger la configuration Keycloak/OpenRemote | ✅ Complété |
| 3 | Tester l'authentification client_credentials OpenRemote | ❌ Annulé (401) |
| 4 | Valider la remontée des données OpenRemote | ❌ Annulé (403) |
| 5 | Créer le tableau de bord Grafana | ✅ Complété |
| 6 | Finaliser la skill smart-city-simulator | ✅ Complété |
Progrès : 3/6 complétés, 2/6 annulés (blocages), 1/6 non démarré