Companion App vs Web Browser Differentiation

Hey guys,

Is there a simple way to determine whether or not I am viewing Home Assistant from the mobile companion app or within a standard browser?

Or if not, is there a way that I can use a “Conditional” card that will display a different card depending on the screen resolution?

I am trying to implement the “picture-elements” card so that if in my browser it displays a horizonal image, but if on my app it displays it as vertical (This is not just image specific the card entities also need to adjust for a horizontal vs vertical layout, that’s why I was thinking the conditional card could work)

Regards,

the companion app has an App Importance sensor…when the app is in active use the state will be foreground

https://companion.home-assistant.io/docs/core/sensors#app-importance-sensor

1 Like

Thank you soo much @dshokouhi, that seems to have done the trick :grinning:

One day I’ll look into creating a plugin for conditional cards based on screen width.

Is this possible on iOS, seems there is a difference in the available sensors.