getClosestRawPoint
Get the closest raw point to one or more timestamps.
Signature
Section titled “Signature”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
Inputs
Section titled “Inputs”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.
Examples
Section titled “Examples”JSON output (single tag)
Section titled “JSON output (single tag)”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" }]JSON output (multiple timestamps)
Section titled “JSON output (multiple timestamps)”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.