Skip to content

Commit

Permalink
Update readme and fix cost sensor class
Browse files Browse the repository at this point in the history
  • Loading branch information
mbillow committed Apr 10, 2022
1 parent 43f6fda commit 48b5c45
Show file tree
Hide file tree
Showing 4 changed files with 68 additions and 4 deletions.
66 changes: 65 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,69 @@
# ha-chargepoint
# ChargePoint for Home Assistant

A cloud-polling Home Assistant component to expose ChargePoint Home Charger and Account information.

![home assistant entities](https://github.com/mbillow/ha-chargepoint/raw/main/.github/images/ha_chargepoint_sensor_card.png)

## Installation

While we are waiting to get included in the default HACS repositories, you can
manually include this repository in HACS:

1. If you haven't already installed HACS, follow [their instructions](https://hacs.xyz/docs/setup/prerequisites).
2. Navigate to HACS.
3. Choose "Integrations"
4. Add this repository to your configuration.
1. Click the three dots in the upper right-hand corner.
2. Select "Custom repositories"
3. Enter `mbillow/ha-chargepoint` into the repository box.
4. Select the "Integration" type.
5. Click `Add`.
5. Install the integration like you would [any other HACS addon](https://hacs.xyz/docs/navigation/overview).

## Usage

Once you have installed the component, you'll need to add and configure it. From the
`Configuration > Devices & Services` page, click `+ Add Integration` in the bottom
right.

Search for ChargePoint and select the integration. You will be prompted for your
ChargePoint credentials.

Once you are logged in, if you have any home chargers, you will be asked which zones/rooms
to assign each device to. Otherwise, you will just see a sensor exposing your account
balance.


## Energy Tracking

**Must be using `v0.1.2` or higher for proper sensor classification.**

For users that have one or more ChargePoint Home Flex(es), you can add your chargers as
sources of grid consumption in Home Assistant's energy tracking system. Simply add the
`Energy Output` output sensor of your device and add the `Charge Cost` sensor an "entity
tracking the total costs."

## Using with Third-Party Cards

The sensors created by this component can be used with third-party EV charging
cards like [tmjo/charger-card](https://github.com/tmjo/charger-card).

Feel free to create Pull Requests adding demo configurations to this section of
the README if you end up building something you'd like to share.


## Development and Contributing

If you notice any issues, please create a GitHub issue describing the error and include
any error messages or stack traces.

### Running the Integration

I've included a simple Docker Compose file that will launch a new Home Assistant instance
with the integration and its dependencies pre-installed. Simply run:

```shell
docker-compose up -d
```

Then navigate to `http://127.0.0.1:8123` in your browser.
2 changes: 1 addition & 1 deletion custom_components/chargepoint/const.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
NAME = "ChargePoint"
DOMAIN = "chargepoint"
DOMAIN_DATA = f"{DOMAIN}_data"
VERSION = "0.1.1"
VERSION = "0.1.2"
ATTRIBUTION = "Data provided by https://www.chargepoint.com"
ISSUE_URL = "https://github.com/mbillow/ha-chargepoint/issues"

Expand Down
2 changes: 1 addition & 1 deletion custom_components/chargepoint/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,6 @@
],
"config_flow": true,
"issue_tracker": "https://github.com/mbillow/ha-chargepoint/issues",
"version": "0.1.1",
"version": "0.1.2",
"iot_class": "cloud_polling"
}
2 changes: 1 addition & 1 deletion custom_components/chargepoint/sensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -227,7 +227,7 @@ def native_value(self):
key="session_cost",
name_suffix="Charge Cost",
icon="mdi:cash-multiple",
state_class=SensorStateClass.MEASUREMENT,
state_class=SensorStateClass.TOTAL_INCREASING,
device_class=SensorDeviceClass.MONETARY,
value=lambda entity: f"{entity.session.total_amount:.2f}"
if entity.session
Expand Down

0 comments on commit 48b5c45

Please sign in to comment.