FlyingDiver / Indigo-miniUniFi

Minimalistic UniFi plugin for Indigo
MIT License
0 stars 0 forks source link

Controller setup error #1

Closed jstewart99 closed 3 years ago

jstewart99 commented 3 years ago

Set up my controller (which runs on the same computer as Indigo) as a new device. Says "Login OK" for the device status, but getting the following error in the Log. Can't create an wireless client devices at this point...the Controller popup just says "new device" (rather than the name I gave my controller device) and the Site and Device popups are blank.

miniUniFi Error Error in plugin execution runConcurrentThread:

Traceback (most recent call last): File "plugin.py", line 84, in runConcurrentThread File "plugin.py", line 253, in updateUniFiController UnicodeEncodeError: 'ascii' codec can't encode character u'\u201d' in position 7: ordinal not in range(128)

miniUniFi Error plugin runConcurrentThread function returned or failed (will attempt again in 10 seconds)

FlyingDiver commented 3 years ago

Ack, my bad. You must have a unicode character in a device name.

Also, I don't automatically set the Indigo device name from the UniFi device. You need to do that manually.

Can you turn on debug level logging and restart the plugin? Then post the log.

FlyingDiver commented 3 years ago

Nevermind the log change for now. Just try https://github.com/FlyingDiver/Indigo-miniUniFi/releases/tag/0.0.2 If you get more errors, then post the debug level log. (Not detailed debug level).

jstewart99 commented 3 years ago

Ok 0.0.2 fixed that issue, no errors and was able to set up a Wifi client and did a basic test to alert me to wifi connect and disconnect, all of which worked great. I set up a Virtual Device group and that also seems to be functioning correctly.

I noticed the Log keeps calling it "new device 1" rather than what I named it to, though (says "new device 1: starting device" when the device is created I think).

Obviously you'll want to add a way to specify a Client that's not currently connected, either via MAC address or IP address.

