OctoPrint-TPLinkSmartplug
OctoPrint-TPLinkSmartplug copied to clipboard
[Feature Request]: Allow devices to be addressed by name, not just IP address
I have given all my plugs "names" in my router - so that I can address them by name which is helpful if the IP address changes. Any reason why this can't be enabled and allowed here?
in theory if the name is resolvable by the pi the plugin is running on it should work. I have the setting to try and figure out the ip from hostname here
But the GUI seems to only accept numerical IP addresses -- anything else shows up as 'red' print...
Does it prevent you from saving?
I hadn't tried because it was marked in 'red' and I thought it was an error. However, it does work nonetheless when I save it. Perhaps update the plugin to allow for valid hostnames?
Yeah, I could remove the red highlighting from the field to counter that confusion and update the label. There is no good way to validate hostnames, so will depend on the status check to throw that error.
Typically, it's up to the user to use a valid hostname. You could do some simple syntactic checks to make sure the hostname is consistent with the relevant RFC (maybe RFC 1035) -- e.g, no '@'
I would like to see this implemented as well. In addition, a notes field would be useful. I was going to ask about using the MAC address (which I'd put in the notes if it wasn't entered somewhere else. The reason I ask is because my cable modem/router died and I had to replace it. All of the DHCP obtained IP addresses changed because the new modem/router uses a different net block (used to be 192.168.0.0/24, is now 10.0.0.0/24). If I had a place to record the MAC address, I can look at the DHCP server to find the new IP address.
@b-morgan I see you found the other FR about MAC Address addressing, but you can use hostname in the ip field even though it highlights it as red, di you happen to try that? I haven't heard back from anyone else if it works as expected.
Yes it works (despite the red). Sorry for not confirming earlier with you. jneilliii wrote at about 00:09:37 -0700 on Sunday, July 17, 2022:
@b-morgan I see you found the other FR about MAC Address addressing, but you can use hostname in the ip field even though it highlights it as red, di you happen to try that? I haven't heard back from anyone else if it works as expected.
-- Reply to this email directly or view it on GitHub: https://github.com/jneilliii/OctoPrint-TPLinkSmartplug/issues/312#issuecomment-1186425560 You are receiving this because you authored the thread.
Message ID: @.***>
Unless I can figure out how to name the plugs, each plug's name is the model name of the plug, i.e. HS105, HS103, and HS300 so while I tried the name, it didn't work.
BTW, I'm happy to collect any debugging information you need.
I did some research and changing the hostname of a plug doesn't appear to be possible. Issue #76 appears to be the best option. Alternatively, adding a "note" field to each entry would allow documenting the MAC address which could then be used to obtain the IP address manually.
Thanks @b-morgan, obviously for those that only have one plug they can use hostname. Unfortunately, I never really found a good MAC to IP address translation option for python that wasn't a full network scanning/hacking tool which is why the option hasn't been implemented.
How about adding a text "note" field to each entry. You don't have to do anything with it.
Yes, I can definitely do that which is one reason I was leaving this issue open (that and red highlighting/label for IP). I was just looking at the original source of the encryption/decryption I used for this from softScheck and there is a PR that implements a broadcast option. I could probably implement something like that to create a discovery of devices and create a lookup table based on the "info" command to all plugs in the network. Would probably take me a while to program that and test though. I think the wemo library I use for that plugin incorporates a similar approach for device discovery.