diff --git a/.DS_Store b/.DS_Store index 4284437..1b99c07 100644 Binary files a/.DS_Store and b/.DS_Store differ diff --git a/UniFi Device Monitor/README_en.md b/UniFi Device Monitor/README_en.md index 0f31085..0d3b5aa 100644 --- a/UniFi Device Monitor/README_en.md +++ b/UniFi Device Monitor/README_en.md @@ -79,5 +79,6 @@ Version 1.3 - 03-01-2022 Version 1.5 - 03-12-2023 * New - UI tidied up -Version 1.6 - 25-08-2024 -* New - Number of connected devices are shown \ No newline at end of file +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/module.php b/UniFi Device Monitor/module.php index d63dafa..94643a4 100644 --- a/UniFi Device Monitor/module.php +++ b/UniFi Device Monitor/module.php @@ -154,62 +154,62 @@ 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"]; - SetValue($this->GetIDForIdent("ConnectedDevices"), $ConnectedDevices); + $this->SetValue("ConnectedDevices", $ConnectedDevices); $this->SendDebug($this->Translate("Endpoint Monitor"), $this->Translate("Connected Devices ").$ConnectedDevices, 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/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 7cd364d..5d42bf6 100644 --- a/UniFi Endpoint Monitor/module.php +++ b/UniFi Endpoint Monitor/module.php @@ -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 2f05832..2b01ecc 100644 --- a/UniFi Multi Endpoint Monitor/README.md +++ b/UniFi Multi Endpoint Monitor/README.md @@ -90,7 +90,8 @@ Das Modul gibt diverse Informationen im Debug Bereich aus. Version 1.5 - 02-12-2023 * Neu - Modul verfügbar -Version 1.6 - 25-08-2024 (Credit M70 - Danke) +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 diff --git a/UniFi Multi Endpoint Monitor/README_en.md b/UniFi Multi Endpoint Monitor/README_en.md index b84ce11..00faef9 100644 --- a/UniFi Multi Endpoint Monitor/README_en.md +++ b/UniFi Multi Endpoint Monitor/README_en.md @@ -77,6 +77,7 @@ 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 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 b581b44..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; @@ -295,6 +296,11 @@ public function EndpointMonitor() $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 AND $ConnectionType == 0 AND $ConnectionConfigError == false) { 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/tests/.DS_Store b/tests/.DS_Store index a2944cf..a7dcb5e 100644 Binary files a/tests/.DS_Store and b/tests/.DS_Store differ