Skip to content

XayOn/switchbotmeter

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

25 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

image

Python Swithbot Meter API

Comprehensible SwitchBot Meter API. Read your SwitchBot Meter status in real time via BLE.

pypi downloads python_versions pypi_versions coverage actions

Installation

This library is available on Pypi, you can install it directly with pip

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 :

from switchbotmeter import DevScanner

for current_devices in DevScanner(): 
    for device in current_devices:
        print(device)
        print(f'{device.mac} -> {device.temp}')
<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.:

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