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 d1b7868..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", @@ -38,7 +40,6 @@ "CPU Load": "CPU Auslastung", "Connected Devices": "Verbundene Geräte", "Memory Load": "Speicher Auslastung", - "Connected Devices": "Verbunde Geräte", "WAN 1 TX Packets": "WAN 1 TX Pakete", "WAN 1 RX Packets": "WAN 1 RX Pakete", "WAN 1 TX Errors": "WAN 1 TX Fehler", diff --git a/UniFi Device Monitor/module.php b/UniFi Device Monitor/module.php index 94643a4..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); @@ -67,6 +69,12 @@ public function ApplyChanges() $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 $vpos = 300; @@ -187,6 +195,30 @@ public function DeviceMonitor() $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"];