Skip to content

Commit

Permalink
1.6
Browse files Browse the repository at this point in the history
  • Loading branch information
elueckel committed Aug 25, 2024
1 parent a42b72e commit 1d8fbc8
Show file tree
Hide file tree
Showing 11 changed files with 71 additions and 38 deletions.
Binary file modified .DS_Store
Binary file not shown.
2 changes: 1 addition & 1 deletion UniFi Device Monitor/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -97,5 +97,5 @@ Version 1.3 - 03-01-2022
Version 1.5 - 03-12-2023
* Neu - UI Aufgeräumt

Version 1.51 - 09-06-2024
Version 1.6 - 25-08-2024
* Neu - Anzahl der verbundenen Geräte wird angezeigt
2 changes: 1 addition & 1 deletion UniFi Device Monitor/README_en.md
Original file line number Diff line number Diff line change
Expand Up @@ -79,5 +79,5 @@ Version 1.3 - 03-01-2022
Version 1.5 - 03-12-2023
* New - UI tidied up

Version 1.51 - 09-06-2024
Version 1.6 - 25-08-2024
* New - Number of connected devices are shown
3 changes: 3 additions & 0 deletions UniFi Endpoint Blocker/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -127,3 +127,6 @@ Version 1.3 - 03-01-2022

Version 1.5 - 03-12-2023
* Neu - UI Aufgeräumt

Version 1.6 - 25-08-2024
* Keine Änderungen
5 changes: 4 additions & 1 deletion UniFi Endpoint Blocker/README_en.md
Original file line number Diff line number Diff line change
Expand Up @@ -109,4 +109,7 @@ Version 1.3 - 03-01-2022
* New - Device Blocker is now called Endpoint Blocker

Version 1.5 - 03-12-2023
* New - UI tidied up
* New - UI tidied up

Version 1.6 - 25-08-2024
* No changes
10 changes: 9 additions & 1 deletion UniFi Multi Endpoint Monitor/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -88,4 +88,12 @@ Das Modul gibt diverse Informationen im Debug Bereich aus.
## 5. Versionsinformation

Version 1.5 - 02-12-2023
* Neu - Modul verfügbar
* Neu - Modul verfügbar

Version 1.6 - 25-08-2024 (Credit M70 - Danke)
* Fix - Connection wurde nicht gesetzt
* Fix - Satisfaction wurde nicht aktualisiert
* Fix - IP wurde nicht gesetzt
* Fix - LastSeen wird auf Zeit von Symcon korrigiert
* Fix - Modul zieht jetzt nicht mehr die Werte für WLAN Geräte bei LAN Komponenten
* Change - SetValue durch $this->SetValue ersetzt
13 changes: 12 additions & 1 deletion UniFi Multi Endpoint Monitor/README_en.md
Original file line number Diff line number Diff line change
Expand Up @@ -71,4 +71,15 @@ The module outputs various information in the debug area.

## 5. version information
Version 1.5 - 02-12-2023
* New - Module available
* New - Module available

Version 1.6 - 02-12-2023
* Neu - Modul verfügbar

Version 1.6 - 25-08-2024 (Credit M70 - Danke)
* Fix - Connection was not set
* Fix - Satisfaction was not set
* Fix - IP was not set
* Fix - LastSeen is set to Symcon Server time
* Fix - Module is no longer pulling WLAN data from LAN devices
* Change - SetValue replaced by $this->SetValue ersetzt
2 changes: 1 addition & 1 deletion UniFi Multi Endpoint Monitor/form.json
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,7 @@
{
"type": "Button",
"label": "Get Device Data",
"onClick": "UMEM_EndpointMonitor($id);"
"onClick": "UMEM_MultiEndpointMonitor($id);"
},
{
"type": "Button",
Expand Down
70 changes: 39 additions & 31 deletions UniFi Multi Endpoint Monitor/module.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ public function Create()
$this->RegisterPropertyBoolean("DataPointConnection", 0);
$this->RegisterPropertyBoolean("DataPointTransfer", 0);

$this->RegisterTimer("UniFi Multi Endpoint Monitor", 0, MODUL_PREFIX."_EndpointMonitor(\$_IPS['TARGET']);");
$this->RegisterTimer("UniFi Multi Endpoint Monitor", 0, MODUL_PREFIX."_MultiEndpointMonitor(\$_IPS['TARGET']);");
}

public function Destroy()
Expand Down Expand Up @@ -152,7 +152,7 @@ public function AuthenticateAndGetData(string $UnifiAPI = "")
}
}

