-
Notifications
You must be signed in to change notification settings - Fork 10
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
Add external USB storage devices #251
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @lezmaka
many thanks for bringing this is 🤝
I've left some comments, but at all I think we should also have a class for the external USB device itself and put all properties to this.
I'm not sure if I understand, so just want to ask. Are you wanting it to be similar to download station? For example, the SynoCoreExternalUSB I created would only have update, get_devices, device_ids, and get_device. And sorry to ask but since I'm new, I make these changes in the branch I made, yes? Then when I push changes to GitHub, does the PR get updated automatically? Thanks for being patient with me :) |
exactly 👍 |
Thanks! I had a couple more questions. When making changes requested for a PR, should I avoid making other changes that don't relate to the comments from the reviewer or haven't been discussed?
Also, should Python property names match the data the API returns? The API property name for the manufacturer of the device is called "producer" but I might want to call the Python property "manufacturer" or "device_manufacurer". |
Adding changes/commits related to the review comments is absolutely OK. There is not rule, that the property name should be equal to the API data, but the API is not used to be visible to the user, therefore using more common terms is ok and i would prefer manufacturer over producer, too 😉 |
I think what's causing me to second-guess everything is Python seems foreign to me - and so simple things like what should be a property and what should be a function aren't clear. Most of my experience is with C# in Windows and ASP.NET. For the function/property question, should I try to imagine what I might do in C#? |
Hi @lezmaka |
Thanks for the update. I understand that not everything can be done immediately or multiple things at once. Plus I'm guessing since I'm new to all of this that my PR might need more work than others :) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @lezmaka
I did not do a functional test right now, but already had a look into the code itself and left some comments.
Thanks for taking a look! I'll go through your comments and make some changes. I definitely understand waiting to test until you're pretty sure everything looks good. I'm at the point with Python where I can get things to "work" and I can use it, but that doesn't mean it isn't fragile or works in a way that makes sense to others. I still have the USB drives connected to my NAS so if there's something you would like me to test, let me know and I'll see what I can do. |
Hi @mib1185 |
at least the corresponding changes should be pushed to Github. It is also possible, that a comment ends up in a discussion, which could resolve the comment.
If you own an usb printer, it would also be great to test, if this does not interfere this new feature. Further it would be great to have some negative tests, like nothing is connected to usb or it is connected, but already released in DSM or a usb stick without any partition Thanks for your efforts and no worries about something could be done in a wrong way, there are always multiple ways do achieve something;) |
I pushed some changes, though I wasn't able to figure everything out.
I do have a usb printer. I connected it, made sure DSM saw it, and it didn't have any effect on the data returned by the API. When a device is plugged in to the NAS but released in DSM, it isn't returned at all. If nothing is connected, the API returns an empty array. I added the response when nothing is connected to const_7_core_external_usb.py but I couldn't figure out how to get a second test for the same API key. I'm sure there are some things I missed, couldn't figure out, or made a wrong change. Let me know what else needs to be changed. |
Hi @lezmaka many thanks for the detailed test with a usb printer 👍 and especial for the efforts spent to this PR and bring this feature in 🤝 Overall from my point of view, this PR is ready to be merged. If you have anything else to add here, than now 😁 |
I forgot to change the example usage in the readme, just pushed an update with changes for that. Other than that, I agree that it's ready. And thank you for handling the type annotations, not sure how long it would have taken me to figure that out. 🙂 I appreciate your patience guiding me through the whole process! |
This gets information about external USB storage devices connected to the NAS. My hope is that this will allow Home Asistant to show USB storage device status.