Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tweaks to energy sensor and doc changes #11

Merged
merged 3 commits into from
Dec 28, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,11 @@ A basic integration for interacting with Ohme EV Chargers.

This is an unofficial integration. I have no affiliation with Ohme besides owning one of their EV chargers.

This has only be tested with an Ohme Home Pro and does not currently support social login or accounts with multiple chargers.
This integration does not currently support social login or accounts with multiple chargers. It has been tested with the following hardware:
* Ohme Home Pro [UK]
* Ohme Home/Go [UK]

If you find any bugs or would like to request a feature, please open an issue.

## Entities
This integration exposes the following entities:
Expand Down
6 changes: 4 additions & 2 deletions custom_components/ohme/sensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,9 @@ def native_value(self):
class EnergyUsageSensor(CoordinatorEntity[OhmeStatisticsCoordinator], SensorEntity):
"""Sensor for total energy usage."""
_attr_name = "Accumulative Energy Usage"
_attr_native_unit_of_measurement = UnitOfEnergy.KILO_WATT_HOUR
_attr_native_unit_of_measurement = UnitOfEnergy.WATT_HOUR
_attr_suggested_unit_of_measurement = UnitOfEnergy.KILO_WATT_HOUR
_attr_suggested_display_precision = 1
_attr_device_class = SensorDeviceClass.ENERGY

def __init__(
Expand Down Expand Up @@ -111,7 +113,7 @@ def icon(self):
def native_value(self):
"""Get value from data returned from API by coordinator"""
if self.coordinator.data and self.coordinator.data['energyChargedTotalWh']:
return self.coordinator.data['energyChargedTotalWh'] / 1000
return self.coordinator.data['energyChargedTotalWh']

return None

Expand Down
2 changes: 1 addition & 1 deletion custom_components/ohme/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ def charge_graph_next_slot(charge_start, points):
# If the next point has a Y delta of 10+, consider this the start of a slot
# This should be 0+ but I had some strange results in testing... revisit
if delta > 10:
next_ts = data[idx]["t"]
next_ts = data[idx]["t"] + 1 # 1s added here as it otherwise often rounds down to xx:59:59
break

# This needs to be presented with tzinfo or Home Assistant will reject it
Expand Down
Loading