Developer Tools/Listening to events of specific entity

I probably just miss something totally obvious, but for the life of me I can’t find how to listen to events (state_changed in my case) for a specific entity only in developer tools/events. Last time I did that (a while ago) the UI still had an entity selection on top, but now it no longer has something like that.
Doing it for all is totally pointless, as I am flooded with such events from the vast amount of entities in my setup as soon as I start listening.

I don’t recall it ever offered the ability to listen for events affecting only a specific entity. It only offers to listen for a specific event. If you choose the state_change event, it affects many entities.

Do you remember which version let you choose the entity as well?

Honestly: no, I don’t remember. And maybe I was just dreaming…
But I once wrote an automation for an Ikea Symfonisk volume control (like a year ago…), and I am pretty sure I observed the concrete eventing behaviour at that time listening to the emitted events of just this very device.

Are you certain you were listening for state_change events and not the events reported by whichever Zigbee integration you are using for the Symfonisk volume controller (like zha_event)? The available blueprints for the Symfonisk volume controller all listen for these integration-specific events (not state_change).

Regardless of the answer, what you are asking for isn’t currently available.

Hi All,
The list (overview?) of active listeners isn’t complete. There are several other event types that I can listen to, which are not in this list. And if I make a typo or just types in something gibberish like stars_stripes_event and click start listening, it makes no effort to check if that is a valid event or not. Where/how can I find a list/overview of all valid events that can be listened to?

Because custom events are supported.

Reference

Fire an event

Developer Tools > Events > Active listeners

Developer Tools > Events > Active Listeners doesn’t show everything. As an example I can type netatmo_event and click Start listening ad it will show all webhook events fro my Netatmo camera, but this option (event) is not listed in the Active Listeners list. So clearly this list isn’t complete.

I suggest you contact the author of the Netatmo integration.


In my case, I see event listeners for the following integrations (in addition to the standard set of event listeners for all Core-related things):

  1. Philips Hue
  2. Nanoleaf
  3. UPB

Plus an event listener for the Nodered add-on.

You misunderstand. My Netatmo events work perfectly. I just mentioned it as an example of an unlisted, but available event type. I also have Node Red integration installed, but it’s not in my list. What is the syntax you’d use for listening to Node Red?

If it works perfectly why doesn’t it display its event listener in the list like the three integrations I listed above? Plus, as mentioned, Nodered does appear in my list of event listeners (I have it installed as an Add-on).

So at least for me, it appears that the list is accurate; however for you, not so much.

I think perhaps this is a limitiation (or bug) in the docker version of HA.
I have two HA instances, one is docker based and the other is Supervised.
In the Supervised instance NodeRed is installed as an add-on and the event handler is listed, but in the container instance NodeRed event is not listed. (just as my Netatmo handler isn’t listed).
But contrary to Netatmo (which does work well even if not being listed), typing nodered_event and click Start Listening, does nothing.

Even if it somehow made sense that the integrations are somehow responsible for Home Assistant failing to show the events, I would still consider it Home Assistant’s failure to allow integrations to be configured in this (apparently) have broken state.

It’s frankly a system of the entire Home Assistant project. I love the tool sometimes, I think there is a ton of potential. But I wish it would “grow up” a bit.

“It works on my machine” is indicative of a junior level engineer. That’s what Home Assistant is right now, really really powerful software which has the quality, reliability, and usability of something a summer intern wrote. I wish the devs would prioritize “making existing capabilities actually usable in practice” rather than constantly dumping in new features. Sure, it’s a lot harder and not as fun. And the software is free, so who am I to complain.

But it’s kind of a waste because after the initial “wow this an do a ton of stuff” factor wears off, you realize that the stuff that’s here just doesn’t actually work very well. If this is supposed to be a self-sustaining product, this is NOT how you do it. They’re running off pure goodwill because while Home Assistant is by far the most power and flexible home automation tool (and I hate to say this), it absolutely fails hard at the most basic functionality. So often it should be kind of embarrassing, since I assume some people actually care about this project.

And listen, if you say “well it works on my machine”, please refer to my previous statement. Getting it working once is something any junior with ChatGPT can do nowadays. But these aren’t junior devs and I hope I’m not stepping out of bounds by expecting a little bit more than “it worked on Tony’s machine, ship it!”

I just spent 2 hours digging into the internals of zigbee-herdsman, the HA event system, the debugging tools, logging, I have a Jupyter notebook running a custom kernel to test stuff. I’m not new at this. And after 2 hours trying to get a Zigbee button to turn off my stereo, I’m not any closer. The zigbee button is in zigbee2mqtt and properly publishing its payload to Mosquito, verified via MQTT Explorer. The switchbot for the stereo is already in use in other automations and works fine.

