Camera stream switch

Hello,
is it possible to turn on/off camera stream based on camera status/switch/automation/whatever?
Currently I’m using rtsp stream with Yi Home Camera (despite lag, it’s workign fine). The problem is thtat camera itself isn’t always on, and when it’s off phisically, error: Stream connection failed: rtsp://192.168.xx.xxx/xxxxx is flooding my log. Is it possible to turn off stream when I’m turning off the camera so it won’t spam those errors?