Qball's Weblog

IfThenElse and Domotica..

Tags IfThenElse 

I created the following IfThenElse script:

 

What this does it the following:

?View Code INI
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
 [Timeout]
type=TimerTrigger
timeout=15
action=MultiAction
 
[MultiAction]
type=MultiAction
action=MpcCheck;PulseCheck
 
[MpcCheck]
type=ExternalToolCheck
cmd=mpc -h 192.150.0.104 status
compare-old-state=true
output-compare=(playing|paused)
then_action=CombineOnMPD
else_action=CombineOff
 
[PulseCheck]
type=ExternalToolCheck
cmd=pacmd list-sink-inputs
compare-old-state=true
output-compare=RUNNING
then_action=CombineOnXBMC
else_action=CombineOff
 
 
[CombineOnMPD]
type=MultiAction
action=StereoOn;CombineOnMPDReal
 
[CombineOnMPDReal]
type=TimerTrigger
timeout=5
repeat=false
action=CombineOnMPDReal2
 
[CombineOnMPDReal2]
type=ExternalToolAction
kill_child=false
cmd=irsend SEND_ONCE NAD_SR6 video-1
 
[CombineOnXBMC]
type=MultiAction
action=StereoOn;CombineOnXBMCReal
 
[CombineOnXBMCReal]
type=TimerTrigger
timeout=5
repeat=false
action=CombineOnXBMCReal2
 
[CombineOnXBMCReal2]
type=ExternalToolAction
kill_child=false
cmd=irsend SEND_ONCE NAD_SR6 disc
 
[StereoOn]
type=MultiCombine
action=StereoOnReal
 
[StereoOnReal]
type=ExternalToolAction
kill_child=false
cmd=stereo.sh on
 
[CombineOff]
type=AndCombine
action=CombineOffReal
 
 
[CombineOffReal]
type=ExternalToolAction
kill_child=false
cmd=stereo.sh off