Created
January 6, 2020 07:10
-
-
Save curtis86/cc1c1d5c79367fac1757f2e720bae221 to your computer and use it in GitHub Desktop.
Xiaomi lywsd02 python
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # 1. Get MAC address - 'lescan' is persistent, look out for 'LYWSD02' and then CTRL+C and note MAC address: | |
| hcitool lescan | |
| # 2. Install python3 package: | |
| pip3 install lywsd02 | |
| # 3. Python3 script: | |
| #!/usr/bin/env python3 | |
| from lywsd02 import Lywsd02Client | |
| mac = 'YO:UR:MA:CA:DD:RE:SS' | |
| client = Lywsd02Client(mac) | |
| temperature = client.temperature | |
| humidity = client.humidity | |
| battery = client.battery | |
| print(temperature,humidity,battery) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment