Giter Club home page Giter Club logo

philipshue's Introduction

PhilipsHue Monitor

The challenge is to create a program which implements a simple integration with the Philips Hue platform. It should be a simple terminal based program that will print out text based on the state of the lights. When the program starts up, it should print out all lights and their state (we will restrict to only whether the lights are on/off, brightness, name, and ID). The output should be formatted as JSON in the format of the following example:

[  
   {  
      "name":"Red Lamp",
      "id":"1",
      "on":true,
      "brightness":45
   },
   {  
      "name":"Green Lamp",
      "id":"2",
      "on":false,
      "brightness":100
   }
]

Your output does not need to be pretty printed like this, it can be a single line, however printing tab and newline formattedJSON will probably make debugging easier for yourself. The “on” property is simply a boolean of whether the light is on or not. The “brightness” property should be an integer (from 0 to 100) representing the % brightness of the light.

After printing out the initial state, your program should print out any changes in the lights’ state. For example, if the Red Lamp turns off, you should print:

{  
   "id":"1",
   "on":false
}

If the Green Lamp is then turned on, and dimmed to 75%, you would print two changes:

{  
   "id":"2",
   "on":true
}
{  
   "id":"2",
   "brightness":75
}

Dependencies

Developed and tested on ubuntu 16.04, requires: boost, ssl and gmock for testing

Usage

PhilipsHueMonitor -h | --help    : Print usage
PhilipsHueMonitor <IP address>   : Uses provided address to connect to bridge.
                                   Saves in config.ini if successful
PhilipsHueMonitor                : Uses address in config.ini if provided and 
                                   successful otherwise tries to discover bridge via:
                                   1. uPnP (note: not yet implemented!!)
                                   2. www.meethue.com/api/nupnp
                                      
Once connected it prints the current lights and polls the bridge every second to detect changes.

Limitations

  1. The tool does not implement the uPnP discovery mechanism
  2. This has only been tested against Bridge API version 1.21.0
  3. The default (long) timeout is used for socket connections

philipshue's People

Contributors

rcstilborn avatar

Stargazers

 avatar

Watchers

 avatar  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.