Created
November 17, 2022 01:32
-
-
Save SomeoneSerge/e2c7eb326418aee634d7b058c4cb1b18 to your computer and use it in GitHub Desktop.
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
import binascii | |
import codecs | |
from miio.discovery import Discovery | |
from miio.miioprotocol import MiIOProtocol | |
if __name__ == "__main__": | |
reply = MiIOProtocol.discover("192.168.5.1", timeout=60) | |
token = codecs.encode(reply.checksum, "hex") | |
device_id = binascii.hexlify(reply.header.value.device_id).decode() | |
print(f"{device_id=}") | |
print(f"{token=}") |
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
with (import <nixpkgs> { }); | |
let | |
py = python3.withPackages (ps: with ps; [ | |
python-miio | |
]); | |
in | |
mkShell { | |
packages = [ | |
py | |
iw | |
tcpdump | |
bridge-utils | |
]; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment