Skip to main content

Xiaomi Mi Home Python bindings

Project description

Library to use the Xiaomi Mi Home zigbee hub (receive paquets, events for now).


Example of usage as a simple mqtt relay:

```python
import paho.mqtt.client as mqtt

MQTT_SERVER = "192.168.0.149"
MQTT_PORT = 1883

PATH_FMT = "xiaomi/{model}/{sid}/{prop}" # short_id or sid ?

def prepare_mqtt():
client = mqtt.Client()
client.connect(MQTT_SERVER, MQTT_PORT, 60)

return client

def push_data(client, model, sid, cmd, data):
for key, value in data.items():
path = PATH_FMT.format(model=model,
sid=sid,
cmd=cmd,
prop=key)
client.publish(path, payload=value, qos=0)

client = prepare_mqtt()
cb = lambda m, s, c, d: push_data(client, m, s, c, d)
connector = XiaomiConnector(data_callback=cb)

while True:
connector.check_incoming()
```

For more information on the protocol and devices, see my notes: https://notes.jmsinfor.com/blog/post/admin/Xiaomi-Hub


Project details


Release history Release notifications

This version

0.1

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for mihome, version 0.1
Filename, size File type Python version Upload date Hashes
Filename, size mihome-0.1-py2.py3-none-any.whl (4.9 kB) File type Wheel Python version py2.py3 Upload date Hashes View hashes
Filename, size mihome-0.1.tar.gz (3.1 kB) File type Source Python version None Upload date Hashes View hashes

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page