pynobo


Namepynobo JSON
Version 1.8.1 PyPI version JSON
download
home_pagehttps://github.com/echoromeo/pynobo
SummaryNobø Hub / Nobø Energy Control TCP/IP Interface
upload_time2024-04-05 19:39:52
maintainerNone
docs_urlNone
authorechoromeo, capelevy, oyvindwe
requires_python<4,>=3.7
licenseGPLv3+
keywords hvac nobø heating automation
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # Nobø Hub / Nobø Energy Control TCP/IP Interface

This system/service/software is not officially supported or endorsed by Glen Dimplex Nordic AS, and the authors/maintainer(s) are not official partner of Glen Dimplex Nordic AS

[The API (v1.1) for Nobø Hub can be found here][api]

[api]: https://www.glendimplex.no/media/15650/nobo-hub-api-v-1-1-integration-for-advanced-users.pdf

## Quick Start

    import asyncio
    from pynobo import nobo

    async def main():
        # Either call using the three last digits in the hub serial
        hub = nobo('123', synchronous=False)
        # or full serial and IP if you do not want to discover on UDP:
        hub = nobo('123123123123', ip='10.0.0.128', discover=False, synchronous=False)

        # Connect to the hub and get initial data
        await hub.connect()

        # Inspect what you get
        def update(hub):
            print(hub.hub_info)
            print(hub.zones)
            print(hub.components)
            print(hub.week_profiles)
            print(hub.overrides)
            print(hub.temperatures)
    
        # Read the initial data
        update(hub)
    
        # Listen for data updates - register before calling hub.start() to avoid race condition
        hub.register_callback(callback=update)

        # Start the background tasks for reading responses and keep connction alive
        # This will connect to the hub if necessary
        await hub.start()

        # Hang around and wait for data updates
        await asyncio.sleep(60)
    
        # Stop the connection
        await hub.stop()

    asyncio.run(main())

## Available functionality

* `nobo` class - When called it will initialize logger and dictionaries, connect to hub and start daemon thread.
* `nobo.API` class - All the commands and responses from API v1.1, Some with sensible names, others not yet given better names.
* `nobo.DiscoveryProtocol` - An `asyncio.DatagramProtocol` used to discover Nobø Ecohubs on the local network.

### Discover and test connection

It is possible to discover hubs on the local network, and also test connectivity, before starting the background tasks.

    # Discover all hubs on local network
    hubs = await nobo.async_discover_hubs()

    # Test connection to the first
    (ip, serial) = hubs.pop()
    hub = nobo(serial + '123', ip=ip, discover=False, synchronous=False)
    await hub.connect()

    # Then start the background tasks
    await hub.start()

    # Or just close the connection right away
    await hub.close()

### Background Tasks

Calling `start()` will first try to discover the Nobø Ecohub on the local network, unless `discover` is set to `False`,
which required IP address and full serial (12 digits).  If an IP address is provided, or the hub is discovered, it
will attempt to connect to it, and if successful, start  the following tasks:

* keep_alive - Send a periodic keep alive message to the hub
* socket_receive - Handle incoming messages from the hub

If the connection is lost, it will attempt to reconnect.

### Command Functions

These functions send commands to the hub.

* async_send_command - Send a list of command string(s) to the hub
* async_create_override - Override hub/zones/components
* async_update_zone - Update the name, week profile, temperature or override allowing for a zone.  
* async_add_week_profile - Create a week profile
* async_update_week_profile - Update a week profile
* async_remove_week_profile - Remove a week profile

### Dictionary helper functions

These functions simplify getting the data you want from the dictionaries. They do
not perform any I/O, and can safely be called from the event loop.

* get_week_profile_status - Get the status of a week profile at a certain time in the week 
* get_current_zone_mode - Get the mode of a zone at a certain time
* get_current_component_temperature - Get the current temperature from a component
* get_current_zone_temperature - Get the current temperature from (the first component in) a zone
* get_zone_override_mode - Get the override mode for the zone

## Backwards compatibility

