New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

milight-v6

Package Overview
Dependencies
Maintainers
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

milight-v6

  • 0.2.0
  • Rubygems
  • Socket score

Version published
Maintainers
1
Created
Source

Milight Wifi Bridge v6 Ruby API

Gem Version Build Status Code Climate

This gem provides a Ruby API for the Mi-Light Wifi Bridge using protocol version 6.

Supported devices are the Mi-Light WiFi iBox models 1 and 2. The esp8266_milight_hub should also work, but I haven't tested this yet. The bridges sold under the brand MiBoxer (such as model WL-Box1) are not supported by this gem.

Installation

Add this line to your application's Gemfile:

gem 'milight-v6'

And then execute:

$ bundle

Or install it yourself as:

$ gem install milight-v6

Usage

Connecting to a Mi-Light controller

Connect to a Mi-Light controller by creating an instance of Milight::V6::Controller and supplying the IP address of the Mi-Light Wifi Bridge. If you don't know the IP address, you can use the class method search to discover devices on the local network.

require "milight/v6"

controller = Milight::V6::Controller.new("192.168.178.33")

controllers = Milight::V6::Controller.search

Sending commands

First select what you want control: the bridge lamp, a specific zone or all zones. Then you can start sending commands. See Milight::V6::All, Milight::V6::Bridge and Milight::V6::Zone for the supported commands.

Some examples:

controller.zone(1).on

controller.zone(2).on
controller.zone(2).warm_light.brightness(70)

controller.zone(3).on
controller.zone(3).hue(Milight::V6::Color::BLUE).saturation(10)

controller.bridge.on
controller.bridge.brightness(50)

controller.all.off

The commands will be sent with an interval of 100ms, to prevent commands being dropped by the controller. You can change or disable this by setting the wait parameter when creating an instance of Milight::V6::Controller, for example:

controller = Milight::V6::Controller.new("192.168.178.33", wait: false)  # don't delay commands

controller = Milight::V6::Controller.new("192.168.178.33", wait: 0.05)   # delay commands for 50 ms

Command line

A command line tool is included which can be used to control the lights.

Usage: milight <host> <command> [zone]

Supported commands: search, on, off, link, unlink

Examples:

$ milight search               # search for devices
$ milight 192.168.178.33 on 1  # turn on lights for zone 1
$ milight 192.168.178.33 off   # turn off lights for all zones

Contributing

Bug reports and pull requests are welcome on GitHub at https://github.com/ppostma/milight-v6-api.

License

The gem is available as open source under the terms of the MIT License.

FAQs

Package last updated on 28 Apr 2021

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc