miio

package module
v0.0.0-...-379bc4c Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 25, 2019 License: MIT Imports: 7 Imported by: 1

README

miio-go

Coverage Status

An implementation of the miIO home protocol by Xiaomi written in Golang. Heavily inspired by:

This implementation has been design with the following concerns:

  • Testability
  • Development without a miIO device handy (or performing any real network operations)
  • A simple event-based API.

Supported Devices

At the moment, only the following devices are officially supported by this library. Feel free to submit a pull request, I'd be more than happy to have more devices supported by this library.

  • Xiaomi Mi Smart WiFi Socket (v1 - no USB) (chuangmi.plug.m1)
  • Xiamoi Yeelight (yeelink.light.color1)

Simulator

A device simulator/emulator exists in the simulator package. It takes advantage of the low level network used to communicate with real devices to emulate hardware devices.

Give it a try!

Tokens

Documentation coming soon...

Examples

Documentation coming soon...

CLI

A CLI exists to allow controlling devices using this library.

usage: miio-go CLI [<flags>] <command> [<args> ...]

CLI application to manually test miio-go functionality

Flags:
  --help            Show context-sensitive help (also try --help-long and --help-man).
  --local           Send broadcast to 127.0.0.1 instead of 255.255.255.255 (For use with locally hosted simulator)
  --log-level=warn  Set MiiO to a specific log level

Commands:
  help [<command>...]
    Show help.


  control brightness <brightness>
    Set device brightness


  control power <state>
    Set device power


  control color hsv <hue> <saturation>
    Set color using HSV values


  control color rgb <red> <green> <blue>
    Set color using RGB values


  discover
    Discover devices on the local network

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client struct {
	sync.RWMutex
	subscription.SubscriptionTarget
	// contains filtered or unexported fields
}

func NewClient

func NewClient() (*Client, error)

NewClient creates a new default Client with the protocol.

func NewClientWithProtocol

func NewClientWithProtocol(protocol protocol.Protocol) (*Client, error)

func (*Client) SetDiscoveryInterval

func (c *Client) SetDiscoveryInterval(interval time.Duration)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL