How to determine device protocol

I have some Z-Wave devices that occasionally become unavailable, but return once you ping them they come back online. I’ve built an automation that periodically looks for devices that are unavailable and then pings them so they are working again. This is working well, except I also have some other non-Z-Wave devices which also go offline that are triggering the automation repeatedly. I’ve been looking around and don’t find anything, but is there a way to for an automation to determine what protocol a device uses so I can either filter them out, or perhaps run a different sequence based on the appropriate protocol?