Giter Club home page Giter Club logo

magic-home's Introduction

Magic Home

Magic Home is a CLI & library for controlling RGB LED light strips.

CLI Usage

> go build .

> ./magic-home

Control Magic Home enabled devices.

  Allows control of LED strips and bulbs compatiable with the Magic Home App (Devices must be connected to the same LAN).

Usage:
  magic-home [command]

Available Commands:
  device      Control device of specific devices
  discover    Discover Magic Home Devices
  help        Help about any command
  power       Control power of specific devices
  scene       Control scene using specific devices

Flags:
  --config string       config file (default is $HOME/.magic-home.yaml)
  -h, --help            help for magic-home

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

Usage

Discover devices on the network.

> ./magic-home discover

Discovering ..........

Discovered the following devices:

IP         	| ID         	| Model
-----------------------------------
192.168.0.30	| C44F33AEB69A	| AK001-ZJ210
192.168.0.32	| D8F15B8446DF	| AK001-ZJ210

Power on a device on the network (using the previous color set).

> ./magic-home power --ip=192.168.0.30 --power=true

Setting power to `on` for 192.168.0.30

Set the color using a preset name for a target device on the network.

> ./magic-home device --ip=192.168.0.30 --color=blue

Setting device color {0 0 255 0} for 192.168.0.30

Set the color using a hex value for a target device on the network.

> ./magic-home device --ip=192.168.0.30 --hex=0000ff

Setting device color {0 0 255 0} for 192.168.0.30

Play a scene for a target device on the network.

> ./magic-home scene --ip=192.168.0.30 --color=blue

Setting device color {0 0 255 0} for 192.168.0.30
Setting device color {0 0 55 0} for 192.168.0.30
Setting device color {0 0 255 0} for 192.168.0.30
Setting device color {0 0 55 0} for 192.168.0.30
Setting device color {0 0 255 0} for 192.168.0.30
Setting device color {0 0 55 0} for 192.168.0.30
Setting device color {0 0 255 0} for 192.168.0.30

Example

Name Description
Blink Blink device by setting color to white, and toggling device power on/off.
Color Cycle an array of color presets for a device by setting color to each color with a delay between changes.
Discover Discover a list of available devices on the local network.
Scene Cycle through an array of colors with a delay between changes for a number of iterations.
State Power a device's on and then power the same device off.
Temperature Cycle an array of color temperatures for a device by setting color to each color with a delay between changes.

Disclaimer

As this library controls physical hardware on a LAN, you should use your judgment to decide if the changes you are making may negatively impact your hardware.

magic-home's People

Contributors

apoclyps avatar caioeverest avatar dependabot-preview[bot] avatar dependabot[bot] avatar kashifsoofi avatar rafaelrubbioli avatar trevorcarter83 avatar

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

magic-home's Issues

Improve documentation

What's Required?

Currently, most of the library is documented however there may be functions and other areas of the codebase that have yet to be updated. Take a general pass at improving the documentation with relevant information.

Acceptance Criteria

  • Must improve missing or existing documentation.

Add a new example

What's Required?

Currently, there are examples for all commands and some extras such as spectrum cycling via colours. This is an open-ended creative exercise to find a new and inventive way's to use the library.

Acceptance Criteria

  • Add a new example that provides some new functionality as an example
  • Example must run and should contain a description within the README

Improve Release Process

What's Required?

The current GitHub action provides a release for windows, mac, and linux however using https://github.com/goreleaser/goreleaser-action#usage would provide improved support for releasing other architectures/distributions.

The following blog post provides information on how this might be done: https://dev.to/koddr/github-action-for-release-your-go-projects-as-fast-and-easily-as-possible-20a2

Acceptance Criteria

  • Replace existing GitHub action releases with go-releaser
  • Include support for additional architectures/distributions

Improve error handling

What's Required?

The codebase is currently littered with os.Exit(1). In most of these occurrences, the code could be improved by returning an error.

For example,

os.Exit(1)
could return an InvalidPowerState error removing the logging and os.Exit(1) from the pkg and instead letting the power cmd handle the error.

Implement tests for Cobra Commands

What's Required

The CLI has been created using Cobra. At present, there are no tests to cover the commands behave as expected.

Add one or more tests to mock the UDP requests and ensure the logic work's as expected.

Acceptance Criteria

  • One or more examples of a suitable test for exercising the Cobra command logic.

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.