Skip to content

getClosestRawPoint

Get the closest raw point to one or more timestamps.

getClosestRawPoint(tags, timestamps, before_or_after="AFTER_OR_AT", output="json")

  • tags (str | list[str])
  • timestamps (str | int | float | datetime | list[…])
  • before_or_after (str, default: AFTER_OR_AT)
  • output (str): json (default), df, raw, string
  • tags: Tag name or list of tags to query.
  • timestamps: One or more timestamps to find closest raw points for.
  • before_or_after: Selection rule for closest point.
  • output: Output format selector.
closest = hm.getClosestRawPoint(
"DEMO_02TI301.PV",
["2024-01-01 00:00:00"],
before_or_after="BEFORE_OR_AT",
)

Output:

[{ "timestamp": "2023-12-31T23:59:40Z", "value": 37.8, "status": "OK" }]
closest = hm.getClosestRawPoint(
"DEMO_02TI301.PV",
["2024-01-01 00:00:00", "2024-01-01 01:00:00"],
before_or_after="AFTER_OR_AT",
)

Output:

[
{ "timestamp": "2024-01-01T00:00:05Z", "value": 38.0, "status": "OK" },
{ "timestamp": "2024-01-01T01:00:10Z", "value": 37.6, "status": "OK" }
]

Valid before_or_after values: BEFORE, BEFORE_OR_AT, AFTER, AFTER_OR_AT.