Dealing with an uplugged Camera

Hi,

I have a camera in my house that is plugged into a smart plug. That plug is off when we are in, and on when the alarm is set. This works fine from a practical standpoint but throws constant errors in the log such as:

Stream connection failed: rtsp://192.168.1.xxx:554/s0
Connection to tcp://192.168.1.xxx:554?timeout=5000000 failed: Host is unreachable

Usually I’d be content to just ignore the error, but Im having memory issues with my setup and the memory spikes occur at the same time as those messages appear. Does anyone know a good / sensible way of dealing with a missing stream source?