Skip to main content

Python client for TFA.me weather stations

Project description

tfa_me_ha_local

Async Python client for TFA.me weather station and measurement system.

About

This package allows you to fetch data from a TFA.me station. This module communicates directly towards the IP address of your TFA.me WiFi station in your local network. It is used to connect TFA.me stations to Home Assistant via an integration.

See also on GitHub:

This project tfa_me_ha_local:

TFA.me integration for Home Assistant:

Installation

pip install tfa_me_ha_local

Usage

import json
import logging
import asyncio
from tfa_me_ha_local.client import TFAmeClient
from tfa_me_ha_local.data import TFAmeDataForHA
from tfa_me_ha_local.exceptions import TFAmeException

_LOGGER = logging.getLogger(__name__)

async def main() -> None:
    """Make a client connection to a TFA.me device and request sensor data."""

    host = "192.168.1.38" # Existing IP in local network
    path = "sensors"      # Default path to request measurement data for all sensors
    timeout = 10          # Timeout to establish the connection
    msg = f"Establish connection to '{host}/{path}' ....."
    _LOGGER.info(msg)

    try:
        tfa_me_client = TFAmeClient(host, path, timeout=timeout)
        data = await tfa_me_client.async_get_sensors()
        if not data:
            _LOGGER.error("Error, no data")
            return None
        else:
            _LOGGER.info("Data received:\n'%s'", json.dumps(data, indent=2))
            return data
    except TFAmeException as err:
        _LOGGER.error("Failed to fetch sensors: '%s'", err)


# Main entry point
if __name__ == "__main__":
    logging.basicConfig(level=logging.INFO)
    asyncio.run(main())

Author

The content is by DrMatthiasBlaschke.

License

MIT License

Copyright (c) 2025 synertronixx

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

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

tfa_me_ha_local-1.0.0.tar.gz (7.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

tfa_me_ha_local-1.0.0-py3-none-any.whl (7.3 kB view details)

Uploaded Python 3

File details

Details for the file tfa_me_ha_local-1.0.0.tar.gz.

File metadata

  • Download URL: tfa_me_ha_local-1.0.0.tar.gz
  • Upload date:
  • Size: 7.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.7

File hashes

Hashes for tfa_me_ha_local-1.0.0.tar.gz
Algorithm Hash digest
SHA256 2edb3182b1da355e42c191e7bcd3b1d1a3541a9b6cbba908d47f4be6b694c9d8
MD5 ffd0a2d33c459e4de4139f7faa8baa8d
BLAKE2b-256 9cc5d8eb487a843ae01acda9334720f370d4ca9279a3cfba9192f0f11c5a636d

See more details on using hashes here.

File details

Details for the file tfa_me_ha_local-1.0.0-py3-none-any.whl.

File metadata

File hashes

Hashes for tfa_me_ha_local-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 d9e7f22cfb86a5f1ae905b36b795e021cbd66906a1d64e8c768fa004a611d38f
MD5 9167de668b91bf03bb59fbda62578ee5
BLAKE2b-256 5afe4ec4f1efd3e4a152c8756a988e02933178efccd14178cf0993976c1e8aeb

See more details on using hashes here.

Supported by

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