Skip to content

Commit

Permalink
Fix HASS issue with Disk Errors on unmount
Browse files Browse the repository at this point in the history
  • Loading branch information
bkbilly committed Sep 12, 2023
1 parent 871d0e8 commit 6714a6a
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions lnxlink/modules/disk_usage.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ def exposed_controls(self):
"icon": "mdi:harddisk",
"unit": "%",
"state_class": "measurement",
"value_template": f"{{{{ value_json.{device}.percent }}}}",
"attributes_template": f"{{{{ value_json.{device} | tojson }}}}",
"value_template": f"{{{{ value_json.get('{device}', {{}}).get('percent') }}}}",
"attributes_template": f"{{{{ value_json.get('{device}', {{}}) | tojson }}}}",
"enabled": True,
}
return discovery_info
Expand All @@ -35,6 +35,7 @@ def get_info(self):
for disk_name in unmounted:
disks[disk_name] = self.disks[disk_name]
self.disks[disk_name]['connected'] = False
self.disks[disk_name]['percent'] = None
self.disks = disks
for disk_name in mounted:
self.lnxlink.setup_discovery()
Expand Down

0 comments on commit 6714a6a

Please sign in to comment.