I’m able to detect a restart event, but not a shutdown.
[{"id":"4354f120b055e552","type":"tab","label":"Flow 1","disabled":false,"info":"","env":[]},{"id":"35d84701e6ceb349","type":"server-events","z":"4354f120b055e552","name":"","server":"8be923df.d66f9","version":3,"exposeAsEntityConfig":"","eventType":"call_service","eventData":"","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":170,"y":80,"wires":[["aafdbac8704f6749"]]},{"id":"aafdbac8704f6749","type":"switch","z":"4354f120b055e552","name":"","property":"payload.event.service","propertyType":"msg","rules":[{"t":"eq","v":"restart","vt":"str"}],"checkall":"true","repair":false,"outputs":1,"x":330,"y":80,"wires":[["36411015d36a2c26"]]},{"id":"36411015d36a2c26","type":"debug","z":"4354f120b055e552","name":"debug 14","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":460,"y":80,"wires":[]},{"id":"8be923df.d66f9","type":"server","name":"homeassistant","version":5,"addon":true,"rejectUnauthorizedCerts":true,"ha_boolean":"","connectionDelay":false,"cacheJson":false,"heartbeat":false,"heartbeatInterval":"","areaSelector":"friendlyName","deviceSelector":"friendlyName","entitySelector":"friendlyName","statusSeparator":"at: ","statusYear":"hidden","statusMonth":"short","statusDay":"numeric","statusHourCycle":"h23","statusTimeFormat":"h:m","enableGlobalContextStore":true}]