magico13 / ha-emporia-vue

Home Assistant Integration for Emporia Vue Energy Monitor
MIT License
490 stars 66 forks source link

Charging Rate and Status Attributes to Sensors #190

Open dnldcs opened 1 year ago

dnldcs commented 1 year ago

Is it possible to add all or some of the attributes for the Emporia EVSE, like Charging Rate, and Status, Message, etc?

magico13 commented 1 year ago

Status, Message, Charging Rate, and Max Charging Rate are available as attributes on the switch entity. Note that Charging Rate is not the active charging rate but is what you set the rate to between 6 amps and the max set by the circuit breaker. The active charging rate in amps can be determined by taking the 1 minute wattage and dividing by 240v (plus or minus a bit if you have a manual adjustment).

Screenshot_20230406-145343

magico13 commented 1 year ago

You can display those attributes directly on the UI or pull them into a separate entity through Home Assistant's template system to then use for whatever. For instance, I show some of them in a basic entity list card for controlling the EVSE. Screenshot_20230406-145735

jgrant216 commented 2 months ago

@magico13 , can you share the code for the card?

magico13 commented 2 months ago

Sure, here it is. I did end up creating a helper entity for car_connected so it references that instead of of the attribute, but there's an example in here for reading the charge rate attribute, it'd be very similar for the icon status. I'll post the helper as well.

type: entities
entities:
  - entity: switch.ev
    name: Charging Enabled
  - type: attribute
    entity: switch.ev
    attribute: status
    name: EVSE Status
    icon: mdi:message-processing
  - entity: binary_sensor.car_connected
  - entity: sensor.ev_123_1min
    name: Active Power
  - entity: sensor.ev_123_1d
    name: Energy Today
  - entity: sensor.ev_123_1mon
    name: Energy This Month
  - type: attribute
    entity: switch.ev
    attribute: charging_rate
    name: Max Charge Rate
    suffix: A
    icon: mdi:battery-charging-medium
  - type: divider
  - type: buttons
    entities:
      - entity: switch.ev
        name: Fast Charge
        tap_action:
          action: call-service
          service: emporia_vue.set_charger_current
          data:
            current: 40
          target:
            device_id: c162253d9a697c72832eb86955af29cc
      - entity: switch.ev
        name: Slow Charge
        tap_action:
          action: call-service
          service: emporia_vue.set_charger_current
          data:
            current: 8
          target:
            device_id: c162253d9a697c72832eb86955af29cc
title: EVSE Control
show_header_toggle: false
state_color: false

The helper is just a binary sensor with this template.

{{ is_state_attr('switch.ev', 'icon_name', 'CarConnected') }}