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

customize the stats

Open andybali opened this issue 3 years ago • 14 comments

Can you please add an example to customize the stats....I don´t get it work.

andybali avatar Aug 02 '21 05:08 andybali

Good point, I'll do that as soon as I find the time. Meanwhile, see i the guide at vacuum card helps you out (this card is forked from vacuum-card).

tmjo avatar Aug 03 '21 23:08 tmjo

This is what I have working with the Tesla integration.

type: custom:charger-card
entity: sensor.duka_charging_rate_sensor
chargerImage: Anthracite
compact_view: false
show_stats: o
stats:
  default:
    - entity_id: binary_sensor.duka_charger_sensor
      attribute: charging_state
      subtitle: State
    - entity_id: sensor.ev_power
      subtitle: Power
      unit: W
    - entity_id: sensor.duka_charging_rate_sensor
      attribute: charge_energy_added
      subtitle: Energy Added
      unit: kWh
    - entity_id: sensor.duka_charging_rate_sensor
      attribute: charger_actual_current
      subtitle: Actual Current
      unit: A
    - entity_id: sensor.duka_charging_rate_sensor
      attribute: charge_current_request
      subtitle: Requested Current
      unit: A

image

Some further discussion https://github.com/alandtse/tesla/issues/93

purcell-lab avatar Nov 19 '21 23:11 purcell-lab

Hi @purcell-lab; the card doesn't by default by default support anythign else but the Easee charger integration. I'll be working on implementing other chargers, but probably not car integrations, so I don't really understand your question? Please elaborate.

tmjo avatar Nov 19 '21 23:11 tmjo

Hi @purcell-lab; the card doesn't by default by default support anythign else but the Easee charger integration. I'll be working on implementing other chargers, but probably not car integrations, so I don't really understand your question? Please elaborate.

The Tesla integration has a lot of the attributes of a smart charger which are actual features from the car.

Thus using your charger-card it should be possible via the Tesla integration to start and stop charging, set various charging currents and set solar tracking for charging.

The example configuration above displays some Tesla statistics via your charger card; charging status, power, energy and current requested.

I have HA scripts that set charging to 8, 16, 32 Amps or solar tracking. Using your card I should be able to assign action buttons to call these scripts.

We just need to understand the structure the card configuration requires as per issue #6 or use a template to set up an entity with the Tesla attributes but in the easee structure for consumption by this card.

purcell-lab avatar Nov 20 '21 04:11 purcell-lab

Hi @purcell-lab; the card doesn't by default by default support anythign else but the Easee charger integration. I'll be working on implementing other chargers, but probably not car integrations, so I don't really understand your question? Please elaborate.

If you're open to suggestions, I might suggest that you generalize the interface a bit so that you don't have to write it for each charger but you can let the community help you. Many of your choices work for other chargers as long as we can have a mapping from your term.

I actually have a build of your card which allows me to override some of your built in constants with my own strings. It was a PoC but I can probably clean it up and submit it as a PR this weekend. I believe you have some hard coded items in other parts of the card that can't be overwritten by that method. But after you see my edits you may think of an easy way to generalize it.

alandtse avatar Nov 20 '21 12:11 alandtse

Sounds good, always open for suggestions. I made the card specifically for Easee, but I was hoping to find time to generalize it and make it more flexible. This time never appeared, but feel free to make a PR. There was some proposals in a different issue as well, for instance making an template sensor.

tmjo avatar Nov 20 '21 18:11 tmjo

I actually have a build of your card which allows me to override some of your built in constants with my own strings. It was a PoC but I can probably clean it up and submit it as a PR this weekend. I believe you have some hard coded items in other parts of the card that can't be overwritten by that method. But after you see my edits you may think of an easy way to generalize it.

@alandtse, I would be interested in this. I couldn't see a fork on github so I'll await your PR.

purcell-lab avatar Nov 21 '21 03:11 purcell-lab

I actually have a build of your card which allows me to override some of your built in constants with my own strings. It was a PoC but I can probably clean it up and submit it as a PR this weekend. I believe you have some hard coded items in other parts of the card that can't be overwritten by that method. But after you see my edits you may think of an easy way to generalize it.

