Monitor state of integrations via events

Is it possible to monitor the state of an integration via events? I have an integration that needs to be periodically reconfigured (credentials re-entered). When this happens, there is a notification in Home Assistant, but I’m looking to make this more visible, and wanted to see if I could trigger something through a NodeRed flow when this happens. I’m not seeing an obvious event that I could monitor to trigger this and was wondering if anyone has suggestions.

Does this help?

[{"id":"65da156e.47b3ec","type":"server-events","z":"3a44d3fc.6dcf5c","g":"1717f62f.25eaea","name":"","server":"","version":1,"event_type":"call_service","exposeToHomeAssistant":false,"haConfig":[{"property":"name","value":""},{"property":"icon","value":""}],"waitForRunning":true,"outputProperties":[{"property":"payload","propertyType":"msg","value":"","valueType":"eventData"},{"property":"topic","propertyType":"msg","value":"$outputData(\"eventData\").event_type","valueType":"jsonata"},{"property":"event_type","propertyType":"msg","value":"$outputData(\"eventData\").event_type","valueType":"jsonata"}],"x":130,"y":780,"wires":[["a30b9790.6ea5f8"]]},{"id":"a30b9790.6ea5f8","type":"switch","z":"3a44d3fc.6dcf5c","g":"1717f62f.25eaea","name":"","property":"payload.event.domain","propertyType":"msg","rules":[{"t":"eq","v":"persistent_notification","vt":"str"}],"checkall":"true","repair":false,"outputs":1,"x":255,"y":780,"wires":[["35cea3e7.08b60c"]],"l":false},{"id":"35cea3e7.08b60c","type":"switch","z":"3a44d3fc.6dcf5c","g":"1717f62f.25eaea","name":"","property":"payload.event.service","propertyType":"msg","rules":[{"t":"eq","v":"create","vt":"str"}],"checkall":"true","repair":false,"outputs":1,"x":305,"y":780,"wires":[["3c97dab1.14e146","47a488bb.da7bd8"]],"l":false}]

Thanks! That looks like it will give me an event when a persistent notification is created, which I should be able to key off of. Much appreciated.

1 Like

In case it helps anyone else, I adjusted this slightly and wrapped it up into a sub-flow. This gives me a node I can use as an input to other flows that outputs a message with a couple custom properties I can key off of (notification_title and notification_message).

In another flow, I then have this as an input into a switch, which checks the notification_title property and based on what it matches, I can choose actions to take (in my case, firing off a push notification).

[{"id":"dbf78f11.c9b96","type":"subflow","name":"HA Notification","info":"","category":"","in":[],"out":[{"x":680,"y":80,"wires":[{"id":"c8fa6cea.53417","port":0}]}],"env":[],"meta":{},"color":"#DDAA99"},{"id":"2e361328.9590e4","type":"server-events","z":"dbf78f11.c9b96","name":"","server":"a5d031c4.58d358","event_type":"call_service","exposeToHomeAssistant":false,"haConfig":[{"property":"name","value":""},{"property":"icon","value":""}],"waitForRunning":true,"x":190,"y":80,"wires":[["cde9d723.79702"]]},{"id":"cde9d723.79702","type":"switch","z":"dbf78f11.c9b96","name":"","property":"payload.event.domain","propertyType":"msg","rules":[{"t":"eq","v":"persistent_notification","vt":"str"}],"checkall":"true","repair":false,"outputs":1,"x":335,"y":80,"wires":[["13528c80.7cf5c4"]],"l":false},{"id":"13528c80.7cf5c4","type":"switch","z":"dbf78f11.c9b96","name":"","property":"payload.event.service","propertyType":"msg","rules":[{"t":"eq","v":"create","vt":"str"}],"checkall":"true","repair":false,"outputs":1,"x":395,"y":80,"wires":[["c8fa6cea.53417"]],"l":false},{"id":"c8fa6cea.53417","type":"function","z":"dbf78f11.c9b96","name":"Replace message","func":"return {\n    'payload': 'Persistent notification',\n    'notification_title': msg.payload.event.service_data.title,\n    'notification_message': msg.payload.event.service_data.message\n}","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":530,"y":80,"wires":[[]]}]