Hyrules / WinHue

Controlling the Philips Hue lighting system from your Windows PC.
http://hyrules.github.io/WinHue/
Other
186 stars 40 forks source link

MQTT #11

Open SyBernot opened 8 years ago

SyBernot commented 8 years ago

(improvement) Any plans on adding MQTT support? A subscribe and publish function would be useful for adding triggers from outside the system, the daylight sensor already seems to be of a similar format. I haven't really looked at the code so I don't know how hard this would be to implement but MQTT is proving to be so trivial to roll in to my other stuff that I would expect it to be fairly easy to add hooks.

Hyrules commented 8 years ago

Unfortunately i have no idea how to implement this in Winhue. Since WinHue is not a server application but a client I hardly see how this would fit in. This is something Philips would have to implement inside the bridge.

SyBernot commented 8 years ago

MQTT is a messaging protocol kind of like a two way rss feed. When something on the bridge changes Winhue would publish to the MQTT broker (say all lights come on so Winhue would see that and would publish a message "on" to /lights/all/state ) any MQTT client that is subscribed to that channel would then receive the message (maybe you want to play a sound from a raspberry pi when the lights come on). Likewise Winhue could subscribe to a channel to be used as a trigger say for instance you have a doorbell that can publish to MQTT when the button is pressed it sends a message "pressed" to /door/front/bell that message then gets sent to all subscribers of that channel and it could serve as a trigger for flashing the lights or changing the color. So Winhue would just be the go between translating outside events to the hub and hub events to the outside.

As a side note I have done a bit of digging to see what other options there might be and I found this https://github.com/dennisdegreef/mqtt-hue-bridge it would be a working solution for me but I think it would be a great feature for Winhue if you decide to tackle it.