You can use this custom component, or use the ping binary sensor. I prefer the first, because you could also control the volume and channels.