Easier way to catch events (than logs)

I think we need an easier way to catch events (than logs).

To catch events I do:

  1. Setup logger so that I get events - (usually just turn on full debug and try to catch event by filtering log)
  2. Restart HASS - (I am not sure if reloading config is enough, but would also be a step)
  3. Try to catch the event from the log and copy it somewhere
  4. Decipher the event from the log - (I am not sure if there there is notification that would make this easier?)
  5. Turn logging back to warning etc.
  6. Restart HASS

Any suggestion how to do this easier is welcome!

I have never tried it, but maybe this helps: https://www.home-assistant.io/developers/websocket_api/
If you don’t require authentication the JavaScript/HTML code that’s linked might already show what you need. Can’t test that though because I have authentication enabled and haven’t looked into adding authentication.

Edit: here’s a version that works with authentication: https://gist.github.com/danielperna84/83f6724ee3a646854c65451005684a4d
Seems pretty verbose to me, so I assume what you’re looking for is included even without changing the loglevel of HA and restarting.

Thanks!

This might take some items off the list! I have to test this…

Still using this needs some IT knowledge other than e.g. going into some tool in the side menu.

Resurrecting this topic. This looks like just what I need.

@danielperna84, should the version with authentication work using a long-lived access token instead of the old password authentication method? I tried simply pasting in a long-lived access token for api_password in line 25 without success. I’m unsure if/how to change the headers otherwise.

Thanks!

The old password has been deprecated for ages. So only the token should work (and maybe other authenticatoin methods).
But I’m no expert. I just pointed at the documentation of which I know exists. :man_shrugging: