diff --git a/README.md b/README.md index 2d93348..63aedb8 100644 --- a/README.md +++ b/README.md @@ -65,4 +65,5 @@ Note : Un fichier ```devicemapping.json``` est créé pour garder l'association | ----- | ---------- | | 1.0 | Version initial : connexion (token), températures système, espace disque, présence | | 1.1 | Ajout des switch WIFI et Reboot. Ajout d'une pause au démarrage du plugin pour corriger certains pb | -| 1.1.1 | PRise en compte de l'adresse MAC en Majuscule ou minuscule pour la présence | +| 1.1.1 | Prise en compte de l'adresse MAC en Majuscule ou minuscule pour la présence | +| 1.1.2 | Prise en compte de la Freebox mini 4K (qui n'a pas de disque interne) en conservant l'usage des disque externes | diff --git a/freebox.py b/freebox.py index 4893e7e..41bb59e 100644 --- a/freebox.py +++ b/freebox.py @@ -106,14 +106,16 @@ class FbxApp(FbxCnx): retour = {} try: listDisk = self.com( "storage/disk/") - for disk in listDisk["result"]: - for partition in disk["partitions"]: - label = partition["label"] - used =partition["used_bytes"] - total=partition["total_bytes"] - percent = used/total*100 - # print(str(label)+"=>"+str(round(percent,2))+"%") - retour.update({str(label):str(round(percent,2))}) + if ("result" in listDisk): #Pour la box mini 4K qui n'a pas de disk + for disk in listDisk["result"]: + if ("partitions" in disk): #Pour la box mini 4K qui n'a pas de disk + for partition in disk["partitions"]: + label = partition["label"] + used =partition["used_bytes"] + total=partition["total_bytes"] + percent = used/total*100 + # print(str(label)+"=>"+str(round(percent,2))+"%") + retour.update({str(label):str(round(percent,2))}) except (urllib.error.HTTPError, urllib.error.URLError) as error: Domoticz.Log('La Freebox semble indisponible : '+ error.msg) except timeout: diff --git a/plugin.py b/plugin.py index e858afc..44e2bc8 100644 --- a/plugin.py +++ b/plugin.py @@ -4,7 +4,7 @@ # https://matdomotique.wordpress.com/2018/03/25/plugin-freebox-pour-domoticz/ # """ - +