button-card icon indicating copy to clipboard operation
button-card copied to clipboard

Button Card reporting wrong state

Open Rayeliint opened this issue 2 years ago • 5 comments

Checklist

  • [ y] I updated the card to the latest version available
  • [ y] I cleared the cache of my browser

Describe the bug Button card is displaying the wrong state . Light group turned, then turned off by automation, not reflected in the front end and still displays on

Version of the card Version: 3.4.2

To Reproduce

type: custom:button-card
icon: mdi:pool
state:
  - value: 'on'
styles:
  card:
    - height: 70px
    - border-radius: 10%
    - background-color: '#727171'
  name:
    - color: white
    - font-size: 13px
  icon:
    - color: >
        [[[ if (entity.state === 'on') return 'green';  if (entity.state ===
        'off') return 'orange';  else return 'red'; ]]]
tap_action:
  action: toggle
show_state: false
entity: group.pool_area
name: POOL AREA

This is the configuration I used:


Screenshots If applicable, add screenshots to help explain your problem.

Expected behavior A clear and concise description of what you expected to happen.

Desktop (please complete the following information):

  • Browser [e.g. chrome, safari]Chrome v98.0.4758.80
  • Version [e.g. 22]

Smartphone (please complete the following information):

  • Device: [e.g. iPhone6] Samsung S21 Ultra
  • OS: [e.g. iOS8.1] Android 12
  • Browser [e.g. stock browser, safari] Using the Home assistant android app
  • Version [e.g. 22]

Additional context Add any other context about the problem here.

Rayeliint avatar Feb 10 '22 06:02 Rayeliint

Please format your config using code blocks so I can have a look.

RomRider avatar Feb 10 '22 07:02 RomRider

same issue here, entity.state not working in color and other conditions.

thanks

ohipe avatar Feb 10 '22 22:02 ohipe

color doesn't support templates

RomRider avatar Feb 11 '22 08:02 RomRider

@RomRider

Sorry, I'm a bit confused... I've used templates for icon and name colors since the beginning, it's surprising to read this comment! After 2022.2 upgrade entity.state is not working correctly anymore as condition, this is the issue here.

Thanks

ohipe avatar Feb 11 '22 10:02 ohipe

Given your code was not formatted, I didn't see that you where templating color inside the styles part (which is supported). Why do you have this:

state:
  - value: 'on'

in your code? It's useless

RomRider avatar Mar 15 '22 19:03 RomRider