{"id":25430623,"url":"https://github.com/iupdatable/obix","last_synced_at":"2025-10-31T20:30:37.534Z","repository":{"id":57447591,"uuid":"401626369","full_name":"IUpdatable/oBIX","owner":"IUpdatable","description":"A client package for interacting with oBIX(Open Building Information Exchange)","archived":false,"fork":false,"pushed_at":"2023-08-01T07:02:55.000Z","size":34,"stargazers_count":3,"open_issues_count":2,"forks_count":3,"subscribers_count":2,"default_branch":"master","last_synced_at":"2024-04-26T05:44:15.670Z","etag":null,"topics":["obix","python"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/IUpdatable.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null}},"created_at":"2021-08-31T08:20:09.000Z","updated_at":"2024-04-26T05:44:15.671Z","dependencies_parsed_at":"2022-09-15T22:12:16.218Z","dependency_job_id":"e77e9c92-5705-4b2b-af88-179cb8edaf2e","html_url":"https://github.com/IUpdatable/oBIX","commit_stats":{"total_commits":4,"total_committers":1,"mean_commits":4.0,"dds":0.0,"last_synced_commit":"b25f8b4249919dbacc55a204846ad6272fde5e79"},"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/IUpdatable%2FoBIX","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/IUpdatable%2FoBIX/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/IUpdatable%2FoBIX/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/IUpdatable%2FoBIX/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/IUpdatable","download_url":"https://codeload.github.com/IUpdatable/oBIX/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":239231104,"owners_count":19603989,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["obix","python"],"created_at":"2025-02-17T03:39:59.049Z","updated_at":"2025-10-31T20:30:37.473Z","avatar_url":"https://github.com/IUpdatable.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# oBIX\n\nA client package for interacting with oBIX(Open Building Information Exchange)\n\n中文版教程请访问：[使用 Python 通过 oBIX 协议访问 Niagara 数据](https://www.cnblogs.com/IUpdatable/p/14052867.html)\n\n## 0. Installation\n\n* make sure Python version \u003e= 3.7\n\n```bash\npip install oBIX\n```\n\n\n## 1. Quick Start\n```Python\nfrom oBIX.common import Point, DataType\nfrom oBIX import Client\n\n\nif __name__ == '__main__':\n    # ip, userName, password\n    # options:\n    #   port: the ip port to access\n    #   https: whether enable `https`, default is True\n    client = Client(\"127.0.0.1\", \"oBIX\", \"oBIX.12345\")\n\n    # set a NumericWritable Point in Niagara 4\n    point_path = \"/config/AHU/temp1/\"\n\n    # read a point value\n    point_value = client.read_point_value(point_path)\n\n```\n## 2. Basic examples\n### 2.1 Read point\n\n```python\n\n    # set a NumericWritable Point in Niagara 4\n    point_path = \"/config/AHU/temp1/\"\n\n    # read a point value\n    point_value = client.read_point_value(point_path)\n    print(\"point value is {0}\".format(point_value))\n\n    # read a point object\n    # you can access all properties in this point\n    # E.g: name, val, status, display, href, in1, in2 ... in16, fallback, out\n    point_obj = client.read_point(point_path)\n    print(\"name is {0}\".format(point_obj.name))\n    print(\"fallback is {0}\".format(point_obj.fallback))\n    print(\"in10 is {0}\".format(point_obj.in10))\n    \n    # you can also use the following function to quickly access\n    point_in10_value = client.read_point_slot(point_path, \"in10\")\n    print(\"in10 is {0}\".format(point_in10_value))\n    \n```\n\n### 2.2 Write point\n\n```python\n    \n    # set a NumericWritable Point in Niagara 4\n    point_path = \"/config/AHU/temp1/\"\n\n    # set point value\n    client.write_point(point_path, 15.2, DataType.real)\n    # set point auto\n    client.set_point_auto(point_path, DataType.real)\n    # override a point\n    client.override_point(point_path, 14, DataType.real)\n    # emergency override a point\n    client.emergency_override_point(point_path, 15, DataType.real)\n    # set a point emergency auto\n    client.set_point_emergency_auto(point_path, DataType.real)\n\n```\n\n## 3. Advanced Features\n### 3.1 Read history\n```Python\n    # start time\n    start_time = datetime.now(tz=timezone(timedelta(hours=8))) - timedelta(minutes=10)\n    # end time\n    end_time = datetime.now(tz=timezone(timedelta(hours=8)))\n\n    # read history data from start_time to end_time\n    history = client.read_history(\"Station01\", \"OutDoorTemp\", start_time, end_time)\n\n    # read history data from start_time with a limit num\n    limit_num = 1\n    history = client.read_history(\"Station01\", \"OutDoorTemp\", start_time=start_time, limit=limit_num)\n```\n### 3.2 Read alarms\n```Python\n    # start time\n    start_time = datetime.now(tz=timezone(timedelta(hours=8))) - timedelta(minutes=10)\n    # end time\n    end_time = datetime.now(tz=timezone(timedelta(hours=8)))\n\n    # read alarm data from start_time to end_time\n    history = client.read_alarms(\"Station01\", \"OutDoorTemp\", start_time, end_time)\n\n    # read alarm data from start_time with a limit num\n    limit_num = 1\n    history = client.read_alarms(\"Station01\", \"OutDoorTemp\", start_time=start_time, limit=limit_num)\n```\n### 3.3 Monitoring point changes\n```python\nfrom oBIX.common import Point, DataType\nfrom oBIX import Client\n\n\ndef init_watch():\n    global client, point_path\n    # add watch\n    point_path_list = [point_path]  # you can add more points here\n    result = client.add_watch_points(point_path_list)\n    client.watch_changed_handler.on_change += on_watch_changed\n\n\n# Manually modify the value of the point in the software,\n# it will automatically trigger the function\ndef on_watch_changed(points: [Point]):\n    for point in points:\n        val = point.val\n        print(f\"on_watch_changed: {val}\")\n\n\nif __name__ == '__main__':\n    # ip, userName, password\n    # options:\n    #   port: the ip port to access\n    #   https: whether enable `https`, default is True\n    client = Client(\"127.0.0.1\", \"oBIX\", \"oBIX.12345\")\n\n    # set a NumericWritable Point in Niagara 4\n    point_path = \"/config/AHU/temp1/\"\n\n    init_watch()\n    client.start_watch()\n    while True:\n        i = 0\n\n```\n### 3.4 Export all points\n\n```python\n\n# export all points info\nexport_result = client.export_points()\n\n# folder_path [optional]: The directory you want to export. E.g: \"/config/xxx/\"\n#                 All data points will be exported by default.\n# export_file_name [optional]: The file path to save the result, default is \"all_points.json\"\n# export_type [optional]:\n#     0: JSON format, nested way and preserve directory structure\n#     1: JSON format, pure point list with properties, ignoring directory structure\n#     2: string list, pure point url list\n\nexport_result = client.export_points(folder_path=\"/config/AHU/\", export_file_name=\"output.json\", export_type=1)\n```\n\n\n## 4. FAQ\n\n### 4.1 There are spaces in the path\n\nuse `$20` or `%2420` replace space\n\n### 4.2 Time data does not match\nerror like this:\n```\ntime data '2019-06-26T08:50:01.059+08:00' does not match from '%Y-%m-%dT%H:%M:%S.%f%z'\n```\n\nthis means your Python version is too low, the minimal version is v3.7.\n\n### 4.3 Error: Illegal double slashes\n\nDO NOT USE \"//\" in point path, error example: \"/config/Views//CH1_CoolingCapacity/\"\n\n## 5. Useful Links\n* [oBIX Protocol Document](http://docs.oasis-open.org/obix/obix/v1.1/csprd01/obix-v1.1-csprd01.html)\n* [oBIX Communication Raw Data](https://documenter.getpostman.com/view/1068428/S1LpaXea#intro)\n\nFor more details, please refer to the project homepage: [oBIX](https://github.com/IUpdatable/oBIX)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fiupdatable%2Fobix","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fiupdatable%2Fobix","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fiupdatable%2Fobix/lists"}