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

Patch 2 #4

Merged
merged 2 commits into from
Oct 21, 2019
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
16 changes: 10 additions & 6 deletions pyjuicenet/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ def get_device_state(self, charger):
headers=headers)
response_json = response.json()
return response_json

def get_info(self, charger):
data = {
"device_id": self.uuid,
Expand Down Expand Up @@ -135,7 +135,7 @@ def getChargeTime(self):

def getEnergyAdded(self):
return self.json_state.get("charging").get("wh_energy")

def getOverrideTime(self):
return self.json_state.get("override_time")

Expand All @@ -147,8 +147,8 @@ def setOverride(self, charge_now):
if charge_now:
# To enter the "Charge Now" state, override_time should be set to a time in the past.
# Otherwise, it simply sets the target time the vehicle should be charged by.
# Through experiment, it appears that override_time expects the timestamp
# in the timezone of the unit, so we will simply set override_time to the
# Through experiment, it appears that override_time expects the timestamp
# in the timezone of the unit, so we will simply set override_time to the
# last known unit_time from the json_state.

# First, (re)load state in case it's empty or stale
Expand All @@ -157,7 +157,11 @@ def setOverride(self, charge_now):
# energy_to_add actually comes from your vehicle configuration. Since we don't
# know the charge state of the vehicle, this is normally the complete
# battery capacity of the vehicle.
energy_to_add = self.json_state["charging"]["wh_energy_to_add"]
energy_to_add = self.json_state["charging"]["wh_energy_to_add"]

override_state = self.api.set_override(self, override_time, energy_at_plugin, energy_to_add)
return override_state["success"]

# Update state again to show current override status
self.update_state()

return override_state["success"]
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
from setuptools import setup, find_packages

setup(name='python-juicenet',
version='0.1.0',
version='0.1.1',
description='Read and control Juicenet/Juicepoint/Juicebox based EVSE devices',
url='http://github.com/jesserockz/python-juicenet',
author='Jesse Hills',
Expand Down