This repository has been archived by the owner on Dec 28, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
shelly-shsw-25-roller.json
92 lines (92 loc) · 6.65 KB
/
shelly-shsw-25-roller.json
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
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
{ "name":"Shelly 2.5 Roller Shutter (SHSW-25)",
"manufacturer":"Shelly",
"type":"AVRECEIVER",
"version":2,
"compatible-meta":"1.0.4",
"persistedvariables":{
"MyDevices": "[]",
"IsRegistered": false,
"ToInitiate": true
},
"variables":{
"NewDevice":"[]",
"DeviceURI": "",
"DevicePort":"",
"DeviceUsername":"",
"DevicePassword":"",
"DeviceType":"[\"SHSW-25\"]"
},
"register":{
"registerheadertext": "Shelly",
"registerdescription": "Please enter URI of Shelly device in the following format: \n user:[email protected] \n Port 80 is used by default. Specify the port if different.",
"command": {"type": "static", "command": ".", "queryresult": "$.*"}
},
"discover": {
"welcomeheadertext": "Shelly 2.5 Roller Shutter (SHSW-25)",
"welcomedescription": "powered by meta v2 \n by JAC459 \n X \n Driver Development \n by vistalba & MarkusM",
"initcommandset":[{
"label":"",
"type":"static",
"command":"$RegistrationCode",
"queryresult":"",
"evalwrite":[
{"variable":"NewDevice", "value":"DYNAMIK let device = {\"username\":\"\", \"password\":\"\", \"ip\":\"\", \"port\":\"\", \"model_name\":\"\", \"name\":\"\", \"mac_address\":\"\" }; device.username = \"$Result\".split(\":\")[0]; device.password = \"$Result\".split(\":\")[1].split(\"@\")[0]; device.ip = \"$Result\".split(\"@\")[1].split(\":\")[0]; device.port = (\"$Result\".split(\"@\")[1].split(\":\")[1]!=undefined?\"$Result\".split(\"@\")[1].split(\":\")[1]:\"80\"); JSON.stringify(device); "},
{"variable":"DeviceURI", "value":"DYNAMIK \"$Result\".split(\"@\")[1].split(\":\")[0]; "},
{"variable":"DevicePort", "value":"DYNAMIK \"$Result\".split(\"@\")[1].split(\":\")[1]!=undefined?\"$Result\".split(\"@\")[1].split(\":\")[1]:\"80\"; "},
{"variable":"DeviceUsername", "value":"DYNAMIK \"$Result\".split(\":\")[0]; "},
{"variable":"DevicePassword", "value":"DYNAMIK \"$Result\".split(\":\")[1].split(\"@\")[0]; "}
]},
{
"type":"http-rest",
"command": "{\"verb\":\"get\",\"call\":\"http://$DeviceUsername:$DevicePassword@$DeviceURI:$DevicePort/settings\"}",
"queryresult" : "$.",
"evalwrite":[
{"variable":"NewDevice", "value":"DYNAMIK let device = $NewDevice; device.name = JSON.parse(\"$Result\").name; device.model_name= JSON.parse(\"$Result\").device.type; device.mac_address=JSON.parse(\"$Result\").device.mac; JSON.stringify(device); "},
{"variable":"MyDevices", "value":"DYNAMIK let device = $NewDevice; let mydevices = $MyDevices; ( $DeviceType.includes(device.model_name) ? ((mydevices.findIndex(i=>i.ip==device.ip)==-1) ? mydevices.push(device) : mydevices) : mydevices); JSON.stringify(mydevices); "}
],
"evaldo":[{"test":"DYNAMIK let device = $NewDevice; $DeviceType.includes(device.model_name); ","then":"__PERSIST", "or":""}]}
],
"command": {"type": "static", "command": "$MyDevices", "queryresult": "$.*"}
},
"template":{
"dynamicname": "DYNAMIK_INST_START DYNAMIK JSON.parse(\"$Result\").name DYNAMIK_INST_END",
"dynamicid": "DYNAMIK_INST_START DYNAMIK JSON.parse(\"$Result\").mac_address DYNAMIK_INST_END",
"variables":{
"PowerStatus": false,
"Position": "",
"ShellyURI": "DYNAMIK_INST_START DYNAMIK JSON.parse(\"$Result\").ip DYNAMIK_INST_END",
"ShellyPort": "DYNAMIK_INST_START DYNAMIK JSON.parse(\"$Result\").port DYNAMIK_INST_END",
"ShellyUsername": "DYNAMIK_INST_START DYNAMIK JSON.parse(\"$Result\").username DYNAMIK_INST_END",
"ShellyPassword":"DYNAMIK_INST_START DYNAMIK JSON.parse(\"$Result\").password DYNAMIK_INST_END"
},
"listeners":{
"ShellyStatus" : {"type":"http-rest", "isHub":false, "command": "{\"verb\":\"get\",\"call\":\"http://$DeviceUsername:$DevicePassword@$ShellyURI:$DevicePort/roller/0\"}", "pooltime":"10000", "poolduration":"",
"evalwrite": [
{"variable": "PowerStatus", "value": "DYNAMIK JSON.parse(\"$Result\").ison" },
{"variable" : "Position", "value": "DYNAMIK JSON.parse(\"$Result\").current_pos" }
]
}
},
"switches":{
"POWER" : {"label":"On", "listen":"PowerStatus", "evaldo":[{"test":"DYNAMIK $Result", "then":"SWITCHON", "or":"SWITCHOFF"}]}
},
"sliders":{
"POSITION": {"label":"Position", "unit" : "%", "listen" : "Position", "evaldo":[{"test":true, "then":"POSITIONCHANGE", "or":""}]}
},
"buttons":{
"POWER ON": {"label":"", "type":"static", "command":"", "evaldo":[{"test":true,"then":"__INITIALISE", "or":""}]},
"POWER OFF": {"label":"", "type":"static", "command":"", "evaldo":[{"test":true,"then":"__CLEANUP", "or":""}]},
"OPEN": {"label":"", "type":"http-get", "command":"http://$ShellyUsername:$ShellyPassword@$ShellyURI:$ShellyPort/roller/0?go=open&duration=0"},
"CURSOR UP": {"label":"", "type":"http-get", "command":"http://$ShellyUsername:$ShellyPassword@$ShellyURI:$ShellyPort/roller/0?go=open&duration=0"},
"CLOSE": {"label":"", "type":"http-get", "command":"http://$ShellyUsername:$ShellyPassword@$ShellyURI:$ShellyPort/roller/0?go=close&duration=0"},
"CURSOR DOWN": {"label":"", "type":"http-get", "command":"http://$ShellyUsername:$ShellyPassword@$ShellyURI:$ShellyPort/roller/0?go=close&duration=0"},
"STOP": {"label":"", "type":"http-get", "command":"http://$ShellyUsername:$ShellyPassword@$ShellyURI:$ShellyPort/roller/0?go=stop&duration=0"},
"CURSOR ENTER":{"label":"", "type":"http-get", "command":"http://$ShellyUsername:$ShellyPassword@$ShellyURI:$ShellyPort/roller/0?go=stop&duration=0"},
"TILT OPEN": {"label":"", "type":"http-get", "command":"http://$ShellyUsername:$ShellyPassword@$ShellyURI:$ShellyPort/roller/0?go=open&duration=0.25"},
"CURSOR RIGHT":{"label":"", "type":"http-get", "command":"http://$ShellyUsername:$ShellyPassword@$ShellyURI:$ShellyPort/roller/0?go=open&duration=0.25"},
"TILT CLOSE": {"label":"", "type":"http-get", "command":"http://$ShellyUsername:$ShellyPassword@$ShellyURI:$ShellyPort/roller/0?go=close&duration=0.25"},
"CURSOR LEFT": {"label":"", "type":"http-get", "command":"http://$ShellyUsername:$ShellyPassword@$ShellyURI:$ShellyPort/roller/0?go=close&duration=0.25"},
"POSITIONCHANGE":{"label":"", "type":"http-get", "command":"http://$ShellyUsername:$ShellyPassword@$ShellyURI:$ShellyPort/roller/0?go=to_pos&roller_pos=$Position"}
}
}
}