-
-
Notifications
You must be signed in to change notification settings - Fork 20
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix inconsistent HDD mapping #131
Conversation
Keeps consentient disk identifiers through reboots. Uses a combination of serial and LUN ID. Should always be populated and unique.
hmm, current format is "sensor.disks" if we use lun, it should be "sensor.disks" I will test it on my live core later, right now I'm replacing several disks and extending my nas, so it could mess up with testing as I shuffle disks around. |
Perhaps this is a difference between core and scale? I am running and testing on scale.
I changed this to get identifier as the entity_id in HA.
This is also what is returned by the temps API as an identifier. See response to /disk/temperatures api request below. So this is why the temp update code now uses the vals["name"] attribute to assign the correct temp. I would have assumed in core this would be the freeBSD ad0, ad1 etc. For reference here is a /disk api return in scale where name is derived from devname. |
ok, I will have to look more in detail on how new scale display information. |
Happy for you to change anything/everything to be more sensible. I did initially start using zfs_guid but that is not set unless the drive is in a pool and will return null. output example for /disk without zfs_guid: Thanks for looking into it and thanks again for the integration! My aircon now turns on when my drives get too hot 👍. |
ah yea, when drive is not formatted for zfs, it would not work zfs guid. |
Proposed change
Addresses bug #77
As discussed in the bug, how to name drives is a bit arbitrary but the API returns identifier that is a combination of the drives serial number and the LUN ID. As far as I know this should never be blank even for drives that wont return a serial string.
Drive entity ID will no longer be in the form sensor.devname, example: "sensor.sda".
New format is sensor.serial_lunid_SERIAL_LUNID, example: sensor.serial_lunid_WD123XYZ_5000c500c38428e
Drives can easily be renamed to more sensible things as desired by the user.
Type of change
Additional information
Only tested with TrueNAS Scale. Would be great if someone could check it on Core.
Checklist