Skip to main content

A Python3 class to interrogate Xiaomi Mijia LYWSD* sensors.

Project description

PyPI version Supported Python versions PyPI downloads Code style: Black pre-commit.ci status

pylywsdxx

This is a Python3 library to allow interrogation of Xiaomi Mijia LYWSD* sensors via Bluetooth Low Energy (BLE).

Note: This is an unofficial project, and is in no way supported or endorsed by Xiaomi.

Requirements

This module requires bluepy3 which should be installed automagically when using the installation instructions below.

Development of this package is done in Python 3.11. The package is considered forwards compatible at least upto Python 3.12 and probably also beyond. Backwards compatibility is not guaranteed; if it works on Python 3.9 or before consider yourself lucky. Python versions that are end-of-life are not supported.

The package has been extensively tested on a Raspberry Pi 3 Model B+ (aarch64) with Debian GNU Linux 12 /w Python 3.11.*.

Installation

pip install pylywsdxx

Usage

import pylywsdxx as pyly

mac = "A4:C1:38:0D:EA:D0"

device2 = pyly.Lywsd02(mac)
data2 = device2.data
print(f"Temperature: {data2.temperature}°C")

device3 = pyly.Lywsd03(mac)
data3 = device3.data
print(f"Temperature: {data3.temperature}°C")

Please note that this module has completely and intentionally broken backwards compatibility with previous and existing versions of lywsd02 and lywsd03mmc and with v1.* versions of itself.

Acknowledgements

Based on previous work stolen from Mikhail Baranov (h4) : lywsd02 and Duncan Barclay (uduncanu) : lywsd03mmc

License

See LICENSE.

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

pylywsdxx-2.2.2.tar.gz (12.7 kB view details)

Uploaded Source

Built Distribution

pylywsdxx-2.2.2-py3-none-any.whl (13.6 kB view details)

Uploaded Python 3

File details

Details for the file pylywsdxx-2.2.2.tar.gz.

File metadata

  • Download URL: pylywsdxx-2.2.2.tar.gz
  • Upload date:
  • Size: 12.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.12.6

File hashes

Hashes for pylywsdxx-2.2.2.tar.gz
Algorithm Hash digest
SHA256 ebeae1fe8863dd76261029b90512248d3f4a24a06207737752949017edcee3bd
MD5 d493285dabfddc9b1ed6a63694eeec3d
BLAKE2b-256 af7f2798e49936adef58d9371f0349ff28dd6a3d2342f1a53cb7c3476e04cccc

See more details on using hashes here.

File details

Details for the file pylywsdxx-2.2.2-py3-none-any.whl.

File metadata

  • Download URL: pylywsdxx-2.2.2-py3-none-any.whl
  • Upload date:
  • Size: 13.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.12.6

File hashes

Hashes for pylywsdxx-2.2.2-py3-none-any.whl
Algorithm Hash digest
SHA256 57df33109f038cb812580e41603e2248e3cd316c6a5198ba7f558d0cec978b5a
MD5 dddad73ed2794a103983341e55abd794
BLAKE2b-256 9538a2fd6c183e5bc1c61de48a8819884cad45faee74b3554025de5b85d4785d

See more details on using hashes here.

Supported by

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