Visibility of non-group devices

Is it possible to hide individual entities programatically? I want to use automations to hide my media players when they aren’t playing, but show the controls for any that are, is this possible without putting each in it’s own group?