Code Monkey home page Code Monkey logo

hue-upnp's Introduction

Description

This is a simple customizable Philips hue emulator that works with a Harmony remote (and now the Amazon Echo -thanks to jimboca). The main purpose is to allow the Harmony/Echo to run anything and not just hue light bulbs.

Why

I don't own a Philips hue but I wanted an emulator so I could test it against my Harmony remote which supports them. I found a number of emulators but none of them worked with the Harmony remote. Sagen's python code was easiest to modify and do what I needed. I've never coded in python before so this was a good experience.

How to use it for wake-on-lan

  • Adjust IP-Address in hueUpnp_config.py
  • Adjust MAC-Address in hue-upnp-helper.sh
  • Run it with python hueUpnp.py

Some pitfalls to mention:

  1. The UDP response needs to be bound to port 1900 (like the request) and sent to the same port that the client used (for Harmony)

  2. Harmony sends three ST requests at a time:

ST: ssdp:all 
ST: urn:schemas-upnp-org:device:basic:1
ST: urn:schemas-udap:service:smartText:1
  1. The Harmony remote will only progress if you reply back with the same ST. All other examples online use this ST instead:
ST: upnp:rootdevice 
  1. I got hung up on the smartText one for a while. It turns out this has something to do with LG TVs. I have no idea why it is using it.

  2. The HTTP PORT used can be anything and the Harmony remote will use it. However, if you use the standard Phillip Hue Android (and iOS?), you need to use port 80.

  3. I added in a EXTERNALPROG call, so anyone can toss in their own commands. I use this so I can remotely call WakeOnLan using my remote. I also use it to call a Wemo On-Off script. For whatever reason Logitech doesn't support Wemos (yet).

History


Aug 2015: Logitech firmware broke things for me. I noticed that FIN packets were getting sent during the "GET /api/lights" calls before it got the results. I removed some of the 1 seconds sleeps that I don't think are needed and I also updated it so additional 'request.recv' aren't done unless a content-length > 0 is found. Things appear to be back in business now.


Nov 2015: Now supports the Amazon Echo as well (Thanks Jimboca)


Dec 2015: Pulled in jimboca code which includes a nice json parser. Also, moved everything configurable to a config file: hueUpnp_config.py. Another note is the hue-upnp-helper.sh now expects the device name instead of the device number as the first parameter.

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.