pvprodk / HA-seplos-bms

Home Assistant Dashboard for BMS'es
4 stars 1 forks source link

multiple sensor value in one button #1

Open FritsOV opened 2 months ago

FritsOV commented 2 months ago

First of all what a great lovelace did you make! I am trying to get multiple sensors in one button, as in the first picture, to work but with no luck. How did you manage to get min. and max values in one button? Could you help me get started?

regards, Frits

pvprodk commented 2 months ago

Thank you.

Here is an example

type: custom:button-card
name: Cell Voltage Delta
size: 25%
entity: sensor.seplos_battery_bank_0_delta_cell_voltage
show_icon: true
show_name: true
show_state: false
show_label: true
label: >
  [[[ return 'Pack 0: ' +
  Number.parseFloat(states['sensor.seplos_battery_bank_0_delta_cell_voltage'].state).toFixed(3)
  + ' V<br>Pack 1: ' +
  Number.parseFloat(states['sensor.seplos_battery_bank_1_delta_cell_voltage'].state).toFixed(3)
  + ' V' ]]]
icon: mdi:delta
styles:
  icon:
    - color: |
        [[[
          if (entity.state < 0.010) return 'darkgreen';
          if (entity.state < 0.020) return 'darkorange';
          else return 'red';
        ]]]
  card:
    - font-size: 12px
FritsOV commented 2 months ago

Thank you veert Michael for your help!  Works great! Op 12 apr 2024 om 00:00 heeft Jonas @.***> het volgende geschreven: Thank you. Here is an example type: custom:button-card name: Cell Voltage Delta size: 25% entity: sensor.seplos_battery_bank_0_delta_cell_voltage show_icon: true show_name: true show_state: false show_label: true label: > [[[ return 'Pack 0: ' + Number.parseFloat(states['sensor.seplos_battery_bank_0_delta_cell_voltage'].state).toFixed(3)

—Reply to this email directly, view it on GitHub, or unsubscribe.You are receiving this because you authored the thread.Message ID: @.***>

FritsOV commented 2 months ago

can i ask you one more time for help of a pointer? sorry if the code is not parsed correctly i put it in code quotes.

In the Delta function the label is: ''' ` label: > [[[ return 'Pack 0: ' + Number.parseFloat(states['sensor.battery0_delta_cell_voltage'].state).toFixed(3)

In stead of return 'pack 0: '+ i have a string sensor i.e. "sensor.victron_battery_system_maxvoltagecellid" witch give as result: Pack-0x# and of course there is a minimum sensor. How can i change the return 'pack 0: ' into returning the result of sensor maxvoltagecellid + the rest of the information witch is already there?