DouweM / xbar-whos-home-unifi

XBar plugin that shows all smartphones on a UniFi network in your macOS menu bar.
Apache License 2.0
10 stars 0 forks source link

How to install dependencies for xbar plugins? #1

Open daltonch opened 1 year ago

daltonch commented 1 year ago

Using Terminal I installed your 2 dependencies and they say they installed successfully, however when launching xbar I get an error on the plugin,

ModuleNotFoundError: No module named 'aiohttp'

Any idea where xbar is looking for python modules so I can make sure they are installed in the right location?

M1 Max 13.0.1

DouweM commented 1 year ago

Any idea where xbar is looking for python modules

@daltonch XBar directly runs the executable without setting up a shell (which means PATH updates in .zshrc etc are ignored), which means the hashbang of /usr/bin/env python3 resolves to the system Python: /usr/bin/python3.

I think /usr/bin/pip3 install pyunifi aiohttp should do the trick. If you can confirm it does, I'll update the README!

If you'd rather use a different Python or a virtualenv, you can update the hashbang in the executable.

DouweM commented 1 year ago

@daltonch Hey Chad, did you have a chance to try this out?

daltonch commented 1 year ago

Sorry, just getting back to this. Yes! That did work. I use fish shell so I ran zsh first then ran your command and now the plugin loads! Thank you! However, I get a 401 when trying to connect to my CloudKey, here's the config when I 'run in terminal'

VAR_MENU_BAR_EVENTS="false" VAR_NOTIFY_DISCONNECT="true" VAR_CLOUDIMAGE_TOKEN="" VAR_CONTROLLER_HOST="192.168.1.39" VAR_CONTROLLER_USERNAME="ubnt" VAR_CONTROLLER_PORT="443" VAR_NOTIFY_CONNECT="true" VAR_NOTIFY_ROAM="false" VAR_TERMINAL_NOTIFIER_PATH="" VAR_AVATARS="" VAR_CONTROLLER_PASSWORD="mypassword" VAR_CONTROLLER_VERSION="unifiOS" VAR_CONTROLLER_SSL_VERIFY="false" VAR_SHOW_TEST_DEVICES="false" VAR_ACCESS_POINT_ALIASES="" '/Users/daltonch/Library/Application Support/xbar/plugins/whos-home-unifi.1m.py' daltonch@MacBook-Max ~ % VAR_MENU_BAR_EVENTS="false" VAR_NOTIFY_DISCONNECT="true" VAR_CLOUDIMAGE_TOKEN="" VAR_CONTROLLER_HOST="192.168.1.39" VAR_CONTROLLER_USERNAME="ubnt" VAR_CONTROLLER_PORT="443" VAR_NOTIFY_CONNECT="true" VAR_NOTIFY_ROAM="false" VAR_TERMINAL_NOTIFIER_PATH="" VAR_AVATARS="" VAR_CONTROLLER_PASSWORD="" VAR_CONTROLLER_VERSION="unifiOS" VAR_CONTROLLER_SSL_VERIFY="false" VAR_SHOW_TEST_DEVICES="false" VAR_ACCESS_POINT_ALIASES="" '/Users/daltonch/Library/Application Support/xbar/plugins/whos-home-unifi.1m.py'

I know the passwords right as I can login to the Cloud Key G2 with the username and password. UnifiOS: UCK G2 Plus v3.0.13

Any other logs I can check? Thanks

DouweM commented 1 year ago

@daltonch Can you try setting VAR_CONTROLLER_VERSION to UDMP-unifiOS? I had to use that on my non-Pro UDM to make it work, even though that suggests it's just for the UDMP.

daltonch commented 1 year ago

BOOM! That worked. Thanks!

DouweM commented 1 year ago

Reopening since I want to document this