Persistent HomeKit notification with ping integrations

Tags: #<Tag:0x00007f326504aaa8> #<Tag:0x00007f326504a878>

Hello, I’m trying to check online/offline status of a Yi Camera pinging it.
Mqtt is not useful in this case, in case someone cut the power off (The room which the camera is in) the mqtt will message is not sent.
So pinging the Yi IP gives me what I’m looking for, notification if device loses connection = not powered on.
I was looking for a way to save the last state and send a notification only if the state change, not every time the ping is sent (10 seconds).
Can anybody help?