Skip to content
This repository has been archived by the owner on Oct 13, 2020. It is now read-only.

MQTT idle monitor for Windows. Runs as a service.

Notifications You must be signed in to change notification settings

AJax2012/home-assistant-pc-monitor

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

15 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Windows Idle Monitor for Home Assistant

This project uses MQTT to update home assistant with the status of a Windows 10 computer. Credit to KjetilSv for the original idea (as well as several lines of code).

This project runs as a Windows background service. Currently, the installation is slightly difficult, but only requires editing a JSON file and a few lines with the command prompt in Administrator mode.

Installation

  1. Install ASP.NET Core 3.1 SDK and Runtime
  2. Edit the JSON file
    • BridgeUrl: location of the MQTT server
    • BridgePort: MQTT server port
    • UserName: username of the MQTT server (optional)
    • ClientId: ID you would like to use for the Windows computer
    • Password: password for the MQTT server (optional)
{
  "BridgeUrl": "hassio.local",
  "BridgePort": 1883,
  "BridgeUser": {
    "UserName": "mqtt-user",
    "ClientId": "not-hassio",
    "Password": "mqtt-pass"
  }
}
  1. Publish the file
    • Open the command prompt (or Powershell)
    • cd to project directory
    • run dotnet publish -f netcoreapp3.1 -r win-x64 -c Release -o {outputDirectory} with outputDirectory being the location you want to run the service from.
  2. Create and start the service
    • Open the Command Prompt as an administrator (not Powershell)
    • Run sc create MqttPcHeartbeatMonitor binPath=C:\Path\To\EXE start=auto
    • Run sc start MqttPcHeartbeatMonitor
  3. Check Services to see if MqttPcHeartbeatMonitor is still running
    • In the Windows Search bar, type "services"
    • Find MqttPcHeartbeatMonitor, check that the "Status" says running
    • If it's not, please perform the following:
      • Open Event viewer
      • Find an Error entry
      • Create an issue in the GitHub repository. Copy and paste the event as well as your configuration (remove password)

Home Assistant Configuration

Open config file and enter the following

# Example configuration.yaml entry
sensor:
  - platform: mqtt
    state_topic: "{computer-name}/idlestatus"

TODO

  • Fix message to retrieve from config.json rather than computer name.
  • Create an installer
  • Create a WinForms project to make creating configuration easier
  • Monitor Video status of computer (Check if computer is watching a video)

About

MQTT idle monitor for Windows. Runs as a service.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages