fel-x Posté(e) il y a 9 heures Signaler Posté(e) il y a 9 heures Je suis toujours dans mon projet de QA de gestion des icônes et ça devient vraiment pas mal. Mais je bloque lorsque je veux afficher les icônes natives d'un device. Le chemin de l'icône pour chaque device peut être déduit depuis les infos contenues dans le JSON du device (accessible via REST API sur BOX_IP/api/devices/#ID) : properties.deviceIcon donne l'ID du l'icône et parfois même son chemin est déjà précisé dans properties.icon.path Lorsque deviceIcon est > 1000 c'est facile ; c'est une icône custom et son chemin est logique : BOX_IP/assets/userIcons/devices/User100X/User100X.png (avec quelques subtilités pour les multistates) Mais lorsque le deviceIcon est < 1000 ça signifie que l'icône est native dans la HC3. Si son properties.icon.path est indiqué, alors c'est simple, mais là où ça se corse c'est s'il est vide. Il m'est impossible de reconstruire le chemin de l'icône au départ de son properties.deviceIcon Je pensais pouvoir le récupérer depuis icons.json obtenu par l'API REST sur BOX_IP/api/icons mais je découvre que api.get("/icons") ne renvoie pas du tout les mêmes infos ! Il est plutôt très court et ne contient presque aucune info sur les icônes générales de la box. J'y vois 19 entrées parlant juste des icônes spéciales (FGKF, FGGC,FGPB, FGCD, usbPort) C'est bizarre car si on fait le parallèle, l'API sur les devices renvoie exactement la même chose via le REST API (BOX_IP/api/devices) que via api.get("/devices"). Quelqu'un sait pourquoi tous les icônes ne sont pas exposées par api.get("/icons") ? Et aussi comment récupérer le chemin de l'icône dans un tel cas ? A titre d'exemple mon device ID 711 est une caméra IP. Sur BOX_IP/api/devices/711 je lis bien ceci : { "id": 711, "name": "Cam4", "roomID": 227, "view": [], "type": "com.fibaro.ipCamera", "baseType": "com.fibaro.camera", ... "properties": { ... "deviceIcon": 92, ... "icon": { "path": "", "source": "" }, ... } Vu que properties.icon.path est vide, je pars vérifier manuellement dans le JSON des icônes via BOX_IP/api/icons et j'y trouve la ligne : { "device": [ { "id": 300, "deviceType": "com.fibaro.binarySwitch", "iconSetName": "ButtonSwitchV2", "fileExtension": "svg" }, ... { "id": 92, "deviceType": "com.fibaro.ipCamera", "iconSetName": "kamera", "fileExtension": "png" }, ... ] } Je confirme que l'UI affiche l'icône BOX_IP/assets/icon/fibaro/kamera/kamera.png ! Mais comment récupérer le iconSetName et le fileExtension de l'id 92 ? via api.get("/icons") on ne peut pas. Il y a un autre appel api.get() qui existe ? Je ne trouve rien dans le swagger. Help !!!
jojo Posté(e) il y a 7 heures Signaler Posté(e) il y a 7 heures quelle est la résultat de api.get("/icons") ?
fel-x Posté(e) il y a 7 heures Auteur Signaler Posté(e) il y a 7 heures (modifié) Voici le dump complet de api.get("/icons") (je le mets un peu en page sinon tout est sur une seule ligne) Attention il est long mais c'est @jojo qui a demandé [19.04.2026] [19:19:07] [DEBUG] [API-GET-ICONS]: [ { "source": "HC", "iconSet": 368, "type": "com.fibaro.FGGC001", "files": [ { "path": "/assets/icon/fibaro/com.fibaro.FGGC001/com.fibaro.FGGC001.svg", "type": "event", "condition": { "type": "event", "data": { "eventType": "CentralSceneEvent", "data": { "keyId": 0 } } } }, { "path": "/assets/icon/fibaro/com.fibaro.FGGC001/com.fibaro.FGGC001.svg", "type": "event", "condition": { "type": "event", "data": { "eventType": "CentralSceneEvent", "data": { "keyId": 1 } } } }, { "path": "/assets/icon/fibaro/com.fibaro.FGGC001/com.fibaro.FGGC001.svg", "type": "event", "condition": { "type": "event", "data": { "eventType": "CentralSceneEvent", "data": { "keyId": 2 } } } }, { "path": "/assets/icon/fibaro/com.fibaro.FGGC001/com.fibaro.FGGC001.svg", "type": "event", "condition": { "type": "event", "data": { "eventType": "CentralSceneEvent", "data": { "keyId": 3 } } } }, { "path": "/assets/icon/fibaro/com.fibaro.FGGC001/com.fibaro.FGGC001.svg", "type": "event", "condition": { "type": "event", "data": { "eventType": "CentralSceneEvent", "data": { "keyId": 4 } } } }, { "path": "/assets/icon/fibaro/com.fibaro.FGGC001/com.fibaro.FGGC001.svg", "type": "event", "condition": { "type": "event", "data": { "eventType": "CentralSceneEvent", "data": { "keyId": 5 } } } }, { "path": "/assets/icon/fibaro/com.fibaro.FGGC001/com.fibaro.FGGC001.svg", "type": "event", "condition": { "type": "event", "data": { "eventType": "CentralSceneEvent", "data": { "keyId": 6 } } } }, { "path": "/assets/icon/fibaro/com.fibaro.FGGC001/com.fibaro.FGGC001.svg", "type": "event", "condition": { "type": "event", "data": { "eventType": "CentralSceneEvent", "data": { "keyId": 7 } } } }, { "path": "/assets/icon/fibaro/com.fibaro.FGGC001/com.fibaro.FGGC001.svg", "type": "event", "condition": { "type": "event", "data": { "eventType": "CentralSceneEvent", "data": { "keyId": 8 } } } }, { "path": "/assets/icon/fibaro/com.fibaro.FGGC001/com.fibaro.FGGC001.svg", "type": "event", "condition": { "type": "event", "data": { "eventType": "CentralSceneEvent", "data": { "keyId": 9 } } } }, { "path": "/assets/icon/fibaro/com.fibaro.FGGC001/com.fibaro.FGGC001.svg", "type": "event", "condition": { "type": "event", "data": { "eventType": "CentralSceneEvent", "data": { "keyId": 10 } } } }, { "path": "/assets/icon/fibaro/com.fibaro.FGGC001/com.fibaro.FGGC001.svg", "type": "event", "condition": { "type": "event", "data": { "eventType": "CentralSceneEvent", "data": { "keyId": 11 } } } }, { "path": "/assets/icon/fibaro/com.fibaro.FGGC001/com.fibaro.FGGC001.svg", "type": "event", "condition": { "type": "event", "data": { "eventType": "CentralSceneEvent", "data": { "keyId": 12 } } } } ] } ] Modifié il y a 7 heures par fel-x
jojo Posté(e) il y a 4 heures Signaler Posté(e) il y a 4 heures ok, sauf que je ne vois aucune correspondance avec tes autres dump ???
Messages recommandés