GithubHelp home page GithubHelp logo

miio's Introduction

Getting started

Xiaomi IoT devices protocol

Usage

MiIO protocol

Example

device := miio.NewDevice("address","token")
if err := device.Dial(context.Background());err != nil{
	return
}
defer device.Close()

if info,err := device.Info(context.Background());err == nil{
	fmt.Println(info)
}

Method

  • Info Get device info
  • GetAttributes Get device props
  • GetProperties Get device properties
  • SetProperties Set device properties
  • Action Execute device action
  • Execute Execute command

Mi Cloud

Example

client := cloud.New("country","username","password")

if err = client.Login(context.Background());err != nil {
	return
}
client.GetHomes(context.Background())

Method

  • Login Login Mi cloud
  • GetHomes Get mi homes
  • GetHomeDevices Get home devices
  • GetDevices Get all devices
  • GetLastMessage Get last messages
  • GetSensorHistory Get sensor histories
  • GetDeviceProps Get device properties, like miio GetProperties
  • SetDeviceProps Set device properties, like miio SetProperties
  • ExecuteDeviceAction Execute device action, like miio Action
  • Request do http request

Command

build command

go build -o bin/miio cmd/main.go

miio command help

$ miio --help

miio an analog terminal that implements miio, capable of obtaining properties and sending instructions

Usage:
  miio [command]

Available Commands:
  action         Do device action
  completion     Generate the autocompletion script for the specified shell
  execute        Execute device command
  get_properties Get device properties
  help           Help about any command
  info           Show device info
  parse_pcap     Parse pcap filename
  set_properties Set device properties

Flags:
  -h, --help           help for miio
      --ip string      device address
      --token string   device token

Use "miio [command] --help" for more information about a command.

Protocl

Check full protocol specs here.

miio's People

Contributors

uole avatar

Stargazers

 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.