[SOLVED][OH3] oh-cell color issue

I’m trying to create a simple oh-cell item on my overview page to toggle a switch for a light on and off. I would like the cell to change colour to yellow when the item has state ON. I’ve used the UI to configure it and the YAML it generates is:

component: oh-cell
config:
  header: Dining room lamp
  title: Dining Room Lamp
  icon: f7:lightbulb
  color: yellow
  action: toggle
  actionItem: DiningRoomLamp_Power
  actionCommand: ON
  actionCommandAlt: OFF
slots: null

But the cell doesn’t change colour. What am I doing wrong? I’d appreciate any help please! I’m on 3.1.0.M3

There is a parameter for cells called on (in the UI configuration page, you need to click on Show advanced to see it. This parameter needs to evaluate to true for the cell background to have the color given in the color parameter. So, there are two typical setups:

  1. You can set on with an expression related to an item state which will result in a white cell when the item is off (or the expression is false) and color when the item is on (or the expression is true)
config:
  on: =(item[DiningRoomLamp_Power].state=="ON")
  1. You can just set on to true and then control the color of the cell with an expression in the color parameter which will give you the option of having the “off” color be something other than white.
config:
  on: true
  color: '=(item[DiningRoomLamp_Power].state=="ON") ? "green" : "red"'
1 Like

That works perfectly, thank you!