OK sure maybe I’m just terrible at debugging, despite all evidence. But this is not a one off situation. The built in blueprint for a motion activated light is non-functional. When I tried to set up an automation for an NFC tag to send a notification to the device that scanned it, oops, that’s simply not possible without hacking around Home Assistant itself. So while it’s cool I can write code to do integrate with any random device, it is starting to get a bit old that the stuff that should be a 5 minute one-and-done-and-works-forever type configuration eats up an entire afternoon. What a waste of time.

The thing is, I do greatly respect the devs, and love this project. I’ve invested a lot of time in it and written a lot of code for it. If the project completely sucked I’d just move on. But it is so close to being amazing that I can’t help but care.

If you think something is broken, report it as an Issue in Home Assistant’s Github repo. Or, if you have the requisite software development skills, submit a Pull Request.

Because a complaint, in a topic that’s been dead for two years, won’t get it fixed.

2 Likes

Then the issue is very unlikely to be with zigbee-herdsman.
Considering there are thousands running Z2M happily, that is definitely something specific to you.

Are you actually looking for help on the issue? I personally have 2-3 zigbee buttons working pretty well (considering they are el cheapo ali products).

You have the device id of the mobile app in the tag scanning event

and you can send a notification by device id:

            - device_id: !input notify_device
              domain: mobile_app
              type: notify

Now, if you’re complaining that it’s not out-of-the-box, I agree, but you definitely don’t have to hack HA to achieve this.

If you see the button pressed in MQTT Explorer, how difficult can it be to add that to a MQTT trigger ?

Yes, z2m is a fantastic piece of software and has been very reliable for me. Thank you so much. I didn’t mean to imply it was the source of the issue, I was only laying out the steps I had taken to debug it as a means of illustrating the absolute insanity it can be to debug HA sometimes. I was frustrated and I probably shouldn’t have posted it here. I apologize if you or anyone else feels it was criticism directed at them. HA is an ecosystem and it is what it is. I’m grateful for it. And grateful for your help.

I got to the point of “everything looks good up until HA, and now HA should be taking this MQTT message and firing an event when the button is pressed”. But I’m just not seeing any event, which is what brought me to this thread.

I got a little frustrated seeing OP asking for help only to be told “well it works for me, you must be doing something wrong”. I have worked in tech for 20 years and I know users often ARE doing something wrong. But good tools will make it easy to do the right thing, and great tools will make it impossible (go ahead try to break the software on an iPhone). Anyway that’s beside the point and not worth spending another moment on.

As to my event, it’s no where to be found. It’s obviously not in the ‘events’ tab on the developer tools. I have the Jupyter Labs add-on set up with the Pyscript kernel which allows me to autocomplete entities. Here is what I’ve got for events in there (it’s none of these):

I have a Pyscript automation set up to dump my entities into text files on restart (so I can use them with AI coding tools), what I see there matches what I’m seeing in Pyscript.

The only entity I’m seeing for the switch is ‘sensor.music_switch_battery’. But it’s not clear to me whether the button events would show up as an ‘entity’ anyway (from what I understand they should be an ‘event entity’ but I could be mistaken).

Here’s the result of searching my entity files for the name of the switch (it’s ‘music_switch’):

% grep -r 'music_switch' .
./sensor_entities.txt:sensor.music_switch_battery

Here is some possibly relevant info:




Don’t feel obligated to dig in or anything but maybe you have an idea of what to try next. I do have a 2nd switch of the same type so maybe I’ll try that one and see if I have better luck.

Personally I prefer to keep things consistent and not have one-offs that behave differently than everything else in my system, but thank you for the suggestion, I hadn’t thought of that. That is indeed an option.

I’ve been attempting to follow HA’s ‘standard’ workflows and documentation but maybe that’s the problem. Do you just kind of try various options until one of them works? Or do you use MQTT triggers on everything by default? I’m curious as to how other people manage this stuff because clearly I’m sucking at it.

and you can send a notification by device id:

This was the critical missing piece! Everything in the docs made it sound like I needed the entity id for the notifier (and silly me didn’t even try the device id)! Hallelujah!

Hacking was maybe a bit hyperbolic, but there is no built in way to translate the device id to an entity id which is the crux of the issue in this case.

THANK YOU!!! :bowing_woman: :bowing_woman: :bowing_woman:
Crossing my fingers, it should just be a 10 minute job to get this set up! :sweat_smile:

As 90% of my hardware is integrated through MQTT (Zigbee2MQTT, Tasmota, EspRFLink, OpenMQTTGateway, …) I use MQTT triggers quite a lot.

Makes sense. I’ve never used one, I have used Home Assistant state triggers (motion sensor goes off, do X. temp in freezer rises above Y, send a notification).

So do you use Home Assistant’s built-in automation system? Something else? I’m just curious (I use Pyscript myself for pretty much everything, that also supports mqtt triggers). Hopefully it will save some time as maybe I won’t have to try so many things that don’t work this way. I appreciate your help and I will take as much information as you’re willing to provide.