Skip to content
/ mihome Public
forked from jon1012/mihome

Python bindngs for the Xiaomi Mi Home zigbee hub and associated devices

Notifications You must be signed in to change notification settings

Niii/mihome

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Library to use the Xiaomi Mi Home zigbee hub.

Example of usage as a simple mqtt relay:

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()

About

Python bindngs for the Xiaomi Mi Home zigbee hub and associated devices

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Python 100.0%