Toggle wall plug when ping on router is not returning how to

Home assistant on PI - I did a simple automation to toggle zigbee wall plug when ping on router is not_home ie not returning. But when I disconnect router the home assistant start crashing until I put the router back on.

No automation is performed during this internet blackout. How is it possible? How to make it work please?