diff --git a/README.md b/README.md index 2c38f3b..d0dfa7b 100644 --- a/README.md +++ b/README.md @@ -103,14 +103,13 @@ which results in `4008` for my PC. You can use [WMI Explorer](https://github.com/vinaypamnani/wmie2/tree/v2.0.0.2) to find see what data is available. -### UpTime - -This sensor returns the up time from windows in seconds - ### IdleTime -This sensor returns the idle time from windows in seconds +This sensor returns the amount of seconds the workstation has been idle for. It starts counting the moment you stop typing or moving your mouse. +### UpTime + +This sensor returns the up time from windows in seconds ### Dummy This sensor spits out a random number every second. Useful for testing, maybe you'll find some other use for it. diff --git a/UserInterface/Views/AddSensorDialog.axaml.cs b/UserInterface/Views/AddSensorDialog.axaml.cs index 9031548..20e659a 100644 --- a/UserInterface/Views/AddSensorDialog.axaml.cs +++ b/UserInterface/Views/AddSensorDialog.axaml.cs @@ -139,21 +139,20 @@ namespace UserInterface.Views item.ShowWindowNameInput = true; item.UpdateInterval = 5; break; - case AvailableSensors.UpTimeSensor: - item.Description = "This sensor returns the up time from windows in seconds"; - item.MoreInfoLink = "https://github.com/sleevezipper/hass-workstation-service#uptime"; - item.ShowQueryInput = false; - item.ShowWindowNameInput = true; - item.UpdateInterval = 5; - break; case AvailableSensors.IdleTimeSensor: - item.Description = "This sensor returns the idle time in seconds"; + item.Description = "This sensor returns the amount of seconds the workstation has been idle for. "; item.MoreInfoLink = "https://github.com/sleevezipper/hass-workstation-service#idletime"; item.ShowQueryInput = false; - item.ShowWindowNameInput = true; + item.ShowWindowNameInput = false; item.UpdateInterval = 5; break; - default: + case AvailableSensors.UpTimeSensor: + item.Description = "This sensor returns the up time from windows in seconds"; + item.MoreInfoLink = "https://github.com/sleevezipper/hass-workstation-service#uptime"; + item.ShowQueryInput = false; + item.ShowWindowNameInput = false; + item.UpdateInterval = 5; + break; default: item.Description = null; item.MoreInfoLink = null; item.ShowQueryInput = false; diff --git a/hass-workstation-service/Domain/Sensors/IdleTimeSensor.cs b/hass-workstation-service/Domain/Sensors/IdleTimeSensor.cs index e37dacc..03e7b61 100644 --- a/hass-workstation-service/Domain/Sensors/IdleTimeSensor.cs +++ b/hass-workstation-service/Domain/Sensors/IdleTimeSensor.cs @@ -1,21 +1,13 @@ using hass_workstation_service.Communication; using System; -using System.Collections.Generic; -using System.Linq; using System.Runtime.InteropServices; -using System.Text; -using HWND = System.IntPtr; namespace hass_workstation_service.Domain.Sensors { public class IdleTimeSensor : AbstractSensor { - public IdleTimeSensor(MqttPublisher publisher, int? updateInterval = 10, string name = "IdleTime", Guid id = default) : base(publisher, name ?? "IdleTime", updateInterval ?? 10, id) - { - - - } + public IdleTimeSensor(MqttPublisher publisher, int? updateInterval = 10, string name = "IdleTime", Guid id = default) : base(publisher, name ?? "IdleTime", updateInterval ?? 10, id){} public override AutoDiscoveryConfigModel GetAutoDiscoveryConfig() { @@ -31,7 +23,6 @@ namespace hass_workstation_service.Domain.Sensors public override string GetState() { - return GetLastInputTime().ToString(); }