Skip to content

Commit

Permalink
Merge 3886744 into 9ddf163
Browse files Browse the repository at this point in the history
  • Loading branch information
pronovic committed Jun 22, 2022
2 parents 9ddf163 + 3886744 commit 3e4f41f
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 5 deletions.
4 changes: 1 addition & 3 deletions .mypy.ini
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,7 @@ allow_untyped_defs = True
allow_untyped_calls = True

# There is no type hinting for influxdb_client
[mypy-influxdb_client]
ignore_missing_imports = True
[mypy-influxdb_client.client.exceptions]
[mypy-influxdb_client.*]
ignore_missing_imports = True

# There is no type hinting for jsonpath_ng
Expand Down
4 changes: 4 additions & 0 deletions Changelog
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
Version 0.4.1 unreleased

* Use InfluxDBClient.write_api(SYNCHRONOUS) so file handles are closed.

Version 0.4.0 19 Jun 2022

* Rename GitHub repo to smartapp-sensortrack.
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "sensortrack"
version = "0.4.0"
version = "0.4.1a1"
description = "Historically track sensor data from SmartThings"
authors = ["Kenneth J. Pronovici <pronovic@ieee.org>"]
license = "Apache-2.0"
Expand Down
3 changes: 2 additions & 1 deletion src/sensortrack/handler.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
from typing import List, Optional, Union

from influxdb_client import InfluxDBClient, Point
from influxdb_client.client.write_api import SYNCHRONOUS
from smartapp.interface import (
ConfigurationRequest,
ConfirmationRequest,
Expand Down Expand Up @@ -75,7 +76,7 @@ def handle_event(self, correlation_id: Optional[str], request: EventRequest) ->
points = [] # type: List[Point]
self._handle_weather_lookup_events(request, points)
self._handle_sensor_events(request, points)
client.write_api().write(bucket=bucket, record=points)
client.write_api(write_options=SYNCHRONOUS).write(bucket=bucket, record=points)
logging.debug("[%s] Completed persisting %d point(s) of data", correlation_id, len(points))

def _handle_config_refresh(
Expand Down

0 comments on commit 3e4f41f

Please sign in to comment.