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

Add remote start/stop using RFID #14

Merged
merged 3 commits into from
Dec 1, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
8 changes: 8 additions & 0 deletions chargeamps/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -93,3 +93,11 @@ class ChargingSession(object):
total_consumption_kwh: float
start_time: Optional[datetime] = datetime_field()
end_time: Optional[datetime] = datetime_field()

@dataclass_json(letter_case=LetterCase.CAMEL)
@dataclass(frozen=True)
class StartAuth(object):
fekberg marked this conversation as resolved.
Show resolved Hide resolved
rfidLength: int
rfidFormat: str
rfid: str
externalTransactionId: str
13 changes: 13 additions & 0 deletions chargeamps/external.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
ChargePointSettings,
ChargePointStatus,
ChargingSession,
StartAuth
)

API_BASE_URL = "https://eapi.charge.space"
Expand Down Expand Up @@ -153,3 +154,15 @@ async def set_chargepoint_connector_settings(
connector_id = settings.connector_id
request_uri = f"/api/{API_VERSION}/chargepoints/{charge_point_id}/connectors/{connector_id}/settings"
await self._put(request_uri, json=payload)

async def remote_start(self, charge_point_id: str, connector_id: int, startAuth: StartAuth) -> None:
fekberg marked this conversation as resolved.
Show resolved Hide resolved
"""Remote start chargepoint"""
payload = startAuth.to_dict()
request_uri = f"/api/{API_VERSION}/chargepoints/{charge_point_id}/connectors/{connector_id}/remotestart"
await self._put(request_uri, json=payload)

async def remote_stop(self, charge_point_id: str, connector_id: int, startAuth: StartAuth) -> None:
fekberg marked this conversation as resolved.
Show resolved Hide resolved
"""Remote start chargepoint"""
payload = startAuth.to_dict()
request_uri = f"/api/{API_VERSION}/chargepoints/{charge_point_id}/connectors/{connector_id}/remotestop"
await self._put(request_uri, json=payload)
Loading