Skip to content

Commit

Permalink
Fix: SetVolumeCommand ignoring payload
Browse files Browse the repository at this point in the history
  • Loading branch information
amadeo-alex authored Oct 4, 2024
1 parent 197a2fc commit 2dd00f2
Showing 1 changed file with 4 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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)
{
Expand Down

0 comments on commit 2dd00f2

Please sign in to comment.