-
Notifications
You must be signed in to change notification settings - Fork 0
/
Wetter.js
executable file
·29 lines (26 loc) · 1.38 KB
/
Wetter.js
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
on({ id: 'telegram.0.communicate.request', change: 'any' }, function (obj) {
var stateval = getState('telegram.0.communicate.request').val;
if (stateval.match(/]wetter/i)) {
var user_to_send = stateval.substring(1, stateval.indexOf("]"));
var command = stateval.substring(stateval.indexOf("]") + 1, stateval.length).toLowerCase();
var output = "";
output += "<b>Wetter:</b>\n";
sendTo('telegram', {
user: user_to_send,
text: output,
parse_mode: "HTML"
});
var str = getState("daswetter.0.NextDaysDetailed.Location_1.Day_1.iconURL").val;
var image = str.substr(str.lastIndexOf("/") + 1)
output = "";
output += getState("daswetter.0.NextDaysDetailed.Location_1.Day_1.symbol_desc2").val + "\n";
output += "Temp.: " + getState("daswetter.0.NextDaysDetailed.Location_1.Day_1.tempmin_value").val + "-" + getState("daswetter.0.NextDaysDetailed.Location_1.Day_1.tempmax_value").val + "°C";
output += " Wind.: " + getState("daswetter.0.NextDaysDetailed.Location_1.Day_1.windgusts_value").val + "km/h\n";
sendTo('telegram', {
user: user_to_send,
text:"/opt/iobroker/node_modules/iobroker.daswetter/admin/icons/tiempo-weather/galeria6/" + image,
caption: output,
parse_mode: "HTML"
});
}
});