tmjo / charger-card

A lovelace card for electrical vehicle (EV) home chargers and charging robots.
MIT License
89 stars 59 forks source link

OpenEVSE defaults not working #22

Open firstof9 opened 2 years ago

firstof9 commented 2 years ago

When using brand set to openevse the card doesn't display any data except the charger status. Card config:

type: custom:charger-card
entity: sensor.openevse_charging_status
brand: openevse

image

image

tmjo commented 2 years ago

Hi, it was added as a test and the card is still a release candidate. I depend on someone with EVSE charger to debug and propose template values or I'll have to remove it (bevause I have no clue how it looks).

The card is now fully customizable (even if you have selected a template, it can be modified). So it should be easy to fool around with different settings without knowing code.

firstof9 commented 2 years ago

I'm able to test it out, just need some pointers.

tmjo commented 2 years ago

Sounds good. I think the easiest way is if you read up on the readme, see especially the 'advanced' part. This will explain what is possible to customize today. Then you could go to the card config, but remember to select 'Show code editor' so that the card config is shown in YAML.

Even if the EVSE-setup doesn't work today, you should be able to use it as a template to get you started. I think it should also work if you select Easee as template and then start modifying sensors to what you have in your installation.

I could have left the card only with the possibility to edit manually, but since I know this is not always the best for non-advanced YAML'ers, the idea I have with these templates is that by knowing the basic structure of each integration, we can make it a bit easier for people in the future. However, this requires that someone gives input on each integration.

Try it out and see if you get a hold of it. If you struggle with something specific, I can try to give some advice. Also, if you want, you could post a complete list of the entities/sensors belonging to the EVSE integration and I can try to make something as a starting point.

tmjo commented 2 years ago

