Skip to content
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

[Feature Request]: Allow devices to be addressed by name, not just IP address #312

Open
puterboy opened this issue May 24, 2022 · 15 comments
Labels
enhancement New feature or request

Comments

@puterboy
Copy link

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?

@puterboy puterboy added the enhancement New feature or request label May 24, 2022
@jneilliii
Copy link
Owner

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

@puterboy
Copy link
Author

But the GUI seems to only accept numerical IP addresses -- anything else shows up as 'red' print...

@jneilliii
Copy link
Owner

Does it prevent you from saving?

@puterboy
Copy link
Author

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?

@jneilliii
Copy link
Owner

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.

@puterboy
Copy link
Author

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 '@'

@b-morgan
Copy link

b-morgan commented Jul 16, 2022

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.

@jneilliii
Copy link
Owner

@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.

@puterboy
Copy link
Author

puterboy commented Jul 17, 2022 via email

@b-morgan
Copy link

b-morgan commented Jul 17, 2022

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.

@b-morgan
Copy link

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.

@jneilliii
Copy link
Owner

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.

@b-morgan
Copy link

How about adding a text "note" field to each entry. You don't have to do anything with it.

@jneilliii
Copy link
Owner

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.

@rushl
Copy link

rushl commented Nov 9, 2023

What about referring to a plug by an ID set by the user? That avoids all lookup issues. Referring to plugs is SUPER useful, but going by IP is fragile. If I have to change an IP, I have to remember everywhere I referred to that plug to update it. But if I could give the plug an ID like "enclosure_lights" and just refer to that, I can update the plug's IP in the plug config, and everywhere the plug is referenced will continue to function.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

4 participants