Skip to content

Commit cea9101

Browse files
add samples colorControl and remains
1 parent 243086a commit cea9101

2 files changed

Lines changed: 126 additions & 0 deletions

File tree

Lines changed: 79 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
1+
{
2+
"name": "If the light is turned on between sunrise and 1 hour after sunrise change the light color",
3+
"actions": [
4+
{
5+
"if":{
6+
"and":[
7+
{
8+
"between":{
9+
"value": {
10+
"time": {
11+
"reference": "Now"
12+
}
13+
},
14+
"start": {
15+
"time": {
16+
"reference": "Sunrise"
17+
}
18+
},
19+
"end": {
20+
"time": {
21+
"reference": "Sunrise",
22+
"offset": {
23+
"value": {"integer":60},
24+
"unit": "Minute"
25+
}
26+
}
27+
}
28+
}
29+
},
30+
{
31+
"equals": {
32+
"left": {
33+
"device": {
34+
"devices": [
35+
"{{ light-deviceId }}"
36+
],
37+
"component": "main",
38+
"capability": "switch",
39+
"attribute": "switch"
40+
}
41+
},
42+
"right": {
43+
"string": "on"
44+
}
45+
}
46+
}
47+
],
48+
"then":[
49+
{
50+
"command": {
51+
"devices": [
52+
"{{ light-deviceId }}"
53+
],
54+
"commands": [
55+
{
56+
"component": "main",
57+
"capability": "colorControl",
58+
"command": "setColor",
59+
"arguments": [
60+
{
61+
"map":{
62+
"hue": {
63+
"decimal": "{{ hue-value }}"
64+
},
65+
"saturation": {
66+
"decimal": "{{ saturation-value }}"
67+
}
68+
}
69+
}
70+
]
71+
}
72+
]
73+
}
74+
}
75+
]
76+
}
77+
}
78+
]
79+
}
Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
{
2+
"name": "If switch level is less than 25% for 20 seconds in d1, turn off d2",
3+
"actions": [
4+
{
5+
"if": {
6+
"remains":{
7+
"duration":{
8+
"value": {"integer":20},
9+
"unit": "Second"
10+
},
11+
"lessThan":{
12+
"left": {
13+
"device": {
14+
"devices": [
15+
"{{ device-id }}"
16+
],
17+
"component": "main",
18+
"capability": "switchLevel",
19+
"attribute": "level"
20+
}
21+
},
22+
"right": {
23+
"integer": 25
24+
}
25+
}
26+
},
27+
"then": [
28+
{
29+
"command": {
30+
"devices": [
31+
"{{ device-id }}"
32+
],
33+
"commands": [
34+
{
35+
"component": "main",
36+
"capability": "switch",
37+
"command": "off",
38+
"arguments": []
39+
}
40+
]
41+
}
42+
}
43+
]
44+
}
45+
}
46+
]
47+
}

0 commit comments

Comments
 (0)