@alandtse, I would be interested in this. I couldn't see a fork on github so I'll await your PR.

It's just a work in progress. https://github.com/alandtse/charger-card/tree/override. You have to know the constants in the code, but you override with a root yaml block. Please note, you need the subblock entity_id to do an entity override. attribute will let you specify an attribute.

Icons also need to be overridden too.

override:
  CURRENTLIMITS:
    - 8
    - 10
    - 16
    - 20
    - 25
    - 32
  CHARGERDOMAIN: tesla
  STANDBY_1: Disconnected
  PAUSED_2: awaiting_start
  CHARGING_3: 'On'
  READY_4: Complete
  ERROR_5: error
  CONNECTED_6: ready_to_charge
  cableLocked:
    entity_id: lock.everest_charger_door_lock
  cableLockedPermanently: switch.cable_locked_permanently
  basicSchedule: true
  circuitCurrent: sensor.circuit_current
  costPerKwh: sensor.cost_per_kwh
  dynamicChargerCurrent: sensor.dynamic_charger_limit
  dynamicCircuitCurrent: sensor.dynamic_circuit_limit
  enableIdleCurrent: switch.enable_idle_current
  inCurrent:
    entity_id: sensor.eva_charging_rate_sensor
    attribute: charger_actual_current
  isEnabled: switch.everest_charger_switch
  maxChargerCurrent:
    entity_id: sensor.eva_charging_rate_sensor
    attribute: charge_current_request
  maxCircuitCurrent: 32
  offlineCircuitCurrent: 32
  isOnline:
    entity_id: binary_sensor.everest_online_sensor
  outputCurrent: sensor.output_limit
  reasonForNoCurrent: sensor.reason_for_no_current
  sessionEnergy:
    entity_id: sensor.eva_charging_rate_sensor
    attribute: charge_energy_added
  energyPerHour:
    entity_id: sensor.everest_charging_rate_sensor
  energyLifetime: sensor.lifetime_energy
  smartCharging:
    entity_id: switch.everest_maxrange_switch
  totalPower:
    entity_id: sensor.everest_charging_rate_sensor
    attribute: charger_power
  updateAvailable: binary_sensor.everest_update_available_sensor
  voltage:
    entity_id: sensor.everest_charging_rate_sensor
    attribute: charger_voltage
  chargerMaxCurrent: set_charger_max_limit
  chargerDynCurrent: set_charger_dynamic_limit
  circuitMaxCurrent: set_charger_circuit_max_limit
  circuitDynCurrent: set_charger_circuit_dynamic_limit
  circuitOfflineCurrent: set_charger_circuit_offline_limit

alandtse avatar Nov 22 '21 01:11 alandtse

@alandtse ; Thank you! I did some work myself during the weekend, it is in an early phase, but I got it to work adding my wind sensor as power, so it should be flexible. UI should work, select "Other". It is available as a branch here if you want to play around. I see you did some more details about attributes and services, that is a good idea that I didn't work on just yet.

I'll be away some days travelling this week, so I won't have much time to look at it before next week.

tmjo avatar Nov 22 '21 07:11 tmjo

I did some work on making the card customizable, please see #19

It would be great if you could test my proposal and see if it fulfills your requests. For sure there are some bugs, kindly let me know or contribute if you feel for it.

tmjo avatar Dec 18 '21 00:12 tmjo

Awesome to hear. I'll try to take a look but going on holiday this weekend so may not really look at it till I get back.

@purcell-lab if you build a good template for Tesla, perhaps we can get it as a default template. Let me know if there's something missing on the integration side and I can see about exposing it.

alandtse avatar Dec 18 '21 01:12 alandtse

Thanks @alandtse. I hope this (with some corrections for sure) will fulfill the needs of everybody, and my goal is for sure to add several templates to make it easy for less experienced users to add the card - however, as you imply, I need input to get that right. I guess most integrations use a standardized entity name so that my method here could work. Take your time, there's no rush and I'm grateful for your contributions.

tmjo avatar Dec 18 '21 01:12 tmjo

