Updated Script Cookbook (markdown)

Michael Ingraham 2019-09-17 09:44:26 -04:00
parent f661de6219
commit f67265249d
1 changed files with 10 additions and 12 deletions

@ -8,7 +8,7 @@
- [Multiple IR Receiver Synchronization](#Multiple-IR-Receiver-Synchronization) - [Multiple IR Receiver Synchronization](#Multiple-IR-Receiver-Synchronization)
- [Fast Polling](#Fast-Polling) - [Fast Polling](#Fast-Polling)
- [Switching and Dimming By Recognizing Mains Power Frequency](#Switching-and-Dimming-By-Recognizing-Mains-Power-Frequency) - [Switching and Dimming By Recognizing Mains Power Frequency](#Switching-and-Dimming-By-Recognizing-Mains-Power-Frequency)
- [WEB user io demo](#WEB-user-io-demo) - [Web UI](#Web-UI)
[Back To Top](#top) [Back To Top](#top)
@ -1080,12 +1080,10 @@ dim="FF55"+hn(tmp*dimmlp)+"05DC0A"
------------------------------------------------------------------------------ ------------------------------------------------------------------------------
#### Web UI
An example to show how to implement a web UI. This example controls a light via `WebSend`
#### WEB user io demo >**>D**
example to show how to implement WEB user io
used to control a light device via websend
\>D
dimmer=0 dimmer=0
sw=0 sw=0
color="" color=""
@ -1095,25 +1093,25 @@ green=0
blue=0 blue=0
ww=0 ww=0
\>F >**>F**
color=hn(red)+hn(green)+hn(blue)+hn(ww) color=hn(red)+hn(green)+hn(blue)+hn(ww)
if color!=col1 if color!=col1
then then
col1=color col1=color
=>websend [192.168.178.75] color %color% =>websend [192.168.178.75] color %color%
endif endif
>
if chg[dimmer]>0 >if chg[dimmer]>0
then then
=>websend [192.168.178.75] dimmer %dimmer% =>websend [192.168.178.75] dimmer %dimmer%
endif endif
>
if chg[sw]>0 >if chg[sw]>0
then then
=>websend [192.168.178.75] power1 %sw% =>websend [192.168.178.75] power1 %sw%
endif endif
\>W >**>W**
bu(sw "Light on" "Light off") bu(sw "Light on" "Light off")
ck(sw "Light on/off   ") ck(sw "Light on/off   ")
sl(0 100 dimmer "0" "Dimmer" "100") sl(0 100 dimmer "0" "Dimmer" "100")