tomaae / homeassistant-openmediavault

OpenMediaVault integration for Home Assistant
Apache License 2.0
109 stars 15 forks source link

Change the way the Disk sensors are created in HA [Feature] #142

Open thanomichalis opened 10 months ago

thanomichalis commented 10 months ago

Is your feature request related to a problem? Please describe.

Everytime the OMV is restarting, the drive letters are changing for each ssd disk. So if disk with serial X has a letter sda and disk with serial Y has sdb, in the next restart, the X is assigned the sdb and the Y assigned the sda. The integration however, is taking into consideration the sda and sdb to identify and keep the records from s.m.a.r.t. for each disk. Therefore, the history and the statistics data kept in HA, are mixing the two disks.

Describe the solution you'd like

We need to change the way HA identify and create the sensor to look not the letter that OMV assigns to the disks, but the their serial number which is unique.

tomaae commented 10 months ago

serial number is a no-go. some controllers or usb dont provide serial. same for mc which dont have serial at all. it has to be something that is unique and is always provided.

thanomichalis commented 10 months ago

@tomaae i see. However it is an issue, cause it is not only the history and statistics, but also the fact that in HA any automation regarding the disks, cannot be reliable since the sensors, are becoming unavailable or they have the wrong data. We may use the UUID though.

tomaae commented 10 months ago

yes, I was thinking of UUID too, but it needs confirming and testing that UUID stays the same while dev changes.

thanomichalis commented 10 months ago

@tomaae I am not a programmer nor familiar with what exactly should i do, but if you give me some script to add it in my HA installation on rpi4, i might be able to run some tests.

SamJongenelen commented 10 months ago

I can confirm my UUID stays the same, as I use OMV and docker, and all my Docker Volumes use the /dev/disk-by-UUID path, hardcoded by me. Unless I don't understand correctly what you @tomaae meant by 'while dev changes' I think its a good idea to use UUID.

Henkow commented 5 months ago

It for sure stays the same. I also would like UUID instead. The current implementation doesn't make it possible to rename the drives to what they actually are. I for instance can't name the OS drive as SSD since it may go from sda to sdd upon reboot.

Speaking of this, the same issue is the case with containers running. Would be nice if "OMV Compose" could be removed from the name so it only display what service is running, would make it more clean as "OMV Compose" takes up so much space. Can't really hardcode any since the container running a given service may go from omv_compose_5 to omv_compose_3 upon reboot.