Synchronous wrapper methods are available for compatibility with v1.1.2, but it is recommended to
switch to the async methods by initializing the hub with `synchronous=False`. Otherwise, initializing
will start the async event loop in a daemon thread, discover and connect to hub before returning as before.

    import time
    from pynobo import nobo
    
    def main():
        # Either call using the three last digits in the hub serial
        hub = nobo('123')
        # or full serial and IP if you do not want to discover on UDP:
        hub = nobo('123123123123', '10.0.0.128', False)
        
        # Inspect what you get
        def update(hub):
            print(hub.hub_info)
            print(hub.zones)
            print(hub.components)
            print(hub.week_profiles)
            print(hub.overrides)
            print(hub.temperatures)
    
        # Listen for data updates - register before getting initial data to avoid race condition
        hub.register_callback(callback=update)
    
        # Get initial data
        update(hub)
    
        # Hang around and wait for data updates
        time.sleep(60)
    
    main()

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/echoromeo/pynobo",
    "name": "pynobo",
    "maintainer": null,
    "docs_url": null,
    "requires_python": "<4,>=3.7",
    "maintainer_email": null,
    "keywords": "hvac nob\u00f8 heating automation",
    "author": "echoromeo, capelevy, oyvindwe",
    "author_email": null,
    "download_url": "https://files.pythonhosted.org/packages/8f/9c/8ba493dfa6fa58eefc8dd3a1fdeb8f388d57d9440b3258010c152d26890a/pynobo-1.8.1.tar.gz",
    "platform": null,
    "description": "# Nob\u00f8 Hub / Nob\u00f8 Energy Control TCP/IP Interface\n\nThis system/service/software is not officially supported or endorsed by Glen Dimplex Nordic AS, and the authors/maintainer(s) are not official partner of Glen Dimplex Nordic AS\n\n[The API (v1.1) for Nob\u00f8 Hub can be found here][api]\n\n[api]: https://www.glendimplex.no/media/15650/nobo-hub-api-v-1-1-integration-for-advanced-users.pdf\n\n## Quick Start\n\n    import asyncio\n    from pynobo import nobo\n\n    async def main():\n        # Either call using the three last digits in the hub serial\n        hub = nobo('123', synchronous=False)\n        # or full serial and IP if you do not want to discover on UDP:\n        hub = nobo('123123123123', ip='10.0.0.128', discover=False, synchronous=False)\n\n        # Connect to the hub and get initial data\n        await hub.connect()\n\n        # Inspect what you get\n        def update(hub):\n            print(hub.hub_info)\n            print(hub.zones)\n            print(hub.components)\n            print(hub.week_profiles)\n            print(hub.overrides)\n            print(hub.temperatures)\n    \n        # Read the initial data\n        update(hub)\n    \n        # Listen for data updates - register before calling hub.start() to avoid race condition\n        hub.register_callback(callback=update)\n\n        # Start the background tasks for reading responses and keep connction alive\n        # This will connect to the hub if necessary\n        await hub.start()\n\n        # Hang around and wait for data updates\n        await asyncio.sleep(60)\n    \n        # Stop the connection\n        await hub.stop()\n\n    asyncio.run(main())\n\n## Available functionality\n\n* `nobo` class - When called it will initialize logger and dictionaries, connect to hub and start daemon thread.\n* `nobo.API` class - All the commands and responses from API v1.1, Some with sensible names, others not yet given better names.\n* `nobo.DiscoveryProtocol` - An `asyncio.DatagramProtocol` used to discover Nob\u00f8 Ecohubs on the local network.\n\n### Discover and test connection\n\nIt is possible to discover hubs on the local network, and also test connectivity, before starting the background tasks.\n\n    # Discover all hubs on local network\n    hubs = await nobo.async_discover_hubs()\n\n    # Test connection to the first\n    (ip, serial) = hubs.pop()\n    hub = nobo(serial + '123', ip=ip, discover=False, synchronous=False)\n    await hub.connect()\n\n    # Then start the background tasks\n    await hub.start()\n\n    # Or just close the connection right away\n    await hub.close()\n\n### Background Tasks\n\nCalling `start()` will first try to discover the Nob\u00f8 Ecohub on the local network, unless `discover` is set to `False`,\nwhich required IP address and full serial (12 digits).  If an IP address is provided, or the hub is discovered, it\nwill attempt to connect to it, and if successful, start  the following tasks:\n\n* keep_alive - Send a periodic keep alive message to the hub\n* socket_receive - Handle incoming messages from the hub\n\nIf the connection is lost, it will attempt to reconnect.\n\n### Command Functions\n\nThese functions send commands to the hub.\n\n* async_send_command - Send a list of command string(s) to the hub\n* async_create_override - Override hub/zones/components\n* async_update_zone - Update the name, week profile, temperature or override allowing for a zone.  \n* async_add_week_profile - Create a week profile\n* async_update_week_profile - Update a week profile\n* async_remove_week_profile - Remove a week profile\n\n### Dictionary helper functions\n\nThese functions simplify getting the data you want from the dictionaries. They do\nnot perform any I/O, and can safely be called from the event loop.\n\n* get_week_profile_status - Get the status of a week profile at a certain time in the week \n* get_current_zone_mode - Get the mode of a zone at a certain time\n* get_current_component_temperature - Get the current temperature from a component\n* get_current_zone_temperature - Get the current temperature from (the first component in) a zone\n* get_zone_override_mode - Get the override mode for the zone\n\n## Backwards compatibility\n\nSynchronous wrapper methods are available for compatibility with v1.1.2, but it is recommended to\nswitch to the async methods by initializing the hub with `synchronous=False`. Otherwise, initializing\nwill start the async event loop in a daemon thread, discover and connect to hub before returning as before.\n\n    import time\n    from pynobo import nobo\n    \n    def main():\n        # Either call using the three last digits in the hub serial\n        hub = nobo('123')\n        # or full serial and IP if you do not want to discover on UDP:\n        hub = nobo('123123123123', '10.0.0.128', False)\n        \n        # Inspect what you get\n        def update(hub):\n            print(hub.hub_info)\n            print(hub.zones)\n            print(hub.components)\n            print(hub.week_profiles)\n            print(hub.overrides)\n            print(hub.temperatures)\n    \n        # Listen for data updates - register before getting initial data to avoid race condition\n        hub.register_callback(callback=update)\n    \n        # Get initial data\n        update(hub)\n    \n        # Hang around and wait for data updates\n        time.sleep(60)\n    \n    main()\n",
    "bugtrack_url": null,
    "license": "GPLv3+",
    "summary": "Nob\u00f8 Hub / Nob\u00f8 Energy Control TCP/IP Interface",
    "version": "1.8.1",
    "project_urls": {
        "Bug Reports": "https://github.com/echoromeo/pynobo/issues",
        "Homepage": "https://github.com/echoromeo/pynobo",
        "Source": "https://github.com/echoromeo/pynobo/blob/master/pynobo.py"
    },
    "split_keywords": [
        "hvac",
        "nob\u00f8",
        "heating",
        "automation"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "dfecf215d3e25519556e86417986639a9a28386bfcdda8eb4006718698bba542",
                "md5": "818ac10c6f012d558f942826f9fcc0d3",
                "sha256": "daa8aa39243c2e03087248c41a5c387a17070f824f6a42031abfa672c2d97a25"
            },
            "downloads": -1,
            "filename": "pynobo-1.8.1-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "818ac10c6f012d558f942826f9fcc0d3",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": "<4,>=3.7",
            "size": 27918,
            "upload_time": "2024-04-05T19:39:51",
            "upload_time_iso_8601": "2024-04-05T19:39:51.284858Z",
            "url": "https://files.pythonhosted.org/packages/df/ec/f215d3e25519556e86417986639a9a28386bfcdda8eb4006718698bba542/pynobo-1.8.1-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "8f9c8ba493dfa6fa58eefc8dd3a1fdeb8f388d57d9440b3258010c152d26890a",
                "md5": "b8d8b41bb5d3346aaee52a744399ac18",
                "sha256": "70cb817d1fbc4fba6810e8cedd25d2f8e87111ee2da5478e384dec0a9a7770ef"
            },
            "downloads": -1,
            "filename": "pynobo-1.8.1.tar.gz",
            "has_sig": false,
            "md5_digest": "b8d8b41bb5d3346aaee52a744399ac18",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": "<4,>=3.7",
            "size": 30223,
            "upload_time": "2024-04-05T19:39:52",
            "upload_time_iso_8601": "2024-04-05T19:39:52.886501Z",
            "url": "https://files.pythonhosted.org/packages/8f/9c/8ba493dfa6fa58eefc8dd3a1fdeb8f388d57d9440b3258010c152d26890a/pynobo-1.8.1.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-04-05 19:39:52",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "echoromeo",
    "github_project": "pynobo",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "lcname": "pynobo"
}
        
Elapsed time: 0.23204s