HASS.Agent icon indicating copy to clipboard operation
HASS.Agent copied to clipboard

Bug: "Key" commands end up with key being "held down"

Open addrum opened this issue 1 year ago • 9 comments

Describe the bug I'm using the button entity created by a "key" command in HASS Agent on a Home Assistant dashboard. When I press said button it sends they key command correctly however it then appears to be continually sending it, almost like holding the key down on a real keyboard. Not 100% sure if this is a Home Assistant issue or not but I don't have issues with non HASS Agent Home Assistant buttons triggering more than once so I think it's something here.

To Reproduce Steps to reproduce the behavior:

  1. Add a "key" command with the "button" entity type
  2. Add the button in Home Assistant to a dashboard
  3. Press the button on the dashboard

Expected behavior A single key press to happen per press of the button on the dashboard.

Screenshots If applicable, add screenshots to help explain your problem.

Misc info (please complete the following information):

  • Windows build (ideally screenshot/info of winver.exe output): image

  • Windows' UI language: English UK

  • HASS.Agent version: 2022.14.0

Please check what's applicable (multiple answers possible):

  • [x] Installed via installer
  • [ ] Installed manually
  • [x] Problem occurs in HASS.Agent
  • [ ] Problem occurs in Satellite Service

Additional context Add any other context about the problem here.

Logs If possible, please provide the logs of HASS.Agent and - if applicable - the Satellite Service. You can find HASS.Agent's logs by going to the main window, then Configuration -> Logging -> open logs folder. The Satellite Service's logs are in the same window, but the Satellite Service tab -> open service logs folder. If you want, you can mail them to [email protected]

addrum avatar Jul 04 '23 15:07 addrum

This is weirdly working in a notepad window but whenever I have steam big picture open and try to use it in a game it gets stuck 🤔

addrum avatar Jul 04 '23 15:07 addrum

Some logs :)

[2023-07-04] HASS.Agent_20230704.log

addrum avatar Jul 04 '23 15:07 addrum

I've been able to reproduce this on staging-main branch. Executing the command on notepad++ works as expected but doing the same with Steam BigPicture results in behaviour described by you. I wouldn't go (yet) so far as to say it's HASS.Agent's fault as it's using Windows API for key emulation but that's an improper behaviour nevertheless - I'll look into it.

amadeo-alex avatar Jul 05 '23 15:07 amadeo-alex

Yeah, looks like we're not doing it properly - missing "KEYEVENTF_KEYUP". Now that I think about it...I had some strange behaviour when trying to wake PC with windows key, thinking about it I should have connected the dots that this was the issue...

amadeo-alex avatar Jul 05 '23 15:07 amadeo-alex

Same problem here with media keys.

I've an automation running what sends a media player command when the mic is open for a webcall and always my 'Alt" key is stuck after the agent sends the command! Its very annoying!

service: media_player.media_stop data: {} target: entity_id: media_player.hassagent

Actually whatever media player command hass agent executes, alt key is always stuck and i need to press the alt 2-3 times to recover my keyboard.

sfortis avatar Jul 14 '23 11:07 sfortis

When can we expect this in a new version?

addrum avatar Sep 12 '23 15:09 addrum

+1

Dustinhoefer avatar Sep 16 '23 09:09 Dustinhoefer

Silly q, but wahts the easiest way for me to run the beta https://github.com/hass-agent/HASS.Agent/pull/1 since it says it fixes this problem?

AJolly avatar Feb 26 '24 17:02 AJolly

Silly q, but wahts the easiest way for me to run the beta https://github.com/hass-agent/HASS.Agent/pull/1 since it says it fixes this problem?

The issue you've linked is a different repo. If you to that repo and find the releases section you can grab the installer. I think there's some migration instructions in the readme to follow first though.

addrum avatar Feb 26 '24 18:02 addrum