Closed danielo515 closed 11 months ago
My relevant config:
# Pi-hole Configuration
# ----------------------
PIHOLE_ACTIVE = False
PIHOLE_DB = '/media/pihole_share/pihole-FTL.db'
DHCP_ACTIVE = False
DHCP_LEASES = ''
# UniFi Configuration
# -------------------
UNIFI_ACTIVE = False
UNIFI_IP = '192.168.0.7:8443'
UNIFI_USER = '******'
UNIFI_PASS = '*****'
Commenting the relevant values makes it work again. It seems you are only checking the existence of the values, and not the active flag
Since I don't have a Unifi system myself and the integration came into the project through a pull request, I can only help in a limited way right now. However, one thing stands out to me.
Does the error disappear if you make the following change in line 758 of the file "pialert/back/pialert.py"?
Change from pyunifi.controller import Controller
to
from unifi.controller import Controller
After you have changed this, it is also necessary to remove the port specification from the config.
UNIFI_IP = '192.168.0.7'
The module already uses port 8443 internally
Upon further analysis, I have now found that there is a mismatch between the installed python unifi library and the function used in the script. I will install pyunifi instead of the python3 lib unifi with the next update. Unfortunately, however, I still can not test the functionality.
Update Released
Hey guys,
Just putting in my 2 cents on this for how I've gotten this working as I've got a UDMP (dream machine pro), and this is how I've installed:
UDMP-unifiOS
instead of v5
in https://github.com/leiweibau/Pi.Alert/blob/main/back/pialert.py#L752(Looking at https://github.com/finish06/pyunifi#__init__self-host-username-password there are a few options depending on your unifi OS: the base version of the controller API [v4|v5|unifiOS|UDMP-unifiOS]
)
Config (multiple VLANs):
# Arp-scan Options & Samples
# ----------------------
ARPSCAN_ACTIVE = True
SCAN_SUBNETS = [ '192.168.0.0/24 --interface=eth0', '192.168.20.0/24 --interface=eth0', '192.168.30.0/24 --interface=eth0', '192.168.40.0/24 --interface=eth0', '192.168.50.0/24 --interface=eth0' ]
# MAC_IGNORE_LIST = ['11:22:33:aa:bb:cc']
# SCAN_SUBNETS = '--localnet'
# SCAN_SUBNETS = '--localnet --interface=eth0'
# SCAN_SUBNETS = [ '192.168.1.0/24 --interface=eth0', '192.168.2.0/24 --interface=eth1' ]
# UniFi Configuration
# -------------------
UNIFI_ACTIVE = True
UNIFI_IP = '192.168.0.200'
UNIFI_USER = 'user'
UNIFI_PASS = 'password'
Results:
Scanning...
arp-scan Method...
arp-scan: Multiple interfaces
Pi-hole Method...
DHCP Leases Method...
Fritzbox Method...
Mikrotik Method...
UniFi Method...
/usr/lib/python3/dist-packages/urllib3/connectionpool.py:1048: InsecureRequestWarning: Unverified HTTPS request is being made to host '192.168.0.200'. Adding certificate verification is strongly advised. See: https://urllib3.readthedocs.io/en/1.26.x/advanced-usage.html#ssl-warnings
warnings.warn(
Processing scan results...
Processing ignore list...
No ignore list defined
Devices Detected.......: 26
arp-scan Method....: 8
Pi-hole Method.....: +0
Fritzbox Method....: +0
Mikrotik Method....: +0
UniFi Method.......: +17
New Devices........: 0
Devices in this cycle..: 26
Down Alerts........: 0
New Down Alerts....: 0
New Connections....: 0
Disconnections.....: 0
IP Changes.........: 0
Updating DB Info...
Sessions Events (connect / discconnect) ...
Creating new devices...
Updating Devices Info...
Trying to resolve devices without name...
Names updated: 0
Voiding false (ghost) disconnections...
Pairing session events (connection / disconnection) ...
Creating sessions snapshot...
Skipping repeated notifications...
Calculate Activity History...
Reporting...
Formating report...
No changes to report...
Notifications: 0
DONE!!!
Awesome. I add this as an option to the config file as well. And I will also try to fix that warning
I will also try to fix that warning
The warning at most, could be silenced.
It's unfortunately a "feature" as the SSL cert that is originally setup with things like the UDMP is self signed out the box, so there's very little one can do unless they deploy their own proper certificate with an authority/domain, which is obviously outside the scope of this project, and down to the user to implement if they so wish.
But it should be possible to suppress this warning. Such a log file should also somehow look a bit pretty 😉
Can confirm that the new method works as expected, no issues found so far.
Thank you for your help
Hello again. I had setup some test configs in my instance, then I decided that I didn't wanted them because they were failing, so I disabled them again. However, when I run a scan I see the same errors happening. For example, I first enabled the pihole integration, tried a scan and it failed with a file not found (the DB was not there). No matter how many times I tried disabling it, I was getting the same error. Even after rebooting.
I then added the pihole file, just to check if that was the problem, and indeed the issue was gone, now I'm getting the following error:
It does not matter if I disable the unify method, this problem keeps happening. How can I fix this? Do I need to remove the complet configuration?