@purcell-lab; if you could send me the default setup of a Tesla integration, I can try to make template that works for Tesla instead of needing to customize it case by case (I think that may be too complicated for most users).

tmjo avatar Dec 18 '21 01:12 tmjo

Finally had some time to get back to this with the beta release and now have something working with the onboard tesla charger control in the car. (Not the Tesla EVSE)

image

I have hard coded some sensors/ attributes and it would be useful to get some of the macro substitutions working with this, happy to work with you to create a tesla-car template.

type: custom:charger-card
entity: binary_sensor.duka_charger_sensor
customCardTheme: black
customImage: /local/tesla.png
details:
  name:
    entity_id: sensor.duka_vehicle_state_data_sensor
    attribute: vehicle_name
  location:
    entity_id: device_tracker.duka_location_tracker
  status:
    entity_id: binary_sensor.duka_charger_sensor
    attribute: charging_state
  substatus:
    entity_id: sensor.duka_charging_state_data_sensor
    attribute: charge_port_latch
  smartcharging:
    entity_id: binary_sensor.duka_charger_sensor
    attribute: fast_charger_type
  currentlimits:
    - 0
    - 1
    - 8
    - 16
  info_left:
    - entity_id: binary_sensor.duka_online_sensor
      attribute: state
  info_right:
    - entity_id: sensor.duka_battery_sensor
      icon: mdi:car-electric-outline
      unit: '%'
      unit_show: true
    - entity_id: sensor.duka_charging_rate_sensor
      attribute: charger_power
      text: Power
      unit_show: true
      unit: kW
      icon: mdi:lightning-bolt
    - entity_id: sensor.duka_charging_rate_sensor
      attribute: charger_voltage
      text: voltage
      unit: V
      unit_show: true
      icon: mdi:sine-wave
    - entity_id: sensor.duka_charging_rate_sensor
      attribute: charger_actual_current
      text: amp
      unit: A
      unit_show: true
      icon: mdi:current-ac
  stats:
    default:
      - entity_id: sensor.duka_charging_rate_sensor
        attribute: charger_power
        text: Power
        unit_show: true
        unit: kW
      - entity_id: sensor.duka_charging_rate_sensor
        attribute: charge_energy_added
        text: Energy Added
        unit_show: true
        unit: kWh
      - entity_id: sensor.duka_charging_rate_sensor
        attribute: charge_current_request
        text: Request
        unit: A
        unit_show: true
      - entity_id: sensor.duka_charging_rate_sensor
        attribute: charger_actual_current
        text: Actual
        unit: A
        unit_show: true
      - entity_id: switch.duka_charger_switch
        text: Charger Switch
  group2:
    - entity_id: sensor.duka_charging_rate_sensor
      attribute: charger_voltage
      text: voltage
      unit: V
      unit_show: true
    - entity_id: sensor.duka_charging_rate_sensor
      attribute: charger_actual_current
      text: amp
      unit: A
      unit_show: true
    - entity_id: sensor.duka_charging_rate_sensor
      attribute: charger_power
      text: Power
      unit_show: true
      unit: kW
    - entity_id: sensor.duka_charging_rate_sensor
      attribute: charge_energy_added
      text: Energy Added
      unit_show: true
      unit: kWh
    - entity_id: sensor.duka_charging_rate_sensor
      attribute: charge_current_request
      text: Request
      unit: A
      unit_show: true
    - entity_id: sensor.duka_charging_rate_sensor
      attribute: charger_actual_current
      text: Actual
      unit: A
      unit_show: true
    - entity_id: switch.duka_charger_switch
      text: Charger Switch
  toolbar_right:
    default:
      - service: script.tesla_charging_current_low
        text: Excess Solar Charging
        icon: mdi:solar-power
      - service: script.tesla_high
        text: 1A charging
        icon: mdi:lightning-bolt
      - service: script.tesla_16a
        text: 16A charging
        icon: mdi:lightning-bolt

purcell-lab avatar May 22 '22 05:05 purcell-lab

Closing old issue since card is now fully customizable, and I believe the advanced example illustrates how to do the configuration requested here.

tmjo avatar Jul 24 '23 20:07 tmjo