Perhaps @jcsogo would like to chime in too, he did some early testing (see #19) and requested the EVSE some time back.

jcsogo commented 2 years ago

I haven't migrated yet to the new rewritten card, but what I have quickly looked in the code makes sense. I am using @firstof9 integration, so it should work. But please make sure that you have the default "sensor.openevse_charging_status" as you're defining in the config, as the code will rip the _charging_status part to get the 'openevse' string. If you've named it differently, then you have to pass that sensor to the config.

tmjo commented 2 years ago

That's right, the card is using the main sensor to figure out (best guess) the rest of the sensors. But if someone has completely renamed it, the card should work anyway, but will rely on manual configuration of course.

firstof9 commented 2 years ago

Does my card config look right? I didn't rename any of my entities they're all the defaults.

tmjo commented 2 years ago

Does my card config look right? I didn't rename any of my entities they're all the defaults.

Well, not really. Once openESVE is selected together with a main entity it should "translate" the config to something like the below example. Could be more or could be less (I think less, we didn't put to much info in the openEVSE example which is just a work-in-progress). Try to select Easee and modify the example below, or perhaps easier to copy the example and modify it manually to fit your sensors.

What the card does when selecting a brand and a main entity is to (try to) figure out CHARGERNAME and replace it in sensornames. So if you send a list of your entities, I can try to update openEVSE to fit more what is there.

PS! The example may look overwhelming, and you don't need all of it. But if you study, I think you see the structure more or less. The readme should hopefully explain more or less what each detail means too.

type: custom:charger-card
entity: sensor.CHARGERNAME_status
customCardTheme: theme_custom
chargerImage: Red
brand: easee
show_leds: true
details:
  name:
    entity_id: sensor.CHARGERNAME_status
    attribute: name
  location:
    entity_id: sensor.CHARGERNAME_status
    attribute: site_name
  status:
    entity_id: sensor.CHARGERNAME_status
  substatus:
    entity_id: sensor.CHARGERNAME_reason_for_no_current
  smartcharging:
    entity_id: switch.CHARGERNAME_smart_charging
  currentlimits:
    - 0
    - 6
    - 10
    - 16
    - 20
    - 25
    - 32
  statetext:
    disconnected: disconnected
    awaiting_start: awaiting_start
    charging: charging
    completed: completed
    error: error
    ready_to_charge: ready_to_charge
  collapsiblebuttons:
    group1:
      text: click_for_group1
      icon: mdi:speedometer
    group2:
      text: click_for_group2
      icon: mdi:information
    group3:
      text: click_for_group3
      icon: mdi:cog
  info_left:
    - entity_id: binary_sensor.CHARGERNAME_online
      text: online
  info_right:
    - entity_id: sensor.CHARGERNAME_voltage
      text: voltage
      unit_show: true
    - entity_id: sensor.CHARGERNAME_power
      text: power
      unit_show: true
  group1:
    - entity_id: sensor.CHARGERNAME_dynamic_charger_limit
      text: dyn_charger_limit
      service: easee.set_charger_dynamic_limit
      service_data:
        charger_id: CHARGERID
        current: '#SERVICEVAL#'
    - entity_id: sensor.CHARGERNAME_dynamic_circuit_limit
      text: dyn_circuit_limit
      service: easee.set_charger_circuit_dynamic_limit
      service_data:
        charger_id: CHARGERID
        currentP1: '#SERVICEVAL#'
    - entity_id: sensor.CHARGERNAME_max_charger_limit
      text: max_charger_limit
      service: easee.set_charger_max_limit
      service_data:
        charger_id: CHARGERID
        current: '#SERVICEVAL#'
    - entity_id: sensor.CHARGERNAME_max_circuit_limit
      text: max_circuit_limit
      service: easee.set_circuit_max_limit
      service_data:
        charger_id: CHARGERID
        currentP1: '#SERVICEVAL#'
    - entity_id: sensor.CHARGERNAME_offline_circuit_limit
      text: offline_circuit_limit
      service: easee.set_charger_circuit_offline_limit
      service_data:
        charger_id: CHARGERID
        currentP1: '#SERVICEVAL#'
  group2:
    - entity_id: binary_sensor.CHARGERNAME_online
      text: online
    - entity_id: sensor.CHARGERNAME_voltage
      text: voltage
      unit_show: true
    - entity_id: sensor.CHARGERNAME_power
      text: power
      unit_show: true
    - entity_id: sensor.CHARGERNAME_current
      text: charger_current
      unit_show: true
    - entity_id: sensor.CHARGERNAME_circuit_current
      text: circuit_current
      unit_show: true
    - entity_id: sensor.CHARGERNAME_energy_per_hour
      text: energy_per_hour
      unit_show: true
    - entity_id: sensor.CHARGERNAME_session_energy
      text: session_energy
      unit_show: true
    - entity_id: sensor.CHARGERNAME_lifetime_energy
      text: lifetime_energy
      unit_show: true
  group3:
    - entity_id: switch.CHARGERNAME_is_enabled
      text: enabled
    - entity_id: switch.CHARGERNAME_enable_idle_current
      text: idle_current
    - entity_id: binary_sensor.CHARGERNAME_cable_locked
      text: cable_locked
    - entity_id: switch.CHARGERNAME_cable_locked_permanently
      text: perm_cable_locked
    - entity_id: switch.CHARGERNAME_smart_charging
      text: smart_charging
    - entity_id: sensor.CHARGERNAME_cost_per_kwh
      text: cost_per_kwh
    - entity_id: binary_sensor.CHARGERNAME_update_available
      text: update_available
    - entity_id: binary_sensor.CHARGERNAME_basic_schedule
      text: schedule
  stats:
    default:
      - entity_id: sensor.CHARGERNAME_session_energy
        text: session_energy
        unit_show: true
      - entity_id: switch.CHARGERNAME_cable_locked_permanently
        text: cable_locked
      - entity_id: binary_sensor.CHARGERNAME_basic_schedule
        text: schedule
    disconnected:
      - entity_id: sensor.CHARGERNAME_session_energy
        text: session_energy
        unit_show: true
      - entity_id: switch.CHARGERNAME_cable_locked_permanently
        text: cable_locked
      - entity_id: calculated
        text: used_limit
        unit: A
        unit_show: true
        calc_function: min
        calc_entities:
          - entity_id: sensor.CHARGERNAME_dynamic_charger_limit
          - entity_id: sensor.CHARGERNAME_dynamic_circuit_limit
          - entity_id: sensor.CHARGERNAME_max_charger_limit
          - entity_id: sensor.CHARGERNAME_max_circuit_limit
          - entity_id: sensor.CHARGERNAME_offline_circuit_limit
    awaiting_start:
      - entity_id: sensor.CHARGERNAME_session_energy
        text: session_energy
        unit_show: true
      - entity_id: binary_sensor.CHARGERNAME_basic_schedule
        text: schedule
      - entity_id: switch.CHARGERNAME_smart_charging
        text: smart_charging
      - entity_id: calculated
        text: used_limit
        unit: A
        unit_show: true
        calc_function: min
        calc_entities:
          - entity_id: sensor.CHARGERNAME_dynamic_charger_limit
          - entity_id: sensor.CHARGERNAME_dynamic_circuit_limit
          - entity_id: sensor.CHARGERNAME_max_charger_limit
          - entity_id: sensor.CHARGERNAME_max_circuit_limit
          - entity_id: sensor.CHARGERNAME_offline_circuit_limit
    charging:
      - entity_id: sensor.CHARGERNAME_session_energy
        text: session_energy
        unit_show: true
      - entity_id: sensor.CHARGERNAME_energy_per_hour
        text: energy_per_hour
        unit_show: true
      - entity_id: sensor.CHARGERNAME_circuit_current
        text: circuit_current
        unit_show: true
      - entity_id: sensor.CHARGERNAME_output_limit
        text: output_limit
        unit_show: true
      - entity_id: sensor.CHARGERNAME_current
        text: current
        unit_show: true
      - entity_id: sensor.CHARGERNAME_power
        text: power
        unit_show: true
    completed:
      - entity_id: sensor.CHARGERNAME_session_energy
        text: session_energy
        unit_show: true
      - entity_id: binary_sensor.CHARGERNAME_basic_schedule
        text: schedule
      - entity_id: calculated
        text: used_limit
        unit: A
        unit_show: true
        calc_function: min
        calc_entities:
          - entity_id: sensor.CHARGERNAME_dynamic_charger_limit
          - entity_id: sensor.CHARGERNAME_dynamic_circuit_limit
          - entity_id: sensor.CHARGERNAME_max_charger_limit
          - entity_id: sensor.CHARGERNAME_max_circuit_limit
          - entity_id: sensor.CHARGERNAME_offline_circuit_limit
    error:
      - entity_id: sensor.CHARGERNAME_session_energy
        text: session_energy
        unit_show: true
      - entity_id: binary_sensor.CHARGERNAME_basic_schedule
        text: schedule
    ready_to_charge:
      - entity_id: sensor.CHARGERNAME_session_energy
        text: session_energy
        unit_show: true
      - entity_id: binary_sensor.CHARGERNAME_basic_schedule
        text: schedule
      - entity_id: calculated
        text: used_limit
        unit: A
        unit_show: true
        calc_function: min
        calc_entities:
          - entity_id: sensor.CHARGERNAME_dynamic_charger_limit
          - entity_id: sensor.CHARGERNAME_dynamic_circuit_limit
          - entity_id: sensor.CHARGERNAME_max_charger_limit
          - entity_id: sensor.CHARGERNAME_max_circuit_limit
          - entity_id: sensor.CHARGERNAME_offline_circuit_limit
  toolbar_left:
    default:
      - {}
    disconnected:
      - {}
    awaiting_start:
      - service: easee.stop
        service_data:
          charger_id: CHARGERID
        text: stop
        icon: hass:stop
      - service: easee.resume
        service_data:
          charger_id: CHARGERID
        text: resume
        icon: hass:play
      - service: easee.override_schedule
        service_data:
          charger_id: CHARGERID
        text: override
        icon: hass:motion-play
    charging:
      - service: easee.stop
        service_data:
          charger_id: CHARGERID
        text: stop
        icon: hass:stop
      - service: easee.pause
        service_data:
          charger_id: CHARGERID
        text: pause
        icon: hass:pause
    completed:
      - service: easee.stop
        service_data:
          charger_id: CHARGERID
        text: stop
        icon: hass:stop
      - service: easee.override_schedule
        service_data:
          charger_id: CHARGERID
        text: override
        icon: hass:motion-play
    error:
      - service: easee.reboot
        service_data:
          charger_id: CHARGERID
        text: reboot
        icon: hass:restart
    ready_to_charge:
      - service: easee.stop
        service_data:
          charger_id: CHARGERID
        text: stop
        icon: hass:stop
      - service: easee.override_schedule
        service_data:
          charger_id: CHARGERID
        text: override
        icon: hass:motion-play
  toolbar_right:
    default:
      - service: persistent_notification.create
        service_data:
          message: Firmware update is available, but only possible when disconnected!
          title: Update
        text: update
        icon: mdi:file-download
        conditional_entity: binary_sensor.CHARGERNAME_update_available
    disconnected:
      - service: easee.update_firmware
        service_data:
          charger_id: CHARGERID
        text: update
        icon: mdi:file-download
        conditional_entity: binary_sensor.CHARGERNAME_update_available
jcsogo commented 2 years ago

These are my sensors

openevse Sleep Mode switch.openevse_sleep_mode

openevse_Ambient Temperature sensor.openevse_ambient_temperature

openevse_Charge Time Elapsed sensor.openevse_charge_time_elapsed

openevse_Charging Current sensor.openevse_charging_current

openevse_Charging Status sensor.openevse_charging_status

openevse_Charging Voltage sensor.openevse_charging_voltage

openevse_Controller Firmware sensor.openevse_controller_firmware

openevse_Current Capacity sensor.openevse_current_capacity

openevse_Current Power Usage sensor.openevse_current_power_usage

openevse_Divert Active binary_sensor.openevse_divert_active

openevse_Divert Mode sensor.openevse_divert_mode

openevse_ESP32 Temperature sensor.openevse_esp32_temperature

openevse_Ethernet Connected binary_sensor.openevse_ethernet_connected

openevse_IR Temperature sensor.openevse_ir_temperature

openevse_Manual Override binary_sensor.openevse_manual_override

openevse_Max Amps sensor.openevse_max_amps

openevse_Min Amps sensor.openevse_min_amps

openevse_OTA Update binary_sensor.openevse_ota_update

openevse_Protocol Version sensor.openevse_protocol_version

openevse_PV Available Current sensor.openevse_pv_available_current

openevse_PV Charge Rate sensor.openevse_pv_charge_rate

openevse_PV Smoothed Available Current sensor.openevse_pv_smoothed_available_current

openevse_RTC Temperature sensor.openevse_rtc_temperature

openevse_Sensor Scale sensor.openevse_sensor_scale

openevse_Service Level sensor.openevse_service_level

openevse_Station Status sensor.openevse_station_status

openevse_Total Usage sensor.openevse_total_usage

openevse_Usage this Session sensor.openevse_usage_this_session

openevse_Vehicle Connected binary_sensor.openevse_vehicle_connected

openevse_Wifi Fimrware Version sensor.openevse_wifi_fimrware_version

openevse_Wifi Signal Strength sensor.openevse_wifi_signal_strength

firstof9 commented 2 years ago

So I came up with something like this:

type: custom:charger-card
entity: sensor.openevse_charging_status
brand: openevse
details:
  status:
    entity_id: sensor.openevse_charging_status
  substatus:
    entity_id: sensor.openevse_station_status
  currentlimits:
    - 0
    - 10
    - 12
    - 25
    - 30
    - 32
    - 48
  statetext:
    disconnected: not connected
    awaiting_start: sleeping
    completed: connected
    charging: charging
  collapsiblebuttons:
    group1:
      text: Set Limits
      icon: mdi:speedometer
    group2:
      text: Firmware
      icon: mdi:information
    group3:
      text: Configuration
      icon: mdi:cog
  info_left:
    - entity_id: sensor.openevse_wifi_signal_strength
      text: online
  info_right:
    - entity_id: sensor.openevse_charging_voltage
      text: Voltage
      unit_show: true
    - entity_id: sensor.openevse_charging_current
      text: Charging Current
      unit_show: true
    - entity_id: sensor.openevse_current_power_usage
      text: Power
      unit_show: true
  group1:
    - entity_id: sensor.openevse_max_amps
      text: Max Amps
  group2:
    - entity_id: sensor.openevse_wifi_fimrware_version
      text: Firmware Version
  group3:
    - entity_id: switch.openevse_manual_override
      text: Manual Override
  stats:
    default:
      - entity_id: sensor.openevse_usage_this_session
        text: Session Energy
        unit_show: true
      - entity_id: sensor.openevse_total_usage
        text: Lifetime Energy
        unit_show: true
      - entity_id: sensor.openevse_charge_time_elapsed
        text: Charge Time
        unit_show: true
    disconnected:
      - entity_id: sensor.openevse_usage_this_session
        text: Session Energy
        unit_show: true
      - entity_id: sensor.openevse_total_usage
        text: Lifetime Energy
        unit_show: true
      - entity_id: sensor.openevse_charge_time_elapsed
        text: Charge Time
        unit_show: true
    awaiting_start:
      - entity_id: sensor.openevse_usage_this_session
        text: Session Energy
        unit_show: true
      - entity_id: sensor.openevse_total_usage
        text: Lifetime Energy
        unit_show: true
      - entity_id: sensor.openevse_charge_time_elapsed
        text: Charge Time
        unit_show: true
    charging:
      - entity_id: select.openevse_max_current
        text: Current Limit
        unit_show: true
    completed:
      - entity_id: sensor.openevse_usage_this_session
        text: Session Energy
        unit_show: true
      - entity_id: sensor.openevse_total_usage
        text: Lifetime Energy
        unit_show: true
      - entity_id: sensor.openevse_charge_time_elapsed
        text: Charge Time
        unit_show: true
    error:
      - entity_id: sensor.openevse_usage_this_session
        text: Session Energy
        unit_show: true
      - entity_id: sensor.openevse_total_usage
        text: Lifetime Energy
        unit_show: true
      - entity_id: sensor.openevse_charge_time_elapsed
        text: Charge Time
        unit_show: true
    ready_to_charge:
      - entity_id: sensor.openevse_usage_this_session
        text: Session Energy
        unit_show: true
      - entity_id: sensor.openevse_total_usage
        text: Lifetime Energy
        unit_show: true
      - entity_id: sensor.openevse_charge_time_elapsed
        text: Charge Time
        unit_show: true
  toolbar_left:
    default:
      - {}
    disconnected:
      - {}
    awaiting_start:
      - service: switch.turn_off
        service_data:
          target:
            entity_id: switch.openevse_manual_override
        text: stop
        icon: hass:stop
      - service: switch.turn_on
        service_data:
          target:
            entity_id: switch.openevse_manual_override
        text: start
        icon: hass:play
    charging:
      - service: switch.turn_off
        service_data:
          target:
            entity_id: switch.openevse_manual_override
        text: stop
        icon: hass:stop
    completed:
      - {}
    error:
      - {}
    ready_to_charge:
      - {}

Here's the output:

image

Edit: The current selection has a weird graphical glitch: image

tmjo commented 2 years ago

Starting to look good! I am aware of the glitch you see in current selection dropdown, there is a problem in my css that I didn't manage to fix yet. See #21 as well.

PS! You would probably want to add a service to the current selection too so that you can actually change it?

firstof9 commented 2 years ago

I've made a few tweaks that may work as defaults:

type: custom:charger-card
entity: sensor.openevse_charging_status
brand: openevse
customCardTheme: theme_custom
details:
  status:
    entity_id: sensor.openevse_charging_status
  substatus:
    entity_id: sensor.openevse_station_status
  currentlimits:
    - 6
    - 10
    - 12
    - 25
    - 30
    - 32
    - 48
  statetext:
    awaiting_start: sleeping
    completed: connected
    charging: charging
  collapsiblebuttons:
    group1:
      text: Set Limits
      icon: mdi:speedometer
    group2:
      text: Firmware
      icon: mdi:information
    group3:
      text: Configuration
      icon: mdi:cog
  info_left:
    - entity_id: sensor.openevse_wifi_signal_strength
      text: online
  info_right:
    - entity_id: sensor.openevse_charging_voltage
      text: Voltage
      unit_show: true
    - entity_id: sensor.openevse_charging_current
      text: Charging Current
      unit_show: true
    - entity_id: sensor.openevse_current_power_usage
      text: Power
      unit_show: true
  group1:
    - entity_id: select.openevse_max_current
      text: Max Amps
      icon: mdi:sine-wave
      service: select.select_option
      service_data:
        option: '#SERVICEVAL#'
  group2:
    - entity_id: sensor.openevse_wifi_fimrware_version
      text: Firmware Version
    - entity_id: sensor.openevse_controller_firmware
      text: Controller Firmware
  group3:
    - entity_id: select.openevse_service_level
      icon: mdi:leaf
      text: Service Level
  stats:
    default:
      - entity_id: sensor.openevse_ambient_temperature
        text: Ambient Temp
        unit_show: true
      - entity_id: sensor.openevse_total_usage
        text: Lifetime Energy
        unit_show: true
      - entity_id: sensor.openevse_charge_time_elapsed
        text: Charge Time
        unit_show: true
    awaiting_start:
      - entity_id: select.openevse_max_current
        text: Current Limit
        unit_show: true
      - entity_id: sensor.openevse_total_usage
        text: Lifetime Energy
        unit_show: true
      - entity_id: sensor.openevse_ambient_temperature
        text: Ambient Temp
        unit_show: true
    charging:
      - entity_id: select.openevse_max_current
        text: Current Limit
        unit_show: true
      - entity_id: sensor.openevse_esp32_temperature
        text: Station Temp
        unit_show: true
    completed:
      - entity_id: sensor.openevse_usage_this_session
        text: Session Energy
        unit_show: true
      - entity_id: sensor.openevse_total_usage
        text: Lifetime Energy
        unit_show: true
      - entity_id: sensor.openevse_charge_time_elapsed
        text: Charge Time
        unit_show: true
    error:
      - entity_id: sensor.openevse_esp32_temperature
        text: Station Temp
        unit_show: true
      - entity_id: sensor.openevse_ambient_temperature
        text: Ambient Temp
        unit_show: true
      - entity_id: select.openevse_max_current
        text: Current Limit
        unit_show: true
  toolbar_left:
    awaiting_start:
      - service: switch.turn_off
        service_data:
          target:
            entity_id: switch.openevse_manual_override
        text: stop
        icon: hass:stop
      - service: switch.turn_on
        service_data:
          target:
            entity_id: switch.openevse_manual_override
        text: start
        icon: hass:play
    charging:
      - service: switch.turn_off
        service_data:
          target:
            entity_id: switch.openevse_manual_override
        text: stop
        icon: hass:stop

image

tmjo commented 2 years ago

Looking good! Does it seem to work as you expected? @jcsogo: Does this cover your needs and expectation as well? If you both I agree, I can update the openEVSE template to reflect this solution.

firstof9 commented 2 years ago

@tmjo I couldn't get the "disconnected" state using the "not connected" sensor state to work it always used "default" for some reason.

tmjo commented 2 years ago

Sorry, I didn't follow. You mean the state text below the charger image doesn't follow your sensor.openevse_charging_status?

firstof9 commented 2 years ago

When sensor.openevse_charging_status state was not connected the card was using the default entry for the stats section, which is why I removed the disconnected entry from statetext.

I hope this clears up what I was trying to convey.

TommySharpNZ commented 1 year ago

Has the openEVSE template been updated? I am using the custom integration to get openEVSE talking to Home Assistant as it seems MUCH better than the default integration. https://github.com/firstof9/openevse

firstof9 commented 1 year ago

No idea, I've been using what I've posted and it's been working fine.

tmjo commented 1 year ago

Hi!

I'd love to add support for this charger, but kindly read the wiki on how-to. Let me know if anything is unclear and I'll update it or try to explain.

Cheers!