public function EndpointMonitor()
public function MultiEndpointMonitor()
{
$ControllerType = $this->ReadPropertyInteger("ControllerType");
$ServerAddress = $this->ReadPropertyString("ServerAddress");
Expand Down Expand Up @@ -196,6 +196,7 @@ public function EndpointMonitor()
$DeviceMac = $this->removeInvalidChars($Device["varDeviceMAC"], true);
$DeviceName = $Device["varDeviceName"];
$ConnectionType = $Device["varDeviceConnectionType"];
$Connected = false;

//Itterate through all device and check if one of them matches the list in the config form.
foreach ($ActiveDevices["data"] as $Index => $DeviceFromController)
Expand All @@ -205,8 +206,10 @@ public function EndpointMonitor()
if ($DeviceMac == $DeviceFromControllerClean)
{
$this->SendDebug($this->Translate("Endpoint Monitor"), $this->Translate("Device with Name was found: ").$DeviceName, 0);

$Connected = true;
$ConnectionMethod = $DeviceFromController["is_wired"];
$this->SendDebug($this->Translate("Endpoint Monitor"), $this->Translate("Setze Wert"), 0);
$this->SetValue($this->GetIDForIdent($DeviceMac."_Connected"), $Connected);

if ($ConnectionMethod == true && $ConnectionType == 0)
{
Expand All @@ -219,77 +222,80 @@ public function EndpointMonitor()
}

if ($this->ReadPropertyBoolean("DataPointNetwork") == 1)
{
$IPAddress = $DeviceFromController["ip"];
SetValue($this->GetIDForIdent($DeviceMac."IPAddress"), $IPAddress);
$this->SendDebug($this->Translate("Endpoint Monitor"), $this->Translate("Network Data IP ").$IPAddress, 0);

{
if (isset($DeviceFromController["ip"])) {
$IPAddress = $DeviceFromController["ip"];
$this->SetValue($this->GetIDForIdent($DeviceMac."IPAddress"), $IPAddress);
$this->SendDebug($this->Translate("Endpoint Monitor"), $this->Translate("Network Data IP ").$IPAddress, 0);
}
if ("" != $DeviceFromController["hostname"])
{
$Hostname = $DeviceFromController["hostname"];
}
elseif ("" != $DeviceFromController["name"])
{
$Hostname = $DeviceFromController["name"];
}
else
{
$Hostname = "";
}
SetValue($this->GetIDForIdent($DeviceMac."Hostname"), $Hostname);
$this->SetValue($this->GetIDForIdent($DeviceMac."Hostname"), $Hostname);
$this->SendDebug($this->Translate("Endpoint Monitor"), $this->Translate("Network Data Hostname ").$Hostname, 0);
$Connected = true;
}

if ($this->ReadPropertyBoolean("DataPointConnection") == 1)
{
if (isset($DeviceFromController["satisfaction"])) {
$Satisfaction = isset($DeviceMac["satisfaction"]);
SetValue($this->GetIDForIdent($DeviceMac."Satisfaction"), $Satisfaction);
$Satisfaction = $DeviceFromController["satisfaction"];
//$Satisfaction = isset($DeviceMac["satisfaction"]);
$this->SetValue($this->GetIDForIdent($DeviceMac."Satisfaction"), $Satisfaction);
$this->SendDebug($this->Translate("Endpoint Monitor"), $this->Translate("Connection Data Satisfaction ").$Satisfaction, 0);
}
$this->SendDebug($this->Translate("Endpoint Monitor"), $this->Translate("Connection Data Satisfaction ").$Satisfaction, 0);
//$this->SendDebug($this->Translate("Endpoint Monitor"), $this->Translate("Connection Data Satisfaction ").$Satisfaction, 0);
$SLastSeen = $DeviceFromController["last_seen"];
SetValue($this->GetIDForIdent($DeviceMac."LastSeen"), gmdate("Y-m-d H:i:s", $SLastSeen));
$SLastSeen = $SLastSeen + date("Z");
$this->SetValue($this->GetIDForIdent($DeviceMac."LastSeen"), gmdate("Y-m-d H:i:s", $SLastSeen));
$this->SendDebug($this->Translate("Endpoint Monitor"), $this->Translate("Connection Data Last Seen ").gmdate("Y-m-d H:i:s", $SLastSeen), 0);
$Uptime = $DeviceFromController["uptime"];
SetValue($this->GetIDForIdent($DeviceMac."Uptime"), round($Uptime / 3600, 0));
$this->SetValue($this->GetIDForIdent($DeviceMac."Uptime"), round($Uptime / 3600, 0));
$this->SendDebug($this->Translate("Endpoint Monitor"), $this->Translate("Connection Data Uptime in hours ").round($Uptime / 3600, 0), 0);
}
if ($this->ReadPropertyBoolean("DataPointConnection") == 1 && $ConnectionType == 0 && $ConnectionConfigError == false)

if ($this->ReadPropertyBoolean("DataPointConnection") == 1 AND $ConnectionType == 0 AND $ConnectionConfigError == false);
{
$Accesspoint = $DeviceFromController["ap_mac"];
SetValue($this->GetIDForIdent($DeviceMac."Accesspoint"), $Accesspoint);
$this->SetValue($this->GetIDForIdent($DeviceMac."Accesspoint"), $Accesspoint);
$this->SendDebug($this->Translate("Endpoint Monitor"), $this->Translate("Connection Data Accesspoint ").$Accesspoint, 0);
$Channel = $DeviceFromController["channel"];
SetValue($this->GetIDForIdent($DeviceMac."Channel"), $Channel);
$this->SetValue($this->GetIDForIdent($DeviceMac."Channel"), $Channel);
$this->SendDebug($this->Translate("Endpoint Monitor"), $this->Translate("Connection Data Channel ").$Channel, 0);
$Radio = $DeviceFromController["radio"];
SetValue($this->GetIDForIdent($DeviceMac."Radio"), $Radio);
$this->SetValue($this->GetIDForIdent($DeviceMac."Radio"), $Radio);
$this->SendDebug($this->Translate("Endpoint Monitor"), $this->Translate("Connection Data Radio ").$Radio, 0);
$ESSID = $DeviceFromController["essid"];
SetValue($this->GetIDForIdent($DeviceMac."ESSID"), $ESSID);
$this->SetValue($this->GetIDForIdent($DeviceMac."ESSID"), $ESSID);
$this->SendDebug($this->Translate("Endpoint Monitor"), $this->Translate("Connection Data ESSID ").$ESSID, 0);
$RSSI = $DeviceFromController["rssi"];
SetValue($this->GetIDForIdent($DeviceMac."RSSI"), $RSSI);
$this->SetValue($this->GetIDForIdent($DeviceMac."RSSI"), $RSSI);
$this->SendDebug($this->Translate("Endpoint Monitor"), $this->Translate("Connection Data RSSI ").$RSSI, 0);
$Noise = $DeviceFromController["noise"];
SetValue($this->GetIDForIdent($DeviceMac."Noise"), $Noise);
$this->SetValue($this->GetIDForIdent($DeviceMac."Noise"), $Noise);
$this->SendDebug($this->Translate("Endpoint Monitor"), $this->Translate("Connection Data Noise ").$Noise, 0);
$SignalStrength = $DeviceFromController["signal"];
SetValue($this->GetIDForIdent($DeviceMac."SignalStrength"), $SignalStrength);
$this->SetValue($this->GetIDForIdent($DeviceMac."SignalStrength"), $SignalStrength);
$this->SendDebug($this->Translate("Endpoint Monitor"), $this->Translate("Connection Data SignalStrength ").$SignalStrength, 0);
}
if ($this->ReadPropertyBoolean("DataPointTransfer") == 1 && $ConnectionType == 0 && $ConnectionConfigError == false)
if ($this->ReadPropertyBoolean("DataPointTransfer") == 1 AND $ConnectionType == 0 AND $ConnectionConfigError == false)
{
$TXBytes = $DeviceFromController["tx_bytes"];
SetValue($this->GetIDForIdent($DeviceMac."TXBytes"), $TXBytes / 1000000);
$this->SetValue($this->GetIDForIdent($DeviceMac."TXBytes"), $TXBytes / 1000000);
$this->SendDebug($this->Translate("Endpoint Monitor"), $this->Translate("Transfer Data TXBytes ").$TXBytes / 1000000, 0);
$RXBytes = $DeviceFromController["rx_bytes"];
SetValue($this->GetIDForIdent($DeviceMac."RXBytes"), $RXBytes / 1000000);
$this->SetValue($this->GetIDForIdent($DeviceMac."RXBytes"), $RXBytes / 1000000);
$this->SendDebug($this->Translate("Endpoint Monitor"), $this->Translate("Transfer Data RXBytes ").$RXBytes / 1000000, 0);
$TXPackets = $DeviceFromController["tx_packets"];
SetValue($this->GetIDForIdent($DeviceMac."TXPackets"), $TXPackets);
$this->SetValue($this->GetIDForIdent($DeviceMac."TXPackets"), $TXPackets);
$this->SendDebug($this->Translate("Endpoint Monitor"), $this->Translate("Transfer Data TXPackets ").$TXPackets, 0);
$RXPackets = $DeviceFromController["rx_packets"];
SetValue($this->GetIDForIdent($DeviceMac."RXPackets"), $RXPackets);
$this->SetValue($this->GetIDForIdent($DeviceMac."RXPackets"), $RXPackets);
$this->SendDebug($this->Translate("Endpoint Monitor"), $this->Translate("Transfer Data RXPackets ").$RXPackets, 0);
}

Expand All @@ -298,6 +304,8 @@ public function EndpointMonitor()
{
//$this->SendDebug($this->Translate("Endpoint Monitor"), $this->Translate("NOT found - Device: ").$DeviceName, 0);
}
$this->SendDebug($this->Translate("Endpoint Monitor"), $this->Translate("Setze Wert"), 0);
$this->SetValue($this->GetIDForIdent($DeviceMac."_Connected"), $Connected);
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion library.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"compatibility": {
"version": "5.5"
},
"version": "1.51",
"version": "1.6",
"build": 0,
"date": 0
}
Binary file added tests/.DS_Store
Binary file not shown.

0 comments on commit 1d8fbc8

Please sign in to comment.