Custom Button Card: Code to Display Value of Another Entity

I have a switch custom button card to toggle a fan: switch.office_fan

type: custom:button-card
entity: switch.office_fan
name: Off Fan
justify-self: start
show_state: true
icon: mdi:ceiling-fan
styles:
  card:
    - height: 75px
    - width: 61px
    - font-size: 12px
    - color: white

In the same button card, I would like to display the power of the fan in W from a separate sensor: sensor.office_fan_power.

Having gone through the Button Card documentation and many button card threads/examples. Have been unable to find an example which has the code to specify this additional entity, either as a custom_field or some other attribute, as almost all of the examples are very focused on style customisation.

Can anyone please help with the basic code to enable the display of the state of the power entity above, which I can use as a reference start point?

Any help would be much appreciated

Hi, Below I leave you an example of a button card with a custom field

type: custom:button-card
name: 'Temperatura en casa:'
show_name: false
entity: sensor.temperatura_media
custom_fields:
  temphum: >
    [[[ return states['sensor.temperatura_media'].state + '°C / ' +
    states['sensor.humedad_media'].state + '%']]]
styles:
  grid:
    - grid-template-areas: '"i temphum"'
    - grid-template-columns: min-content min-content min-content
    - grid-template-rows: min-content
  card:
    - margin-right: 0.7vw
    - border-radius: 50px
    - padding: 0px 8vw 0px 0px
    - height: 3.2vw
    - width: 13vw
  icon:
    - width: 1.8vw
    - color: black
    - padding: 0
  img_cell:
    - background: '#C1D8C3'
    - border-radius: 200px
    - width: 3.2vw
    - height: 3.2vw
  custom_fields:
    temphum:
      - justify-self: start
      - font-size: 1.2vw
      - opacity: '0.7'
      - padding-left: 0.8vw

basically you need:

custom_fields:
  temphum: >
    [[[ return states['sensor.temperatura_media'].state + '°C / ' +
    states['sensor.humedad_media'].state + '%']]]

and the style for the custom field

  custom_fields:
    temphum:
      - justify-self: start
      - font-size: 1.2vw
      - opacity: '0.7'
      - padding-left: 0.8vw

Many thanks for your help! Have tried the code and it works. I solved the problem of getting the 2nd entity value into the card, but it opened up more config to do as the 2nd entity changes the formatting of the entire card …