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

New metrics #159

Merged
merged 2 commits into from
Sep 10, 2021
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.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
8 changes: 8 additions & 0 deletions custom_components/ocpp/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -633,6 +633,10 @@ async def data_transfer(self, vendor_id: str, message_id: str = "", data: str =
data,
resp.data,
)
self._metrics[cdet.data_response.value].value = datetime.now(
tz=timezone.utc
).isoformat()
self._metrics[cdet.data_response.value].extra_attr = {message_id: resp.data}
return True
else:
_LOGGER.warning("Failed with response: %s", resp.status)
Expand All @@ -648,6 +652,10 @@ async def get_configuration(self, key: str = ""):
if resp.configuration_key is not None:
value = resp.configuration_key[0][om.value.value]
_LOGGER.debug("Get Configuration for %s: %s", key, value)
self._metrics[cdet.config_response.value].value = datetime.now(
tz=timezone.utc
).isoformat()
self._metrics[cdet.config_response.value].extra_attr = {key: value}
return value
if resp.unknown_key is not None:
_LOGGER.warning("Get Configuration returned unknown key for: %s", key)
Expand Down
2 changes: 2 additions & 0 deletions custom_components/ocpp/enums.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,8 @@ class HAChargerDetails(str, Enum):
firmware_version = "FW.Version"
features = "Features"
connectors = "Connectors"
data_response = "Data.Response"
config_response = "Config.Response"


class HAChargerSession(str, Enum):
Expand Down