Change state/icon on Wyze Sensors

Is it possible to change the state/icon/color of a binary sensor? I have 2 Wyze Sense contact sensors used on a sliding door with a latch lock. One is used to check whether the door is closed and the second one is used to check whether it’s locked (i.e. the latch is in the lock position).

So the 2 sensors are used as follows:

  • Closed: Standard door icon (dynamic icon showing door open/closed). Status: Open/Closed
  • Locked: Lock icon (dynamic icon showing door locked/unlocked. Status: Locked/Unlocked

What about color change; i.e. red if unlocked?

You can apply a device class for a lock and a door using customize.

If you want the colour to be different than the active/inactive icon colour that can be applied globally with themes to every icon, you will have to use card- mod.

1 Like

Will give that a go

Was able to change the device class. So the lock is a lock and has the correct state. One tick :slight_smile:

What I can’t seem to figure out is how does the state affect the icon used; e.g. the open/closed door state changes the icon accordingly where as the lock icon stays the same despite the state changing from unlocked to locked.

what’s the domain on the lock and what did you use as a device class?

domain is binary_sensor and device_class is lock

then it should be working, clear your cache and update your page. CTRL+F5

Great. It was the cache. So how is the state to icon relationship determined?

on is one icon, off is another icon which is derived by the device_class.

Ok so if I wanted to override the default icons used for on/off I would specify this in the front end code editor and use different icons for each state?

if the device classes don’t provide the icons you want, then you have to adjust them in lovelace or use custom solutions.

1 Like

Ok will try this out

I made a list of all the device class icons here: