From 3eb372d95aaeea43f2777958ee33218b0c62cd87 Mon Sep 17 00:00:00 2001 From: pedzp14 <40949172+pedzp14@users.noreply.github.com> Date: Wed, 20 Aug 2025 21:23:03 +1000 Subject: [PATCH 1/2] feat: require windows 11 for media player --- README.md | 9 +++++---- src/HASS.Agent/Media/MediaManager.cs | 11 +++++++++-- 2 files changed, 14 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index 7aa49fd..5ff69a2 100644 --- a/README.md +++ b/README.md @@ -84,10 +84,11 @@ Summary of the core functions: * **Notifications**: receive notifications, show them using Windows builtin toast popups, and optionally attach images. Supports *actionable notifications*: add buttons so you can easily interact with Home Assistant, without having to open anything. - *This requires the installation of the [HASS.Agent integration](https://github.com/LAB02-Research/HASS.Agent-Integration)*. -* **Media Player**: use HASS.Agent as a mediaplayer device: see and control what's playing and send text-to-speech. - - *This requires the installation of the [HASS.Agent integration](https://github.com/LAB02-Research/HASS.Agent-Integration)*. - -* **Quick Actions**: use a keyboard shortcut to quickly pull up a command interface, through which you can control Home Assistant entities - or, assign a keyboard shortcut to individual Quick Actions for even faster triggering. +* **Media Player**: use HASS.Agent as a mediaplayer device: see and control what's playing and send text-to-speech. + - *This requires the installation of the [HASS.Agent integration](https://github.com/LAB02-Research/HASS.Agent-Integration)*. + - *Requires Windows 11 or later.* + +* **Quick Actions**: use a keyboard shortcut to quickly pull up a command interface, through which you can control Home Assistant entities - or, assign a keyboard shortcut to individual Quick Actions for even faster triggering. * **Commands** (currently **24**): control your PC (or other Windows based device) through Home Assistant using custom- or built-in commands. diff --git a/src/HASS.Agent/Media/MediaManager.cs b/src/HASS.Agent/Media/MediaManager.cs index 958d7d3..d8e974e 100644 --- a/src/HASS.Agent/Media/MediaManager.cs +++ b/src/HASS.Agent/Media/MediaManager.cs @@ -1,4 +1,5 @@ -using System.IO; +using System; +using System.IO; using System.Text.Json; using Windows.Media.Control; using Windows.Media.Playback; @@ -46,7 +47,13 @@ internal static async Task InitializeAsync() } // try to initialize and prepare Windows' mediaplayer platform - // todo: optional, but add an OS check - not all OSs support this + if (!OperatingSystem.IsWindowsVersionAtLeast(10, 0, 22000)) + { + Log.Warning("[MEDIA] Windows 11 or later is required, disabling media player component"); + Variables.AppSettings.MediaPlayerEnabled = false; + return; + } + try { // create the objects From a512eb0f84dc72e3f69f3ae29d776e8bf0dbd866 Mon Sep 17 00:00:00 2001 From: pedzp14 <40949172+pedzp14@users.noreply.github.com> Date: Wed, 20 Aug 2025 21:50:25 +1000 Subject: [PATCH 2/2] Create dotnet.yml --- .github/workflows/dotnet.yml | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 .github/workflows/dotnet.yml diff --git a/.github/workflows/dotnet.yml b/.github/workflows/dotnet.yml new file mode 100644 index 0000000..217f7cb --- /dev/null +++ b/.github/workflows/dotnet.yml @@ -0,0 +1,28 @@ +# This workflow will build a .NET project +# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-net + +name: .NET + +on: + push: + branches: [ "main" ] + pull_request: + branches: [ "main" ] + +jobs: + build: + + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v4 + - name: Setup .NET + uses: actions/setup-dotnet@v4 + with: + dotnet-version: 8.0.x + - name: Restore dependencies + run: dotnet restore + - name: Build + run: dotnet build --no-restore + - name: Test + run: dotnet test --no-build --verbosity normal