Skip to content

Commit

Permalink
#32 calculating the value of "System date" to a regular date
Browse files Browse the repository at this point in the history
  • Loading branch information
dm82m committed Jul 12, 2023
1 parent ec16a45 commit 8b02d96
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
3 changes: 3 additions & 0 deletions custom_components/deltasol/deltasolapi.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,9 @@ def __parse_data(self, response):
value = response["headersets"][0]["packets"][iHeader]["field_values"][iField]["raw_value"]
if isinstance(value, float):
value = round(value, 2)
if "date" in field["name"]:
epochStart = datetime.datetime(2001, 1, 1, 0, 0, 0, 0)
value = epochStart + datetime.timedelta(0, value)
unique_id = header["id"] + "__" + field["id"]
data[unique_id] = DeltasolEndpoint(
name=field["name"].replace(" ", "_").lower(),
Expand Down
2 changes: 1 addition & 1 deletion custom_components/deltasol/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"documentation": "https://github.com/dm82m/hass-deltasol-KM2",
"issue_tracker": "https://github.com/dm82m/hass-deltasol-KM2/issues",
"dependencies": [],
"version": "0.3.1",
"version": "0.3.2",
"codeowners": [
"@dm82m"
],
Expand Down

0 comments on commit 8b02d96

Please sign in to comment.