richibrics / IoTuring

Your Windows, Linux, macOS computer as MQTT and HomeAssistant integration
https://pypi.org/project/IoTuring/
GNU General Public License v3.0
70 stars 6 forks source link

Disk configurable, enter path with a little helper in config #82

Closed lockenkop closed 10 months ago

lockenkop commented 10 months ago

64

I made the path that this Entity reads configurable.

image image

I don't know how psutil.disk_partitions() and psutil.disk_usage() behaves in macos. Might get a macos VM going.

richibrics commented 10 months ago

Great, I wanted to add this for a long time !

richibrics commented 10 months ago

Example from BigSur:

Python 3.11.3 (v3.11.3:f3909b8bc8, Apr  4 2023, 20:12:10) [Clang 13.0.0 (clang-1300.0.29.30)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import psutil
>>> psutil.disk_partitions() 
[sdiskpart(device='/dev/disk1s5s1', mountpoint='/', fstype='apfs', opts='ro,local,rootfs,dovolfs,journaled,multilabel', maxfile=255, maxpath=1024), sdiskpart(device='/dev/disk1s4', mountpoint='/System/Volumes/VM', fstype='apfs', opts='rw,noexec,local,dovolfs,dontbrowse,journaled,multilabel,noatime', maxfile=255, maxpath=1024), sdiskpart(device='/dev/disk1s2', mountpoint='/System/Volumes/Preboot', fstype='apfs', opts='rw,local,dovolfs,dontbrowse,journaled,multilabel', maxfile=255, maxpath=1024), sdiskpart(device='/dev/disk1s6', mountpoint='/System/Volumes/Update', fstype='apfs', opts='rw,local,dovolfs,dontbrowse,journaled,multilabel', maxfile=255, maxpath=1024), sdiskpart(device='/dev/disk1s1', mountpoint='/System/Volumes/Data', fstype='apfs', opts='rw,local,dovolfs,dontbrowse,journaled,multilabel', maxfile=255, maxpath=1024), sdiskpart(device='/dev/disk0s4', mountpoint='/Volumes/Untitled', fstype='ntfs', opts='ro,local,ignore-ownership,multilabel', maxfile=255, maxpath=1024)]
>>> psutil.disk_usage("/")
sdiskusage(total=274999996416, used=15322058752, free=27211255808, percent=36.0)
lockenkop commented 10 months ago

Looks good to me.

richibrics commented 10 months ago

Good. Do you plan adding also Windows support ?

lockenkop commented 10 months ago

I just got my Windows dev VM up and running. windows support for psutil.disk_* looks good. I'll cook something up.

lockenkop commented 10 months ago

Got Windows working. image This

Add value for "which Drive shall be checked

is ugly af, that has to change image

Had to do some reorganisation to make the config os agnostic.

Next Todo is handling wrong user input, at the time the config just crashes

richibrics commented 10 months ago

Thank you for your work @lockenkop ! Contributions are always appreciated 🤝