getCurrentDataPoints
Get the latest value for one or more tags.
Signature
Section titled “Signature”getCurrentDataPoints(tags, output="json")
tags(str | list[str])output(str):json(default),df,raw,string
Inputs
Section titled “Inputs”tags: Tag name or list of tags to read the latest values from.output: Output format selector.
Examples
Section titled “Examples”JSON output (single tag)
Section titled “JSON output (single tag)”value = hm.getCurrentDataPoints("DEMO_02TI301.PV")Output:
{ "timestamp": "2024-01-01T12:00:00Z", "value": 38.1, "status": "OK"}JSON output (multiple tags)
Section titled “JSON output (multiple tags)”values = hm.getCurrentDataPoints(["DEMO_02TI301.PV", "DEMO_02TI201.PV"])Output:
{ "DEMO_02TI301.PV": { "timestamp": "2024-01-01T12:00:00Z", "value": 38.1, "status": "OK" }, "DEMO_02TI201.PV": { "timestamp": "2024-01-01T12:00:00Z", "value": 42.0, "status": "OK" }}DataFrame output (single tag)
Section titled “DataFrame output (single tag)”latest = hm.getCurrentDataPoints("DEMO_02TI301.PV", output="df")Output (df):
DEMO_02TI301.PV2024-01-01 12:00:00 38.1DataFrame output (multiple tags)
Section titled “DataFrame output (multiple tags)”latest_df = hm.getCurrentDataPoints( ["DEMO_02TI301.PV", "DEMO_02TI201.PV"], output="df",)Output (df):
DEMO_02TI301.PV DEMO_02TI201.PV2024-01-01 12:00:00 38.1 42.0Raw output (single tag)
Section titled “Raw output (single tag)”raw = hm.getCurrentDataPoints("DEMO_02TI301.PV", output="raw")Output:
{ "results": { "DEMO_02TI301.PV": { "dataPoint": { "timestamp": 1704110400000, "value": 38.1, "status": "OK" } } }}Raw output (multiple tags)
Section titled “Raw output (multiple tags)”raw = hm.getCurrentDataPoints( ["DEMO_02TI301.PV", "DEMO_02TI201.PV"], output="raw",)Output:
{ "results": { "DEMO_02TI301.PV": { "dataPoint": { "timestamp": 1704110400000, "value": 38.1, "status": "OK" } }, "DEMO_02TI201.PV": { "dataPoint": { "timestamp": 1704110400000, "value": 42.0, "status": "OK" } } }}