Skip to main content

A client package for interacting with oBIX(Open Building Information Exchange)

Project description

oBIX

A client package for interacting with oBIX(Open Building Information Exchange)

Very simple function realization, not suitable for production environment

Installation

pip install oBIX

sample

import unittest
from oBIX.client.client import Client, DataType
from datetime import datetime, timezone, timedelta


class ClientTest(unittest.TestCase):
    client = Client("127.0.0.1", "userName", "password")

    def test_read_point(self):
        point = self.client.read_point("/config/AHU1/OutDoorTemp/")
        self.assertTrue(isinstance(point, dict))

    def test_read_point_value(self):
        point = self.client.read_point_value("/config/AHU1/OutDoorTemp/")
        self.assertTrue(isinstance(point, float))

    def test_set_point_value(self):
        point_path = "/config/AHU1/OutDoorTemp"
        point_set_value = 19
        set_result = self.client.set_point_value(point_path, point_set_value, DataType.real)
        self.assertEqual(set_result, "OK")
        point = self.client.read_point_value(point_path)  # 再次读取验证
        self.assertEqual(point, point_set_value)

    def test_set_point_auto(self):
        point_path = "/config/AHU1/OutDoorTemp"
        set_result = self.client.set_point_auto(point_path, DataType.real)
        self.assertEqual(set_result, "OK")

    def test_read_history(self):
        history = self.client.read_history("Station02", "OutDoorTemp",
                                           datetime(2020, 9, 7, 13, 10,  tzinfo=timezone(timedelta(hours=8))),
                                           datetime(2020, 9, 7, 13, 20,  tzinfo=timezone(timedelta(hours=8))))
        self.assertTrue(len(history) > 0)

        limit_num = 9
        history = self.client.read_history("Station02", "OutDoorTemp",
                                           datetime(2020, 9, 7, 13, 10, tzinfo=timezone(timedelta(hours=8))),
                                           limit=limit_num)
        self.assertTrue(len(history) == limit_num)

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

oBIX-0.3.0.tar.gz (10.5 kB view details)

Uploaded Source

File details

Details for the file oBIX-0.3.0.tar.gz.

File metadata

  • Download URL: oBIX-0.3.0.tar.gz
  • Upload date:
  • Size: 10.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/49.2.0 requests-toolbelt/0.9.1 tqdm/4.48.2 CPython/3.7.5

File hashes

Hashes for oBIX-0.3.0.tar.gz
Algorithm Hash digest
SHA256 4dcaac51ee6df40b1d7eef7632ac00f9e76e29889263f637ddd6af4a5625f079
MD5 2ed86f36a6a59bb5a08d50eddb6705e3
BLAKE2b-256 643e5f5bc37eaee5f39efb0441ba3318f21c36fa127223b56d1099f07aaf6945

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page