diff --git a/.DS_Store b/.DS_Store index 8794b78..1b99c07 100644 Binary files a/.DS_Store and b/.DS_Store differ diff --git a/UniFi Device Monitor/README.md b/UniFi Device Monitor/README.md index 8334f9c..1782182 100644 --- a/UniFi Device Monitor/README.md +++ b/UniFi Device Monitor/README.md @@ -95,4 +95,7 @@ Version 1.3 - 03-01-2022 * Neu - Unifi API Zugriff in eigene Funktion ausgelagert (bessere Wartbarkeit) Version 1.5 - 03-12-2023 -* Neu - UI Aufgeräumt \ No newline at end of file +* Neu - UI Aufgeräumt + +Version 1.6 - 25-08-2024 +* Neu - Anzahl der verbundenen Geräte wird angezeigt \ No newline at end of file diff --git a/UniFi Device Monitor/README_en.md b/UniFi Device Monitor/README_en.md index 79b9fd5..0d3b5aa 100644 --- a/UniFi Device Monitor/README_en.md +++ b/UniFi Device Monitor/README_en.md @@ -77,4 +77,8 @@ Version 1.3 - 03-01-2022 * New - Unifi API access moved to its own function (better maintainability) Version 1.5 - 03-12-2023 -* New - UI tidied up \ No newline at end of file +* New - UI tidied up + +Version 1.6 - 01-09-2024 +* New - Number of connected devices are shown +* Change - SetValue replaced by $this->SetValue \ No newline at end of file diff --git a/UniFi Device Monitor/form.json b/UniFi Device Monitor/form.json index 4420c3f..485f9c4 100644 --- a/UniFi Device Monitor/form.json +++ b/UniFi Device Monitor/form.json @@ -137,6 +137,16 @@ "name": "DataPointHardware", "caption": "Hardware Data" }, + { + "type": "CheckBox", + "name": "DataPointTemperature", + "caption": "Temperature Data" + }, + { + "type": "CheckBox", + "name": "DataPointPower", + "caption": "Power Data" + }, { "type": "CheckBox", "name": "DataPointSpecific", diff --git a/UniFi Device Monitor/locale.json b/UniFi Device Monitor/locale.json index d46e084..98b61ab 100644 --- a/UniFi Device Monitor/locale.json +++ b/UniFi Device Monitor/locale.json @@ -25,6 +25,8 @@ "Wired": "Kabel", "Basic Data": "Basisdaten", "Hardware Data": "Hardwaredaten", + "Temperature Data": "Temperatur Daten", + "Power Data": "PoE Energie", "Device Type": "Geräte Typ", "Config error - device monitored is a wired device. Please select wired in the module configuration.": "Konfigurationsfehler - das überwachte Gerät ist verkabelt. Bitte dies in der Modulkonfiguration einstellen.", "Network Data": "Netzwerkdaten", @@ -36,6 +38,7 @@ "Device Model": "Geräte Typ", "Device Name": "Geräte Name", "CPU Load": "CPU Auslastung", + "Connected Devices": "Verbundene Geräte", "Memory Load": "Speicher Auslastung", "WAN 1 TX Packets": "WAN 1 TX Pakete", "WAN 1 RX Packets": "WAN 1 RX Pakete", diff --git a/UniFi Device Monitor/module.php b/UniFi Device Monitor/module.php index f781133..e6546f2 100644 --- a/UniFi Device Monitor/module.php +++ b/UniFi Device Monitor/module.php @@ -34,6 +34,8 @@ public function Create() $this->RegisterPropertyBoolean("DataPointBasic", 1); $this->RegisterPropertyBoolean("DataPointHardware", 0); + $this->RegisterPropertyBoolean("DataPointTemperature", 0); + $this->RegisterPropertyBoolean("DataPointPower", 0); $this->RegisterPropertyBoolean("DataPointSpecific", 0); @@ -65,6 +67,13 @@ public function ApplyChanges() $vpos = 200; $this->MaintainVariable("CPULoad", $this->Translate("CPU Load"), vtFloat, "", $vpos++, $this->ReadPropertyBoolean("DataPointHardware") == 1); $this->MaintainVariable("MemoryLoad", $this->Translate("Memory Load"), vtFloat, "", $vpos++, $this->ReadPropertyBoolean("DataPointHardware") == 1); + $this->MaintainVariable("ConnectedDevices", $this->Translate("Connected Devices"), vtInteger, "", $vpos++, $this->ReadPropertyBoolean("DataPointHardware") == 1); + + //Temperature Data + $vpos = 230; + $this->MaintainVariable("TotalUsedPower", $this->Translate("Total Used Power (POE)"), vtFloat, "", $vpos++, $this->ReadPropertyBoolean("DataPointPower") == 1); + $this->MaintainVariable("FanLevel", $this->Translate("Fan Level"), vtInteger, "", $vpos++, $this->ReadPropertyBoolean("DataPointTemperature") == 1); + $this->MaintainVariable("DeviceTemperature", $this->Translate("Device Temperature"), vtInteger, "", $vpos++, $this->ReadPropertyBoolean("DataPointTemperature") == 1); //Device Specific Data Connection Data UDM/USG @@ -153,59 +162,86 @@ public function DeviceMonitor() if ($this->ReadPropertyBoolean("DataPointBasic") == 1) { $DeviceModel = $JSONData["data"][0]["model"]; - SetValue($this->GetIDForIdent("DeviceModel"), $DeviceModel); + $this->SetValue("DeviceModel", $DeviceModel); $this->SendDebug($this->Translate("Device Monitor"), $this->Translate("Device Model ").$DeviceModel, 0); $SoftwareVersion = $JSONData["data"][0]["version"]; - SetValue($this->GetIDForIdent("SoftwareVersion"), $SoftwareVersion); + $this->SetValue("SoftwareVersion", $SoftwareVersion); $this->SendDebug($this->Translate("Device Monitor"), $this->Translate("Software Version ").$SoftwareVersion, 0); //$Satisfaction = $JSONData["data"][0]["satisfaction"]; //SetValue($this->GetIDForIdent("Satisfaction"),$Satisfaction); //$this->SendDebug($this->Translate("Device Monitor"),$this->Translate("Device Satisfaction ").$Satisfaction,0); $SLastSeen = $JSONData["data"][0]["last_seen"]; - SetValue($this->GetIDForIdent("LastSeen"), gmdate("Y-m-d H:i:s", $SLastSeen)); + $this->SetValue("LastSeen", gmdate("Y-m-d H:i:s", $SLastSeen)); $this->SendDebug($this->Translate("Device Monitor"), $this->Translate("Connection Data Last Seen ").gmdate("Y-m-d H:i:s", $SLastSeen), 0); $Uptime = $JSONData["data"][0]["uptime"]; - SetValue($this->GetIDForIdent("Uptime"), round($Uptime / 3600, 0)); + $this->SetValue("Uptime", round($Uptime / 3600, 0)); $this->SendDebug($this->Translate("Device Monitor"), $this->Translate("Connection Data Uptime in hours ").round($Uptime / 3600, 0), 0); if (isset($JSONData["data"][0]["name"])) { $Name = $JSONData["data"][0]["name"]; - SetValue($this->GetIDForIdent("Name"), $Name); + $this->SetValue("Name", $Name); $this->SendDebug($this->Translate("Device Monitor"), $this->Translate("Devicename ").$Name, 0); } } if ($this->ReadPropertyBoolean("DataPointHardware") == 1) { $CPULoad = $JSONData["data"][0]["system-stats"]["cpu"]; - SetValue($this->GetIDForIdent("CPULoad"), $CPULoad); + $this->SetValue("CPULoad", $CPULoad); $this->SendDebug($this->Translate("Device Monitor"), $this->Translate("CPU Load ").$CPULoad, 0); $MemoryLoad = $JSONData["data"][0]["system-stats"]["mem"]; - SetValue($this->GetIDForIdent("MemoryLoad"), $MemoryLoad); + $this->SetValue("MemoryLoad", $MemoryLoad); $this->SendDebug($this->Translate("Device Monitor"), $this->Translate("Memory Load ").$MemoryLoad, 0); + $ConnectedDevices = $JSONData["data"][0]["num_sta"]; + $this->SetValue("ConnectedDevices", $ConnectedDevices); + $this->SendDebug($this->Translate("Endpoint Monitor"), $this->Translate("Connected Devices ").$ConnectedDevices, 0); + } + if ($this->ReadPropertyBoolean("DataPointHardware") == 1) + { + if (isset($JSONData["data"][0]["fan_level"])) + { + $FanLevel = $JSONData["data"][0]["fan_level"]; + $this->SetValue("FanLevel", $FanLevel); + $this->SendDebug($this->Translate("Device Monitor"), $this->Translate("Fan Level ").$FanLevel, 0); + } + if (isset($JSONData["data"][0]["general_temperature"])) + { + $DeviceTemp = $JSONData["data"][0]["general_temperature"]; + $this->SetValue("DeviceTemperature", $DeviceTemp); + $this->SendDebug($this->Translate("Device Monitor"), $this->Translate("Device Temperature ").$DeviceTemp, 0); + } + } + if ($this->ReadPropertyBoolean("DataPointPower") == 1) + { + if (isset($JSONData["data"][0]["total_used_power"])) + { + $POETotalPower = $JSONData["data"][0]["total_used_power"]; + $this->SetValue("TotalUsedPower", $POETotalPower); + $this->SendDebug($this->Translate("Device Monitor"), $this->Translate("Total used Power ").$POETotalPower, 0); + } } if ($this->ReadPropertyBoolean("DataPointSpecific") == 1 && $this->ReadPropertyInteger("DeviceType") == 0 && $DeviceConfigError == false) { $WAN1IP = $JSONData["data"][0]["wan1"]["ip"]; - SetValue($this->GetIDForIdent("WAN1IP"), $WAN1IP); + $this->SetValue("WAN1IP", $WAN1IP); $this->SendDebug($this->Translate("Device Monitor"), $this->Translate("Connection Data WAN 1 IP ").$WAN1IP, 0); $WAN1TXBytes = $JSONData["data"][0]["wan1"]["tx_bytes"]; - SetValue($this->GetIDForIdent("WAN1TXBytes"), $WAN1TXBytes / 1000000); + $this->SetValue("WAN1TXBytes", $WAN1TXBytes / 1000000); $this->SendDebug($this->Translate("Device Monitor"), $this->Translate("Transfer Data WAN 1 TX Bytes ").$WAN1TXBytes, 0); $WAN1RXBytes = $JSONData["data"][0]["wan1"]["rx_bytes"]; - SetValue($this->GetIDForIdent("WAN1RXBytes"), $WAN1RXBytes / 1000000); + $this->SetValue("WAN1RXBytes", $WAN1RXBytes / 1000000); $this->SendDebug($this->Translate("Endpoint Monitor"), $this->Translate("Transfer Data WAN 1 RX Bytes ").$WAN1RXBytes, 0); $WAN1TXPackets = $JSONData["data"][0]["wan1"]["tx_packets"]; - SetValue($this->GetIDForIdent("WAN1TXPackets"), $WAN1TXPackets); + $this->SetValue("WAN1TXPackets", $WAN1TXPackets); $this->SendDebug($this->Translate("Device Monitor"), $this->Translate("Transfer Data WAN 1 TX Packets ").$WAN1TXPackets, 0); $WAN1RXPackets = $JSONData["data"][0]["wan1"]["tx_packets"]; - SetValue($this->GetIDForIdent("WAN1RXPackets"), $WAN1RXPackets); + $this->SetValue("WAN1RXPackets", $WAN1RXPackets); $this->SendDebug($this->Translate("Device Monitor"), $this->Translate("Transfer Data WAN 1 RXPackets ").$WAN1RXPackets, 0); $WAN1TXErrors = $JSONData["data"][0]["wan1"]["tx_errors"]; - SetValue($this->GetIDForIdent("WAN1TXErrors"), $WAN1TXErrors); + $this->SetValue("WAN1TXErrors", $WAN1TXErrors); $this->SendDebug($this->Translate("Device Monitor"), $this->Translate("Transfer Data WAN 1 TX Errors ").$WAN1TXErrors, 0); $WAN1RXErrors = $JSONData["data"][0]["wan1"]["rx_errors"]; - SetValue($this->GetIDForIdent("WAN1RXErrors"), $WAN1RXErrors); + $this->SetValue("WAN1RXErrors", $WAN1RXErrors); $this->SendDebug($this->Translate("Device Monitor"), $this->Translate("Transfer Data WAN 1 RX Errors ").$WAN1RXErrors, 0); } } diff --git a/UniFi Endpoint Blocker/README.md b/UniFi Endpoint Blocker/README.md index 0c94772..46ed3f2 100644 --- a/UniFi Endpoint Blocker/README.md +++ b/UniFi Endpoint Blocker/README.md @@ -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 \ No newline at end of file diff --git a/UniFi Endpoint Blocker/README_en.md b/UniFi Endpoint Blocker/README_en.md index 1b0a55e..2f14b3f 100644 --- a/UniFi Endpoint Blocker/README_en.md +++ b/UniFi Endpoint Blocker/README_en.md @@ -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 \ No newline at end of file +* New - UI tidied up + +Version 1.6 - 25-08-2024 +* No changes \ No newline at end of file diff --git a/UniFi Endpoint Blocker/module.php b/UniFi Endpoint Blocker/module.php index 2a14184..15cd5bd 100644 --- a/UniFi Endpoint Blocker/module.php +++ b/UniFi Endpoint Blocker/module.php @@ -64,7 +64,7 @@ public function ApplyChanges() $this->RegisterVariableBoolean($DeviceMacClean, $DeviceName, "~Switch"); $DeviceMacCleanID = @IPS_GetObjectIDByIdent($DeviceMacClean, $this->InstanceID); - SetValue($DeviceMacCleanID, true); + $this->SetValue($DeviceMacCleanID, true); IPS_Sleep(1000); $this->EnableAction($DeviceMacClean); $this->RegisterMessage($DeviceMacCleanID, VM_UPDATE); diff --git a/UniFi Endpoint Monitor/module.php b/UniFi Endpoint Monitor/module.php index 37b84d1..5d42bf6 100644 --- a/UniFi Endpoint Monitor/module.php +++ b/UniFi Endpoint Monitor/module.php @@ -76,7 +76,7 @@ public function ApplyChanges() $this->MaintainVariable("RSSI", $this->Translate("RSSI"), vtInteger, "", $vpos++, $this->ReadPropertyBoolean("DataPointConnection") == 1 && $this->ReadPropertyInteger("ConnectionType") == 0); $this->MaintainVariable("Noise", $this->Translate("Noise"), vtInteger, "", $vpos++, $this->ReadPropertyBoolean("DataPointConnection") == 1 && $this->ReadPropertyInteger("ConnectionType") == 0); $this->MaintainVariable("SignalStrength", $this->Translate("Signal Strength"), vtInteger, "", $vpos++, $this->ReadPropertyBoolean("DataPointConnection") == 1 && $this->ReadPropertyInteger("ConnectionType") == 0); - + //Transfer Data $vpos = 300; $this->MaintainVariable("TXBytes", $this->Translate("TX Megabytes"), vtInteger, "", $vpos++, $this->ReadPropertyBoolean("DataPointTransfer") == 1 && $this->ReadPropertyInteger("ConnectionType") == 0); @@ -175,7 +175,7 @@ public function EndpointMonitor() //after a device gets reconnected, wait until the controller has rebuilt the data set $this->SendDebug($this->Translate("Endpoint Monitor"), $this->Translate("Device was disconnected and is now connected again. Module waits for Controller to collect data."), 0); IPS_Sleep(10000); - SetValue($this->GetIDForIdent("Connected"), true); + $this->SetValue("Connected", true); $RawData = $this->getRawData($Cookie, $ServerAddress, $ServerPort, $UnifiAPI, $ControllerType); $JSONData = json_decode($RawData, true); } @@ -195,7 +195,7 @@ public function EndpointMonitor() if ($this->ReadPropertyBoolean("DataPointNetwork") == 1) { $IPAddress = $JSONData["data"][0]["ip"]; - SetValue($this->GetIDForIdent("IPAddress"), $IPAddress); + $this->SetValue("IPAddress", $IPAddress); $this->SendDebug($this->Translate("Endpoint Monitor"), $this->Translate("Network Data IP ").$IPAddress, 0); if ("" != $JSONData["data"][0]["hostname"]) @@ -210,7 +210,7 @@ public function EndpointMonitor() { $Hostname = ""; } - SetValue($this->GetIDForIdent("Hostname"), $Hostname); + $this->SetValue("Hostname", $Hostname); $this->SendDebug($this->Translate("Endpoint Monitor"), $this->Translate("Network Data Hostname ").$Hostname, 0); //$Name = $JSONData["data"][0]["name"]; //SetValue($this->GetIDForIdent("Name"),$Name); @@ -220,60 +220,60 @@ public function EndpointMonitor() { if (isset($JSONData["data"][0]["satisfaction"])) { $Satisfaction = isset($JSONData["data"][0]["satisfaction"]); - SetValue($this->GetIDForIdent("Satisfaction"), $Satisfaction); + $this->SetValue("Satisfaction", $Satisfaction); } $this->SendDebug($this->Translate("Endpoint Monitor"), $this->Translate("Connection Data Satisfaction ").$Satisfaction, 0); $SLastSeen = $JSONData["data"][0]["last_seen"]; - SetValue($this->GetIDForIdent("LastSeen"), gmdate("Y-m-d H:i:s", $SLastSeen)); + $this->SetValue("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 = $JSONData["data"][0]["uptime"]; - SetValue($this->GetIDForIdent("Uptime"), round($Uptime / 3600, 0)); + $this->SetValue("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 && $this->ReadPropertyInteger("ConnectionType") == 0 && $ConnectionConfigError == false) { $Accesspoint = $JSONData["data"][0]["ap_mac"]; - SetValue($this->GetIDForIdent("Accesspoint"), $Accesspoint); + $this->SetValue("Accesspoint", $Accesspoint); $this->SendDebug($this->Translate("Endpoint Monitor"), $this->Translate("Connection Data Accesspoint ").$Accesspoint, 0); $Channel = $JSONData["data"][0]["channel"]; - SetValue($this->GetIDForIdent("Channel"), $Channel); + $this->SetValue("Channel", $Channel); $this->SendDebug($this->Translate("Endpoint Monitor"), $this->Translate("Connection Data Channel ").$Channel, 0); $Radio = $JSONData["data"][0]["radio"]; - SetValue($this->GetIDForIdent("Radio"), $Radio); + $this->SetValue("Radio", $Radio); $this->SendDebug($this->Translate("Endpoint Monitor"), $this->Translate("Connection Data Radio ").$Radio, 0); $ESSID = $JSONData["data"][0]["essid"]; - SetValue($this->GetIDForIdent("ESSID"), $ESSID); + $this->SetValue("ESSID", $ESSID); $this->SendDebug($this->Translate("Endpoint Monitor"), $this->Translate("Connection Data ESSID ").$ESSID, 0); $RSSI = $JSONData["data"][0]["rssi"]; - SetValue($this->GetIDForIdent("RSSI"), $RSSI); + $this->SetValue("RSSI", $RSSI); $this->SendDebug($this->Translate("Endpoint Monitor"), $this->Translate("Connection Data RSSI ").$RSSI, 0); $Noise = $JSONData["data"][0]["noise"]; - SetValue($this->GetIDForIdent("Noise"), $Noise); + $this->SetValue("Noise", $Noise); $this->SendDebug($this->Translate("Endpoint Monitor"), $this->Translate("Connection Data Noise ").$Noise, 0); $SignalStrength = $JSONData["data"][0]["signal"]; - SetValue($this->GetIDForIdent("SignalStrength"), $SignalStrength); + $this->SetValue("SignalStrength", $SignalStrength); $this->SendDebug($this->Translate("Endpoint Monitor"), $this->Translate("Connection Data SignalStrength ").$SignalStrength, 0); } if ($this->ReadPropertyBoolean("DataPointTransfer") == 1 && $this->ReadPropertyInteger("ConnectionType") == 0 && $ConnectionConfigError == false) { $TXBytes = $JSONData["data"][0]["tx_bytes"]; - SetValue($this->GetIDForIdent("TXBytes"), $TXBytes / 1000000); + $this->SetValue("TXBytes", $TXBytes / 1000000); $this->SendDebug($this->Translate("Endpoint Monitor"), $this->Translate("Transfer Data TXBytes ").$TXBytes / 1000000, 0); $RXBytes = $JSONData["data"][0]["rx_bytes"]; - SetValue($this->GetIDForIdent("RXBytes"), $RXBytes / 1000000); + $this->SetValue("RXBytes", $RXBytes / 1000000); $this->SendDebug($this->Translate("Endpoint Monitor"), $this->Translate("Transfer Data RXBytes ").$RXBytes / 1000000, 0); $TXPackets = $JSONData["data"][0]["tx_packets"]; - SetValue($this->GetIDForIdent("TXPackets"), $TXPackets); + $this->SetValue("TXPackets", $TXPackets); $this->SendDebug($this->Translate("Endpoint Monitor"), $this->Translate("Transfer Data TXPackets ").$TXPackets, 0); $RXPackets = $JSONData["data"][0]["rx_packets"]; - SetValue($this->GetIDForIdent("RXPackets"), $RXPackets); + $this->SetValue("RXPackets", $RXPackets); $this->SendDebug($this->Translate("Endpoint Monitor"), $this->Translate("Transfer Data RXPackets ").$RXPackets, 0); } } elseif ($DeviceAvailable == "error") { $this->SendDebug($this->Translate("Endpoint Monitor"), $this->Translate("Device to be monitored is not available / Disconnected"), 0); - SetValue($this->GetIDForIdent("Connected"), false); + $this->SetValue("Connected", false); } } else diff --git a/UniFi Internet Controller/module.php b/UniFi Internet Controller/module.php index 24aa8a0..f58e1d0 100644 --- a/UniFi Internet Controller/module.php +++ b/UniFi Internet Controller/module.php @@ -198,7 +198,7 @@ public function GetInternetData() if ($value != GetValue($this->GetIDForIdent($variable['ident']))) { $this->SendDebug($this->Translate($variable['localeName']), $this->Translate("updated to ").$value, 0); - SetValue($this->GetIDForIdent($variable['ident']), $value); + $this->SetValue($variable['ident'], $value); } else { @@ -243,7 +243,7 @@ public function GetInternetData() if ($value != GetValue($this->GetIDForIdent($variable['ident']))) { $this->SendDebug($this->Translate($variable['localeName']), $this->Translate("updated to ").$value, 0); - SetValue($this->GetIDForIdent($variable['ident']), $value); + $this->SetValue($variable['ident'], $value); } else { @@ -322,7 +322,7 @@ public function GetInternetData() if ($value != GetValue($this->GetIDForIdent($variable['ident']))) { $this->SendDebug($this->Translate($variable['localeName']), $this->Translate("updated to ").$value, 0); - SetValue($this->GetIDForIdent($variable['ident']), $value); + $this->SetValue($variable['ident'], $value); } else { diff --git a/UniFi Multi Endpoint Monitor/README.md b/UniFi Multi Endpoint Monitor/README.md index 75f45a6..2b01ecc 100644 --- a/UniFi Multi Endpoint Monitor/README.md +++ b/UniFi Multi Endpoint Monitor/README.md @@ -88,4 +88,13 @@ Das Modul gibt diverse Informationen im Debug Bereich aus. ## 5. Versionsinformation Version 1.5 - 02-12-2023 -* Neu - Modul verfügbar \ No newline at end of file +* Neu - Modul verfügbar + +Version 1.6 - 01-09-2024 (Credit M70 - Danke) +* Neu - WLAN Geräte melden wo sie zuletzt angemeldet waren +* 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 \ No newline at end of file diff --git a/UniFi Multi Endpoint Monitor/README_en.md b/UniFi Multi Endpoint Monitor/README_en.md index a9da138..00faef9 100644 --- a/UniFi Multi Endpoint Monitor/README_en.md +++ b/UniFi Multi Endpoint Monitor/README_en.md @@ -71,4 +71,16 @@ The module outputs various information in the debug area. ## 5. version information Version 1.5 - 02-12-2023 -* New - Module available \ No newline at end of file +* New - Module available + +Version 1.6 - 02-12-2023 +* Neu - Modul verfügbar + +Version 1.6 - 25-08-2024 (Credit M70 - Danke) +* New - WLAN Devices report where they have been logged in last +* 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 \ No newline at end of file diff --git a/UniFi Multi Endpoint Monitor/locale.json b/UniFi Multi Endpoint Monitor/locale.json index c8c8528..0cf19ac 100644 --- a/UniFi Multi Endpoint Monitor/locale.json +++ b/UniFi Multi Endpoint Monitor/locale.json @@ -42,6 +42,7 @@ "Radio": "Funktechnologie", "Noise": "Störung", "Signal Strength": "Signal Stärke", + "Last Uplink Name": "Letzte Verbindung (Access Point)", "TX Packets": "TX Pakete", "RX Packets": "RX Pakete", "Check site name": "Name der Site prüfen", diff --git a/UniFi Multi Endpoint Monitor/module.php b/UniFi Multi Endpoint Monitor/module.php index 8cd9968..8c5e4dc 100644 --- a/UniFi Multi Endpoint Monitor/module.php +++ b/UniFi Multi Endpoint Monitor/module.php @@ -93,6 +93,7 @@ public function ApplyChanges() $this->MaintainVariable($DeviceMac."RSSI", $DeviceName.$this->Translate(" RSSI"), vtInteger, "", $vpos++, $this->ReadPropertyBoolean("DataPointConnection") == 1 && $ConnectionType == 0); $this->MaintainVariable($DeviceMac."Noise", $DeviceName.$this->Translate(" Noise"), vtInteger, "", $vpos++, $this->ReadPropertyBoolean("DataPointConnection") == 1 && $ConnectionType == 0); $this->MaintainVariable($DeviceMac."SignalStrength", $DeviceName.$this->Translate(" Signal Strength"), vtInteger, "", $vpos++, $this->ReadPropertyBoolean("DataPointConnection") == 1 && $ConnectionType == 0); + $this->MaintainVariable($DeviceMac."LastUplinkName", $DeviceName.$this->Translate(" Last Uplink Name"), vtString, "", $vpos++, $this->ReadPropertyBoolean("DataPointConnection") == 1 && $ConnectionType == 0); //Transfer Data $vpos = 600; @@ -196,6 +197,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) @@ -205,8 +207,9 @@ 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); if ($ConnectionMethod == true && $ConnectionType == 0) { @@ -219,77 +222,99 @@ 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($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($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($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($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($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->SendDebug($this->Translate("Endpoint Monitor"), $this->Translate("Connection Data Accesspoint ").$Accesspoint, 0); - $Channel = $DeviceFromController["channel"]; - 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->SendDebug($this->Translate("Endpoint Monitor"), $this->Translate("Connection Data Radio ").$Radio, 0); - $ESSID = $DeviceFromController["essid"]; - 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->SendDebug($this->Translate("Endpoint Monitor"), $this->Translate("Connection Data RSSI ").$RSSI, 0); - $Noise = $DeviceFromController["noise"]; - 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->SendDebug($this->Translate("Endpoint Monitor"), $this->Translate("Connection Data SignalStrength ").$SignalStrength, 0); + if(isset($DeviceFromController["ap_mac"])) { + $Accesspoint = $DeviceFromController["ap_mac"]; + $this->SetValue($DeviceMac."Accesspoint", $Accesspoint); + $this->SendDebug($this->Translate("Endpoint Monitor"), $this->Translate("Connection Data Accesspoint ").$Accesspoint, 0); + } + if(isset($DeviceFromController["channel"])) { + $Channel = $DeviceFromController["channel"]; + $this->SetValue($DeviceMac."Channel", $Channel); + $this->SendDebug($this->Translate("Endpoint Monitor"), $this->Translate("Connection Data Channel ").$Channel, 0); + } + if(isset($DeviceFromController["radio"])) { + $Radio = $DeviceFromController["radio"]; + $this->SetValue($DeviceMac."Radio", $Radio); + $this->SendDebug($this->Translate("Endpoint Monitor"), $this->Translate("Connection Data Radio ").$Radio, 0); + } + if(isset($DeviceFromController["essid"])) { + $ESSID = $DeviceFromController["essid"]; + $this->SetValue($DeviceMac."ESSID", $ESSID); + $this->SendDebug($this->Translate("Endpoint Monitor"), $this->Translate("Connection Data ESSID ").$ESSID, 0); + } + if(isset($DeviceFromController["rssi"])) { + $RSSI = $DeviceFromController["rssi"]; + $this->SetValue($DeviceMac."RSSI", $RSSI); + $this->SendDebug($this->Translate("Endpoint Monitor"), $this->Translate("Connection Data RSSI ").$RSSI, 0); + } + if(isset($DeviceFromController["noise"])) { + $Noise = $DeviceFromController["noise"]; + $this->SetValue($DeviceMac."Noise", $Noise); + $this->SendDebug($this->Translate("Endpoint Monitor"), $this->Translate("Connection Data Noise ").$Noise, 0); + } + if(isset($DeviceFromController["signal"])) { + $SignalStrength = $DeviceFromController["signal"]; + $this->SetValue($DeviceMac."SignalStrength", $SignalStrength); + $this->SendDebug($this->Translate("Endpoint Monitor"), $this->Translate("Connection Data SignalStrength ").$SignalStrength, 0); + } + if(isset($DeviceFromController["last_uplink_name"])) { + $LastUplinkName = $DeviceFromController["last_uplink_name"]; + $this->SetValue($DeviceMac."LastUplinkName", $LastUplinkName); + $this->SendDebug($this->Translate("Endpoint Monitor"), $this->Translate("Last Uplink Name ").$LastUplinkName, 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($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($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($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($DeviceMac."RXPackets", $RXPackets); $this->SendDebug($this->Translate("Endpoint Monitor"), $this->Translate("Transfer Data RXPackets ").$RXPackets, 0); } @@ -298,6 +323,7 @@ public function EndpointMonitor() { //$this->SendDebug($this->Translate("Endpoint Monitor"), $this->Translate("NOT found - Device: ").$DeviceName, 0); } + $this->SetValue($DeviceMac."_Connected", $Connected); } } } diff --git a/UniFi PoE Control/module.php b/UniFi PoE Control/module.php index b91c060..2d40219 100644 --- a/UniFi PoE Control/module.php +++ b/UniFi PoE Control/module.php @@ -63,7 +63,7 @@ public function ApplyChanges() $this->RegisterVariableBoolean($DeviceMacClean . $i, $DeviceName . " Port: " . $i, "~Switch"); $DeviceMacCleanID = @IPS_GetObjectIDByIdent($DeviceMacClean .$i, $this->InstanceID); - SetValue($DeviceMacCleanID, false); + $this->SetValue($DeviceMacCleanID, false); IPS_Sleep(1000); $this->EnableAction($DeviceMacClean . $i); $this->RegisterMessage($DeviceMacCleanID, VM_UPDATE); @@ -218,7 +218,7 @@ public function AuthenticateAndProcessRequest(string $UnifiAPI = "") if ($ControllerFeedbackOK == "ok") { // reset variable - SetValue($SenderID, false); + $this->SetValue($SenderID, false); //WFC_SendPopup(12345, "Test", "Eine nette
Meldung"); } elseif ($ControllerFeedbackOK == "error") diff --git a/UniFi Presence Manager/module.php b/UniFi Presence Manager/module.php index 78f0051..3059597 100644 --- a/UniFi Presence Manager/module.php +++ b/UniFi Presence Manager/module.php @@ -144,10 +144,10 @@ public function CheckPresence() { if ($OldPresenceValue == 0) { //check if new value is different and only than trigger a replacement - SetValue($this->GetIDForIdent($DeviceMac), 1); + $this->SetValue($DeviceMac, 1); if ($this->ReadPropertyBoolean("GeneralPresenceUpdatedVariable") == 1) { - SetValue($this->GetIDForIdent("GeneralPresenceUpdatedVariable"), 1); + $this->SetValue("GeneralPresenceUpdatedVariable", 1); } $this->SendDebug($this->Translate("Presence Manager"), $this->Translate("Device ACTIVE with MAC: ".$DeviceMac), 0); } @@ -159,10 +159,10 @@ public function CheckPresence() { if ($OldPresenceValue == 1) { - SetValue($this->GetIDForIdent($DeviceMac), 0); + $this->SetValue($DeviceMac, 0); if ($this->ReadPropertyBoolean("GeneralPresenceUpdatedVariable") == 1) { - SetValue($this->GetIDForIdent("GeneralPresenceUpdatedVariable"), 1); + $this->SetValue("GeneralPresenceUpdatedVariable", 1); } $this->SendDebug($this->Translate("Presence Manager"), $this->Translate("Device NOT active with MAC: ".$DeviceMac), 0); } diff --git a/library.json b/library.json index 2f671ce..fd501e0 100644 --- a/library.json +++ b/library.json @@ -6,7 +6,7 @@ "compatibility": { "version": "5.5" }, - "version": "1.5", + "version": "1.6", "build": 0, "date": 0 } diff --git a/tests/.DS_Store b/tests/.DS_Store new file mode 100644 index 0000000..a7dcb5e Binary files /dev/null and b/tests/.DS_Store differ