Questionable whether the Controller itself needs to be its own device, or just configured in the Plug-in settings (I would suggest moving that to the Settings rather than how you're doing it presently).

Mildly tedious having to choose the Controller and Site every time I add a new device (is there a way to have them default to a value if there's only 1 of each?).

As discussed I would build in a user-specified delay before considering a client "actually" disconnected. Not sure why you'd want to delay a connection trigger (disconnection, yes, but connection?), but I suppose no harm in adding that option.

Let me know if you want me to test anything specific. On first run-through, though, this seems like exactly what I've been wanting.

FlyingDiver commented 3 years ago

I have a policy - I don't use the Plugin config if there's any possibility a plugin will be used for multiple sites/controllers. If you were using a cloud controller, you could use one Indigo server to do presence detection at multiple locations served by multiple controllers. ;)

Not sure what the deal is with the device name. I'm not having that problem. Try deleting the device and creating it again.

Right now I'm only showing the list of "active" clients. I can also get a list of "known clients". I don't want to resort to IP address (which is indeterminate for most wifi devices) or MAC address, which is hard for most users to get or enter.

Yeah, I can probably default the Controller or site to the only one or "last used" if there's more than one.

The delay adds considerable complexity to the plugin. Right now, it reports off-line as soon as the controller data indicates that. Adding a delay means keeping a time-stamped list, etc, etc. That won't be in the first release. You could do the same thing with Indigo triggers and timers, if it really doesn't work for you.

jstewart99 commented 3 years ago

Understandable that if you have multiple controllers it would be problematic to configure that in the Config section. That said, I assume 98% of users are "single controller" users, but aside from creating an otherwise useless Device to tuck away somewhere, your existing method is fine.

"new device 1: Starting device" log entry happens whenever I create a new wireless client. I choose the client in the popup and then it stamps that log entry before I've had a chance to give it a proper name. After I set the name and close the window, nothing gets logged. I assume this will resolve if you delay the log entry until the newly-created Device window is closed, or if it set the name of the device immediately upon selection in the popup.

"Active clients" works great 95% of the time, obviously the issue is just that if I have a device that isn't currently connected, and I DO have a static IP for it (and/or know the MAC address), being able to manually enter that would be nice. I would do it as an option, though, ideally, if you can (choose from this list or "enter MAC (/IP) manually" at the bottom). If you have to choose between manual entry OR the popup, I'd definitely stick with the popup as you have it presently. I just know when I was creating my presence detection before, one of the devices wasn't home, but I knew the IP address (I static IP my phones) so I was able to to it anyway.

Delay/complexity: I get it, and I see how I could work around it, so I agree not 100% necessary but it would be nice to have that added. I'm sure it's not just as simple as "set to OFF after [user specified] seconds when controller reports disconnected". I don't know about you, but I get some occasional disconnects if I wander too far in my yard, so it would be nice to not have things triggering on or off due to a brief interruption, and it would be nice if the plug-in did that work for me, rather than having to do some hoop-jumping with variables or "triggers triggering or disabling other triggers" or how ever you customarily build in delays. But I agree for an initial release it's not required.

FlyingDiver commented 3 years ago

"new device 1: Starting device" log entry happens whenever I create a new wireless client. I choose the client in the popup and then it stamps that log entry before I've had a chance to give it a proper name. After I set the name and close the window, nothing gets logged. I assume this will resolve if you delay the log entry until the newly-created Device window is closed, or if it set the name of the device immediately upon selection in the popup.

You'll always get the temporary name in the log until you enter a new name and close the dialog box. As long as the Device list is showing the right name, and any subsequent log entries are correct, then there's nothing to fix.

FlyingDiver commented 3 years ago

"Active clients" works great 95% of the time, obviously the issue is just that if I have a device that isn't currently connected, and I DO have a static IP for it (and/or know the MAC address), being able to manually enter that would be nice. I would do it as an option, though, ideally, if you can (choose from this list or "enter MAC (/IP) manually" at the bottom). If you have to choose between manual entry OR the popup, I'd definitely stick with the popup as you have it presently. I just know when I was creating my presence detection before, one of the devices wasn't home, but I knew the IP address (I static IP my phones) so I was able to to it anyway.

Clients are identified by MAC address, not IP address. So knowing the static IP doesn't help, unless you think it's worth digging the MAC address out of your router's DHCP table. Seems like more trouble than it's worth. I opened an issue on this, comment there if you want.

FlyingDiver commented 3 years ago

Understandable that if you have multiple controllers it would be problematic to configure that in the Config section. That said, I assume 98% of users are "single controller" users, but aside from creating an otherwise useless Device to tuck away somewhere, your existing method is fine.

"new device 1: Starting device" log entry happens whenever I create a new wireless client. I choose the client in the popup and then it stamps that log entry before I've had a chance to give it a proper name. After I set the name and close the window, nothing gets logged. I assume this will resolve if you delay the log entry until the newly-created Device window is closed, or if it set the name of the device immediately upon selection in the popup.

"Active clients" works great 95% of the time, obviously the issue is just that if I have a device that isn't currently connected, and I DO have a static IP for it (and/or know the MAC address), being able to manually enter that would be nice. I would do it as an option, though, ideally, if you can (choose from this list or "enter MAC (/IP) manually" at the bottom). If you have to choose between manual entry OR the popup, I'd definitely stick with the popup as you have it presently. I just know when I was creating my presence detection before, one of the devices wasn't home, but I knew the IP address (I static IP my phones) so I was able to to it anyway.

Delay/complexity: I get it, and I see how I could work around it, so I agree not 100% necessary but it would be nice to have that added. I'm sure it's not just as simple as "set to OFF after [user specified] seconds when controller reports disconnected". I don't know about you, but I get some occasional disconnects if I wander too far in my yard, so it would be nice to not have things triggering on or off due to a brief interruption, and it would be nice if the plug-in did that work for me, rather than having to do some hoop-jumping with variables or "triggers triggering or disabling other triggers" or how ever you customarily build in delays. But I agree for an initial release it's not required.

I also opened an issue on this, so comment there for future reference.

FlyingDiver commented 3 years ago

Open new issues as needed.