1.1.2 : Prise en compte de la Freebox Mini 4K

Correction pour la prise en compte de la Freebox Mini 4K qui n'a pas de disque dur interne.
On conserve tout de même la gestion des disques externes.

Merci à Cedonix pour son analyse qui a permis la correction.
https://easydomoticz.com/forum/viewtopic.php?f=10&t=6222&p=60368#p60339
This commit is contained in:
supermat
2018-10-31 13:46:59 +01:00
committed by GitHub
parent d3fea22a0d
commit 40a8fbbc1c
3 changed files with 13 additions and 10 deletions

View File

@@ -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: