multiple domains with the same username not possible
First of all - I love this integration and I waited a long time for this.
But - I think it has a big caveat coming with it. If you add a second (or any multiple) instance of "NPM Switches" with the same username (mail-address) in homeassistant, the latter instance would not be added - and no error is shown.
I guess this is because of entries using the email address as an index. (?) But unfortunately I could not find a log-entry about that failure.
My suggestion - if confirmed - would be to at least show a message why it's failing. EDIT: .. and of course it would be great, if indexing the url (or some generalized combination of both) could solve that issue.
Using the same mail-address for multiple urls can be convenient in many ways I guess. For instance to maintain multiple hosts within the same or other (sub-)domains using the same mail.
A possible workaround could be to make an alias of that email-address and adding that email as a second user in NPM. (using aliases for different domains would be cleaner in general - I know) But as I cannot do that in a specific case, I have no possible way of monitoring or switching a second NPM-instance in HA.
Thanks for reading. o/
Huh, I never considered that people might have more than one instance of Nginx Proxy Manager running. I guess that makes sense though.
I'll have to take a look, I don't work on HA integrations often enough to keep it fresh. It will take a while (also don't mind reviewing PRs). I'm thinking just url would be enough to allow for different instances of NPM, because it includes a port number.
Totally comprehensible. Thanks for your time and understanding. I never made a PR tbh but maybe I'll have a try.
EDIT: okay, guess I'll give it up to you :D not as easy as I thought.. (not only fixing the problem but understanding the right way to do the changes on Github.. fp)
I just tested the changed code by forking it and it seems to be working now - which suprised me..
Not yet perfect, as the "enabled_ & disabled_proxy_hosts"-sensors get duplicate entries and thus a postfix of "_2" after the entity_ids, but I guess that could be solved by also changing their naming scheme based on the url..
For now I will use my forked repo for further testing, but looks promising for me. :) I will create a PR this week if I have the time..
Version 2.0.0 fixes this. The URL was added to the entity IDs to differentiate between NPM servers. The NPM server url is also the key for finding duplicate entries.