From 2dd00f2922ac620b346ab41234378c31ca20ac78 Mon Sep 17 00:00:00 2001 From: amadeo-alex <68441479+amadeo-alex@users.noreply.github.com> Date: Fri, 4 Oct 2024 20:09:58 +0200 Subject: [PATCH] Fix: SetVolumeCommand ignoring payload --- .../Commands/InternalCommands/SetVolumeCommand.cs | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/HASS.Agent/HASS.Agent.Shared/HomeAssistant/Commands/InternalCommands/SetVolumeCommand.cs b/src/HASS.Agent/HASS.Agent.Shared/HomeAssistant/Commands/InternalCommands/SetVolumeCommand.cs index dccacc8..f5a5301 100644 --- a/src/HASS.Agent/HASS.Agent.Shared/HomeAssistant/Commands/InternalCommands/SetVolumeCommand.cs +++ b/src/HASS.Agent/HASS.Agent.Shared/HomeAssistant/Commands/InternalCommands/SetVolumeCommand.cs @@ -70,15 +70,16 @@ public override void TurnOnWithAction(string action) try { - var parsed = int.TryParse(action, out var volumeInt); + var parsed = float.TryParse(action, out var volumeFloat); if (!parsed) { Log.Error("[SETVOLUME] [{name}] Unable to trigger command, the provided action value can't be parsed: {val}", EntityName, action); return; } - - AudioManager.SetDefaultDeviceProperties(DeviceType.Output, DeviceRole.Multimedia | DeviceRole.Console, _volume, null); + + var volumeInt = (int)Math.Ceiling(volumeFloat); + AudioManager.SetDefaultDeviceProperties(DeviceType.Output, DeviceRole.Multimedia | DeviceRole.Console, volumeInt, null); } catch (Exception ex) {