Metadata-Version: 2.1
Name: switchbotmeter
Version: 0.0.1
Project-URL: Documentation, https://github.com/unknown/switchbotmeter#readme
Project-URL: Issues, https://github.com/unknown/switchbotmeter/issues
Project-URL: Source, https://github.com/unknown/switchbotmeter
Author-email: David Francos <me@davidfrancos.net>
License-Expression: GPL-3.0
License-File: LICENSE
Classifier: Development Status :: 4 - Beta
Classifier: Programming Language :: Python
Classifier: Programming Language :: Python :: 3.8
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: Implementation :: CPython
Classifier: Programming Language :: Python :: Implementation :: PyPy
Requires-Python: >=3.7
Requires-Dist: bluepy~=1.3.0
Description-Content-Type: text/x-rst

.. image:: ./docs/switchbot.png

**Python Swithbot Meter API**

Comprehensible `SwitchBot Meter <https://www.switch-bot.com/products/switchbot-meter>`_ API.
Read your SwitchBot Meter status in real time via BLE. 

|pypi| |downloads| |python_versions| |pypi_versions| |coverage| |actions|

.. |pypi| image:: https://img.shields.io/pypi/l/switchbotmeter
.. |downloads| image:: https://img.shields.io/pypi/dm/switchbotmeter
.. |python_versions| image:: https://img.shields.io/pypi/pyversions/switchbotmeter
.. |pypi_versions| image:: https://img.shields.io/pypi/v/switchbotmeter
.. |coverage| image:: https://codecov.io/gh/XayOn/switchbotmeter/branch/develop/graph/badge.svg
    :target: https://codecov.io/gh/XayOn/switchbotmeter
.. |actions| image:: https://github.com/XayOn/switchbotmeter/workflows/CI%20commit/badge.svg
    :target: https://github.com/XayOn/switchbotmeter/actions

Installation
------------

This library is available on `Pypi
<https://pypi.org/project/switchbotmeter/>`_, you can install it directly with
pip

.. code:: bash

        pip install switchbotmeter

This library acts as a BLE client, so you need a
BLE-capable device (a bluetooth dongle or integrated)

Usage
-----

This library exports a DeviceScanner object that will
dected any SwitchBot Meter devices nearby. 
Note that you need to have permissions to access your
bluetooth device, the scope of wich will not be covered by
this readme :

.. code:: python

    from switchbotmeter import DevScanner

    for current_devices in DevScanner(): 
        for device in current_devices:
            print(device)
            print(f'{device.mac} -> {device.temp}')


.. code:: bash

    <T temp: 19.8 humidity: 73> (c6:97:89:d6:c8:09)
    c6:97:89:d6:c8:09 -> 19.8
    ...
    <T temp: 20.4 humidity: 71> (c6:97:89:d6:c8:09)
    c6:97:89:d6:c8:09 -> 20.4

If your device is shown but not returned by DevScanner, it wasn't identified as
a SwitchBot meter. In this case, pass the MAC address to DevScanner, e.g.:

.. code:: python

    DevScanner(macs=['c6:97:89:d6:c8:09'])
