custom-cards / button-card

❇️ Lovelace button-card for home assistant
MIT License
1.97k stars 242 forks source link

Units not display when overide state with state display #700

Closed Fredzxda closed 1 year ago

Fredzxda commented 1 year ago

When trying to change the state to display for a binary sensor by the temperature value of an other sensor, the units is not display. _- type: custom:button-card entity: binary_sensor.dhwp_actuator_energy_demand_status name: Cumulus state_display: > [[[ return states['sensor.dhwp_actuator_middle_water_temperature'].state; ]]] units: °C showunits: true

Mariusthvdb commented 1 year ago

that would seem the logical thing? using state_display you are overriding the state completely.

    - type: custom:button-card
      entity: person.marijn
      name: Cumulus
      state_display: >
        [[[
        return states['sensor.library_hygro_temp_temperature'].state + '°C';
        ]]]
#       units: °C
      show_state: true
#       show_units: true

also, you need to show_state: true, or the state is completely left out (including the unit for that state...)

please close, as is no bug, for further help, go to the community, these repo issues are for card issues/disfunctionality.

Fredzxda commented 1 year ago

Thank you. It is working fine.