pymeteobridgedata


Namepymeteobridgedata JSON
Version 0.1.20 PyPI version JSON
download
home_pagehttps://github.com/briis/pymeteobridge
SummaryPython Wrapper to communicate with a Meteobridge Weather Data Logger
upload_time2023-02-04 12:15:58
maintainer
docs_urlNone
authorBjarne Riis
requires_python
licenseMIT
keywords meteobridge weather pws personal-weather-station python
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # Python Wrapper for Meteobridge Datalogger

![Latest PyPI version](https://img.shields.io/pypi/v/pymeteobridgedata) ![Supported Python](https://img.shields.io/pypi/pyversions/pymeteobridgedata)

This module communicates with a [Meteobridge Datalogger](https://www.meteobridge.com/wiki/index.php/Home) using [their Template Script](https://www.meteobridge.com/wiki/index.php/Add-On_Services).

The module is primarily written for the purpose of being used in Home Assistant for the Custom Integration called `meteobridge` but might be used for other purposes also.

## Install

`pymeteobridgedata` is avaible on [PyPi](https://pypi.org/project/pymeteobridgedata/):

```bash
pip install pymeteobridgedata
```

## Usage

This library is primarily designed to be used in an async context.

The main interface for the library is the `pymeteobridgedata.MeteobridgeApiClient`. This interface takes 6 options:

* `username`: (required) The username to login to your Meteobridge device. Default this *meteobridge*.
* `password`: (required) The password for your meteobridge device.
* `ip_address`: (required) IP Address of the Meteobridge device.
* `units`: (optional) Valid options here are *metric* or *imperial*. Metebridge devices always deliver data in metric units, so conversion will only take place if if metric is not selected. Default value is **metric**
* `extra_sensors`: (optional) Number of extra sensors attached to the Meteobridge Logger (Default is 0, max is 7)
* `homeassistant`: (optional) Valid options are *True* or *False*. If set to True, there will be some unit types that will not be converted, as Home Assistant will take care of that. Default value is **True**

### Example Python script

```python
import asyncio
import logging
import time

from pymeteobridgedata import MeteobridgeApiClient, Invalid, NotAuthorized, BadRequest
from pymeteobridgedata.data import DataLoggerDescription, ObservationDescription

_LOGGER = logging.getLogger(__name__)

async def main() -> None:
    logging.basicConfig(level=logging.DEBUG)
    start = time.time()

    meteobridge = MeteobridgeApiClient(USERNAME, PASSWORD, IP_ADDRESS, homeassistant=False, units="imperial", extra_sensors=0)
    try:
        await meteobridge.initialize()

    except Invalid as err:
        _LOGGER.debug(err)
    except NotAuthorized as err:
        _LOGGER.debug(err)
    except BadRequest as err:
        _LOGGER.debug(err)

    data: DataLoggerDescription = meteobridge.device_data
    if data is not None:
        for field in data.__dataclass_fields__:
            value = getattr(data, field)
            print(field,"-", value)

    data: ObservationDescription = await meteobridge.update_observations()
    if data is not None:
        for field in data.__dataclass_fields__:
            value = getattr(data, field)
            print(field,"-", value)


    end = time.time()

    await meteobridge.req.close()

    _LOGGER.info("Execution time: %s seconds", end - start)

asyncio.run(main())
```

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/briis/pymeteobridge",
    "name": "pymeteobridgedata",
    "maintainer": "",
    "docs_url": null,
    "requires_python": "",
    "maintainer_email": "",
    "keywords": "Meteobridge,Weather,pws,personal-weather-station Python",
    "author": "Bjarne Riis",
    "author_email": "bjarne@briis.com",
    "download_url": "https://files.pythonhosted.org/packages/3a/6c/4352249f5ad39257172aa26daed9d4fb9aa261b43f39fc685f4aac88bca7/pymeteobridgedata-0.1.20.tar.gz",
    "platform": null,
    "description": "# Python Wrapper for Meteobridge Datalogger\n\n![Latest PyPI version](https://img.shields.io/pypi/v/pymeteobridgedata) ![Supported Python](https://img.shields.io/pypi/pyversions/pymeteobridgedata)\n\nThis module communicates with a [Meteobridge Datalogger](https://www.meteobridge.com/wiki/index.php/Home) using [their Template Script](https://www.meteobridge.com/wiki/index.php/Add-On_Services).\n\nThe module is primarily written for the purpose of being used in Home Assistant for the Custom Integration called `meteobridge` but might be used for other purposes also.\n\n## Install\n\n`pymeteobridgedata` is avaible on [PyPi](https://pypi.org/project/pymeteobridgedata/):\n\n```bash\npip install pymeteobridgedata\n```\n\n## Usage\n\nThis library is primarily designed to be used in an async context.\n\nThe main interface for the library is the `pymeteobridgedata.MeteobridgeApiClient`. This interface takes 6 options:\n\n* `username`: (required) The username to login to your Meteobridge device. Default this *meteobridge*.\n* `password`: (required) The password for your meteobridge device.\n* `ip_address`: (required) IP Address of the Meteobridge device.\n* `units`: (optional) Valid options here are *metric* or *imperial*. Metebridge devices always deliver data in metric units, so conversion will only take place if if metric is not selected. Default value is **metric**\n* `extra_sensors`: (optional) Number of extra sensors attached to the Meteobridge Logger (Default is 0, max is 7)\n* `homeassistant`: (optional) Valid options are *True* or *False*. If set to True, there will be some unit types that will not be converted, as Home Assistant will take care of that. Default value is **True**\n\n### Example Python script\n\n```python\nimport asyncio\nimport logging\nimport time\n\nfrom pymeteobridgedata import MeteobridgeApiClient, Invalid, NotAuthorized, BadRequest\nfrom pymeteobridgedata.data import DataLoggerDescription, ObservationDescription\n\n_LOGGER = logging.getLogger(__name__)\n\nasync def main() -> None:\n    logging.basicConfig(level=logging.DEBUG)\n    start = time.time()\n\n    meteobridge = MeteobridgeApiClient(USERNAME, PASSWORD, IP_ADDRESS, homeassistant=False, units=\"imperial\", extra_sensors=0)\n    try:\n        await meteobridge.initialize()\n\n    except Invalid as err:\n        _LOGGER.debug(err)\n    except NotAuthorized as err:\n        _LOGGER.debug(err)\n    except BadRequest as err:\n        _LOGGER.debug(err)\n\n    data: DataLoggerDescription = meteobridge.device_data\n    if data is not None:\n        for field in data.__dataclass_fields__:\n            value = getattr(data, field)\n            print(field,\"-\", value)\n\n    data: ObservationDescription = await meteobridge.update_observations()\n    if data is not None:\n        for field in data.__dataclass_fields__:\n            value = getattr(data, field)\n            print(field,\"-\", value)\n\n\n    end = time.time()\n\n    await meteobridge.req.close()\n\n    _LOGGER.info(\"Execution time: %s seconds\", end - start)\n\nasyncio.run(main())\n```\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "Python Wrapper to communicate with a Meteobridge Weather Data Logger",
    "version": "0.1.20",
    "split_keywords": [
        "meteobridge",
        "weather",
        "pws",
        "personal-weather-station python"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "ebdc5db81daac5db42bebbe1e1b1fc4328d8ee4ccdee1d1c5869ad3998cae9bb",
                "md5": "983154074c246ee571ed41c507559726",
                "sha256": "82c638a7fa6bc89c74c63b16e3897fc89449b6de640b4c8c1c6d90118b2884c1"
            },
            "downloads": -1,
            "filename": "pymeteobridgedata-0.1.20-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "983154074c246ee571ed41c507559726",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": null,
            "size": 12895,
            "upload_time": "2023-02-04T12:15:56",
            "upload_time_iso_8601": "2023-02-04T12:15:56.278639Z",
            "url": "https://files.pythonhosted.org/packages/eb/dc/5db81daac5db42bebbe1e1b1fc4328d8ee4ccdee1d1c5869ad3998cae9bb/pymeteobridgedata-0.1.20-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "3a6c4352249f5ad39257172aa26daed9d4fb9aa261b43f39fc685f4aac88bca7",
                "md5": "a9b096bacc5d33f9905ae220ca911df4",
                "sha256": "29947fa43d84a3a13cc7f88ecfc3f8b32822239ead9ba0edf715db17f5d1ad20"
            },
            "downloads": -1,
            "filename": "pymeteobridgedata-0.1.20.tar.gz",
            "has_sig": false,
            "md5_digest": "a9b096bacc5d33f9905ae220ca911df4",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": null,
            "size": 13858,
            "upload_time": "2023-02-04T12:15:58",
            "upload_time_iso_8601": "2023-02-04T12:15:58.011782Z",
            "url": "https://files.pythonhosted.org/packages/3a/6c/4352249f5ad39257172aa26daed9d4fb9aa261b43f39fc685f4aac88bca7/pymeteobridgedata-0.1.20.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-02-04 12:15:58",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "github_user": "briis",
    "github_project": "pymeteobridge",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "tox": true,
    "lcname": "pymeteobridgedata"
}
        
Elapsed time: 0.16763s