From 6b711424e3b32c53d629a70faf851f97b1a63ac7 Mon Sep 17 00:00:00 2001 From: Pavel Date: Sat, 9 Jan 2021 19:49:38 +0100 Subject: [PATCH] Changed: Sensor domain was wrong (Idletime and Uptime). Added: Description for new sensors --- README.md | 8 ++++++++ UserInterface/Views/AddSensorDialog.axaml.cs | 14 ++++++++++++++ .../Domain/Sensors/IdleTimeSensor.cs | 2 +- .../Domain/Sensors/UpTimeSensor.cs | 2 +- 4 files changed, 24 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index ea2b8cc..2c38f3b 100644 --- a/README.md +++ b/README.md @@ -103,6 +103,14 @@ 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 + ### 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 66e37da..9031548 100644 --- a/UserInterface/Views/AddSensorDialog.axaml.cs +++ b/UserInterface/Views/AddSensorDialog.axaml.cs @@ -139,6 +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.MoreInfoLink = "https://github.com/sleevezipper/hass-workstation-service#idletime"; + item.ShowQueryInput = false; + item.ShowWindowNameInput = true; + item.UpdateInterval = 5; + break; default: item.Description = null; item.MoreInfoLink = null; diff --git a/hass-workstation-service/Domain/Sensors/IdleTimeSensor.cs b/hass-workstation-service/Domain/Sensors/IdleTimeSensor.cs index 4a22b11..e37dacc 100644 --- a/hass-workstation-service/Domain/Sensors/IdleTimeSensor.cs +++ b/hass-workstation-service/Domain/Sensors/IdleTimeSensor.cs @@ -24,7 +24,7 @@ namespace hass_workstation_service.Domain.Sensors Name = this.Name, Unique_id = this.Id.ToString(), Device = this.Publisher.DeviceConfigModel, - State_topic = $"homeassistant/sensor/{this.Name}/state", + State_topic = $"homeassistant/sensor/{Publisher.DeviceConfigModel.Name}/{this.Name}/state", Icon = "mdi:clock-time-three-outline", }); } diff --git a/hass-workstation-service/Domain/Sensors/UpTimeSensor.cs b/hass-workstation-service/Domain/Sensors/UpTimeSensor.cs index b1d461b..c1e4260 100644 --- a/hass-workstation-service/Domain/Sensors/UpTimeSensor.cs +++ b/hass-workstation-service/Domain/Sensors/UpTimeSensor.cs @@ -24,7 +24,7 @@ namespace hass_workstation_service.Domain.Sensors Name = this.Name, Unique_id = this.Id.ToString(), Device = this.Publisher.DeviceConfigModel, - State_topic = $"homeassistant/sensor/{this.Name}/state", + State_topic = $"homeassistant/sensor/{Publisher.DeviceConfigModel.Name}/{this.Name}/state", Icon = "mdi:clock-time-three-outline", }); }