diff --git a/Script-Cookbook.md b/Script-Cookbook.md index 57ab1068..21d283d8 100644 --- a/Script-Cookbook.md +++ b/Script-Cookbook.md @@ -9,6 +9,7 @@ - [Fast Polling](#Fast-Polling) - [Switching and Dimming By Recognizing Mains Power Frequency](#Switching-and-Dimming-By-Recognizing-Mains-Power-Frequency) - [Web UI](#Web-UI) +- [Hue Emulation](#hue-emulation) [Back To Top](#top) @@ -1124,4 +1125,37 @@ tx(color "color:   ") [Back To Top](#top) ------------------------------------------------------------------------------ +#### Hue Emulation +An example to show how to respond to Alexa requests via Hue Emulation + +When Alexa sends on/off, dimmer, and color (via hsb), send commands to a MagicHome device + +>**>D** +pwr1=0 +hue1=0 +sat1=0 +bri1=0 +tmp=0 + +>**>E** +if upd[hue1]>0 +or upd[sat1]>0 +or upd[bri1]>0 +then +tmp=hue1/182 +->websend [192.168.178.84] hsbcolor %tmp%,%sat1%,%bri1% +endif +> +>if upd[pwr1]>0 +then +->websend [192.168.178.84] power1 %pwr1% +endif + +>**>H** +; on,hue,sat,bri,ct +livingroom,E,on=pwr1,hue=hue1,sat=sat1,bri=bri1 + +[Back To Top](#top) + +------------------------------------------------------------------------------