Formatting

Michael Ingraham 2019-07-29 09:57:21 -04:00
parent df4d2005ad
commit d09cc10210
1 changed files with 20 additions and 10 deletions

@ -624,7 +624,7 @@ next
Since I own a magic home with IR receiver I made a script to show how it works Since I own a magic home with IR receiver I made a script to show how it works
I have 2 magic home devices that should be synchronized so I send the commands also to a second magic home via websend I have 2 magic home devices that should be synchronized so I send the commands also to a second magic home via websend
vers1 with if then else **Script example using `if then else`**
>; define (expand string section to 25 chars) >; define (expand string section to 25 chars)
**>D 25** **>D 25**
istr="" istr=""
@ -693,44 +693,54 @@ endif
> >
>istr="" >istr=""
vers2 with switch case ends **Script example using `switch case ends`**
>; define (expand string section to 25 chars) >; define (expand string section to 25 chars)
**>D** 25 **>D** 25
istr="" istr=""
ws="websend [192.168.178.84]" ws="websend [192.168.178.84]"
>; event section >; event section
**>E** **>E**
; get ir data
istr=IrReceived#Data istr=IrReceived#Data
switch istr >
>switch istr
; on ; on
case "0x00F7C03F" case "0x00F7C03F"
=>wakeup =>wakeup
=>%ws% wakeup =>%ws% wakeup
;off >
>;off
case "0x00F740BF" case "0x00F740BF"
=>power1 0 =>power1 0
=>%ws% power1 0 =>%ws% power1 0
;white >
>;white
case "0x00F7E01F" case "0x00F7E01F"
=>color 000000ff =>color 000000ff
=>%ws% color 000000ff =>%ws% color 000000ff
;red >
>;red
case "0x00F720DF" case "0x00F720DF"
=>color ff000000 =>color ff000000
=>%ws% color ff000000 =>%ws% color ff000000
;green >
>;green
case "0x00F7A05F" case "0x00F7A05F"
=>color 00ff0000 =>color 00ff0000
=>%ws% color 00ff0000 =>%ws% color 00ff0000
;blue >
>;blue
case "0x00F7609F" case "0x00F7609F"
=>color 0000ff00 =>color 0000ff00
=>%ws% color 0000ff00 =>%ws% color 0000ff00
; dimmer up >
>; dimmer up
case "0x00F700FF" case "0x00F700FF"
=>dimmer + =>dimmer +
=>%ws% dimmer + =>%ws% dimmer +
; dimmer down >
>; dimmer down
case "0x00F7807F" case "0x00F7807F"
=>dimmer - =>dimmer -
=>%ws% dimmer - =>%ws% dimmer -