Rev 1649 | Rev 1657 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | SVN | RSS feed
| Rev 1649 | Rev 1650 | ||
|---|---|---|---|
| Line 146... | Line 146... | ||
| 146 | } |
146 | } |
| 147 | } |
147 | } |
| 148 | } |
148 | } |
| 149 | else |
149 | else |
| 150 | { |
150 | { |
| 151 | if (in_array(filter_module_names, alias_data["module_name"])) |
151 | if (!filter_module_names || in_array(filter_module_names, alias_data["module_name"])) |
| 152 | { |
152 | { |
| 153 | aliases_data[alias_name] = alias_data; |
153 | aliases_data[alias_name] = alias_data; |
| 154 | } |
154 | } |
| 155 | } |
155 | } |
| 156 | } |
156 | } |
| Line 223... | Line 223... | ||
| 223 | return result_list; |
223 | return result_list; |
| 224 | } |
224 | } |
| 225 | 225 | ||
| 226 | function Module_GetNames() |
226 | function Module_GetNames() |
| 227 | { |
227 | { |
| 228 | return [ "Dimmer230", "irTransmit", "irReceive", "SimpleDTMF", "BusVoltage", "DS18x20", "FOST02" ]; |
228 | return [ "Dimmer230", "irTransmit", "irReceive", "SimpleDTMF", "BusVoltage", "DS18x20", "FOST02", "HD44789" ]; |
| 229 | } |
229 | } |
| 230 | 230 | ||
| 231 | function Module_SendMessage(module_name, module_id, command, variables) |
231 | function Module_SendMessage(module_name, module_id, command, variables) |
| 232 | { |
232 | { |
| 233 | var args = []; |
233 | var args = []; |
| Line 366... | Line 366... | ||
| 366 | { |
366 | { |
| 367 | Module_OnChangeFunctions["all"][n](id_parts[0], id_parts[1], available); |
367 | Module_OnChangeFunctions["all"][n](id_parts[0], id_parts[1], available); |
| 368 | } |
368 | } |
| 369 | } |
369 | } |
| 370 | } |
370 | } |
| - | 371 | ||
| - | 372 | function Module_GetLastValue(alias_name) |
|
| - | 373 | { |
|
| - | 374 | if (arguments.length < 1) |
|
| - | 375 | { |
|
| - | 376 | Log("\033[31mNot enough parameters given.\033[0m\n"); |
|
| - | 377 | return false; |
|
| - | 378 | } |
|
| - | 379 | ||
| - | 380 | var aliases_data = Module_ResolveAlias(alias_name); |
|
| - | 381 | var found = false; |
|
| - | 382 | ||
| - | 383 | for (var name in aliases_data) |
|
| - | 384 | { |
|
| - | 385 | var last_value_string = Storage_GetParameter("LastValues", alias_name); |
|
| - | 386 | ||
| - | 387 | if (last_value_string) |
|
| - | 388 | { |
|
| - | 389 | var last_value = eval("(" + last_value_string + ")"); |
|
| - | 390 | ||
| - | 391 | for (var type_name in last_value) |
|
| - | 392 | { |
|
| - | 393 | var date = new Date(last_value[type_name]["timestamp"] * 1000); |
|
| - | 394 | ||
| - | 395 | Log("\033[96m" + type_name + ": \033[0;1m" + last_value[type_name]["value"] + "\033[0m at " + date.toString() + "\n"); |
|
| - | 396 | } |
|
| - | 397 | } |
|
| - | 398 | else |
|
| - | 399 | { |
|
| - | 400 | Log("\033[32mNo value is stored for " + name + ".\033[0m\n"); |
|
| - | 401 | } |
|
| - | 402 | ||
| - | 403 | found = true; |
|
| - | 404 | } |
|
| - | 405 | ||
| - | 406 | if (!found) |
|
| - | 407 | { |
|
| - | 408 | Log("\033[31mNo aliases by the name " + alias_name + " were applicable for this command.\033[0m\n"); |
|
| - | 409 | return false; |
|
| - | 410 | } |
|
| - | 411 | ||
| - | 412 | return true; |
|
| - | 413 | } |
|
| - | 414 | Console_RegisterCommand(Module_GetLastValue, function(arg_index, args) { return Console_StandardAutocomplete(arg_index, args, Module_GetAliasNames()); }); |
|