LAB02-Research / HASS.Agent

Windows-based client for Home Assistant. Provides notifications, quick actions, commands, sensors and more.
https://hassagent.lab02-research.org
MIT License
1.6k stars 74 forks source link

Bug: After defining multiple SetVolume commands only the last one works #363

Open Boeboey opened 1 year ago

Boeboey commented 1 year ago

First of all: HASS.Agent is an amazing tool!!!

Now I would like to use it to create several buttons to set the volume of Windows on different levels. So I created multiple commands "SetVolume" with a different parameter: 100, 75, 50, 25 and 0. After storing and activating these commands, they appear in my Home Assistant.

But no matter which button I press (100, 75, 50, 25 or 0), the volume always goes to 0, the last command entered. If I remove the "SetVolume to 0" command and 25 is the last one, windows always goes to volume 25.

Is a workaround possible to create 1 action with the volume as a parameter?

amadeo-alex commented 1 year ago

Hello, I'll try to reproduce and track down the issue you're mentioning, in the meantime yes, the better way to to this is to create a "SetVolume" command without specifying the volume in the UI. This will allow you then to call for example:

service: mqtt.publish
data:
  topic: homeassistant/button/AMADEO-PC/setvolume/action
  payload: 49

to set volume to the desired level.

edit: replicated with

  {
    "Id": "0b128ced-6d7f-4a87-b9d5-1b478b6d953c",
    "FriendlyName": "setvolume49",
    "Name": "setvolume49",
    "Type": "SetVolumeCommand",
    "EntityType": "button",
    "Command": "49",
    "KeyCode": 0,
    "RunAsLowIntegrity": false,
    "Keys": []
  },
  {
    "Id": "3873e408-56da-4707-a4f6-b8aa7e74ba9a",
    "FriendlyName": "setvolume60",
    "Name": "setvolume60",
    "Type": "SetVolumeCommand",
    "EntityType": "button",
    "Command": "60",
    "KeyCode": 0,
    "RunAsLowIntegrity": false,
    "Keys": []
  },
  {
    "Id": "34d2ba08-6f07-4808-bdac-a53319dc4d2d",
    "FriendlyName": "setvolume0",
    "Name": "setvolume0",
    "Type": "SetVolumeCommand",
    "EntityType": "button",
    "Command": "0",
    "KeyCode": 0,
    "RunAsLowIntegrity": false,
    "Keys": []
  }
Boeboey commented 1 year ago

Thanks amadeo-alex for your suggestion about the action. That solution is working fine for me!