Skip to content

Commit

Permalink
Merge pull request #30 from slaxor505/main
Browse files Browse the repository at this point in the history
Release 1.3
  • Loading branch information
Olen authored Oct 12, 2024
2 parents b79c4a7 + 64ad463 commit 27a9fec
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion custom_components/openplantbook/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,5 +19,5 @@
"json-timeseries==0.1.7",
"openplantbook-sdk==0.4.7"
],
"version": "1.3.0-beta6"
"version": "1.3.0"
}
8 changes: 4 additions & 4 deletions custom_components/openplantbook/uploader.py
Original file line number Diff line number Diff line change
Expand Up @@ -273,7 +273,7 @@ async def plant_data_upload(hass, entry, call=None) -> dict[str, Any] | None:
if latest_data:
query_period_start_timestamp = dt_util.parse_datetime(
latest_data
).astimezone(dt.UTC)
).astimezone(dt.UTC) + timedelta(seconds=1)

# If last upload was more than 7 days ago then only take last 7 days
if query_period_end_timestamp - query_period_start_timestamp > timedelta(
Expand Down Expand Up @@ -395,9 +395,9 @@ async def plant_data_upload(hass, entry, call=None) -> dict[str, Any] | None:
_LOGGER.info("Found no sensors data to upload")

if latest_data:
days_since_upload = dt_util.parse_datetime(latest_data).astimezone(
dt.UTC
) - dt_util.now(dt.UTC)
days_since_upload = dt_util.now(dt.UTC) - dt_util.parse_datetime(
latest_data
).astimezone(dt.UTC)
if (days_since_upload.days > 3) and dt_util.now(dt.UTC).weekday() == 4:
_LOGGER.warning(
"The last time plant sensors data was successfully uploaded %s days ago. This may indicate a "
Expand Down

0 comments on commit 27a9fec

Please sign in to comment.