Subversion Repositories HomeAutomation

Rev

Rev 1624 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | SVN | RSS feed

Rev 1624 Rev 1625
Line 161... Line 161...
161
    if (alias_data["module_name"] != "irTransmit")
161
    if (alias_data["module_name"] != "irTransmit")
162
    {
162
    {
163
        return "Module type " + alias_data["module_name"] + " is not valid for this action, valid are irTransmit";
163
        return "Module type " + alias_data["module_name"] + " is not valid for this action, valid are irTransmit";
164
    }
164
    }
165
   
165
   
166
    Log(remote);
-
 
167
    var remote_storage_name = Storage_GetParameter("RemoteList", remote);
166
    var remote_storage_name = Storage_GetParameter("RemoteList", remote);
-
 
167
   
168
    Log(remote_storage_name);
168
    if (!remote_storage_name)
-
 
169
    {
-
 
170
        return "No such remote name in list, " + remote;
-
 
171
    }
-
 
172
   
169
    var button = eval("(" + Storage_GetParameter(remote_storage_name, button) + ")");
173
    var button_string = Storage_GetParameter(remote_storage_name, button);
-
 
174
   
-
 
175
    if (!button_string)
-
 
176
    {
-
 
177
        return "No such button " + button + " found on remote " + remote;
-
 
178
    }
-
 
179
   
-
 
180
    var button = eval("(" + button_string + ")");
-
 
181
   
170
    Log(JSON.stringify(button));
182
    Log(JSON.stringify(button));
171
    Log(alias_data["module_id"]);
183
    Log(alias_data["module_id"]);
172
    Log(alias_data["extra"]);
184
    Log(alias_data["extra"]);
173
    Log(button["protocol"]);
185
    Log(button["protocol"]);
174
    Log(button["data"]);
186
    Log(button["data"]);
175
   
187
   
176
    return irTransmit_SendCode(alias_data["module_id"], alias_data["extra"], "Burst", button["protocol"], button["data"]);
188
    return irTransmit_SendCode(alias_data["module_id"], alias_data["extra"], "Burst", button["protocol"], button["data"]);
177
}
189
}
178
RegisterConsoleCommand(irsend, irsend_autocomplete);
190
RegisterConsoleCommand(irsend, irsend_autocomplete);
-
 
191
 
-
 
192
 
-
 
193
function media(mode)
-
 
194
{
-
 
195
    if (!mode)
-
 
196
    {
-
 
197
        return "You must specify a mode";
-
 
198
    }
-
 
199
   
-
 
200
    if (mode == "movie")
-
 
201
    {
-
 
202
        irsend("tvbankut", "Yamaha_RAV34", "POWER");
-
 
203
       
-
 
204
        fadeto("bokhylla", 100, 135);
-
 
205
        fadeto("bardisk", 0, 135);
-
 
206
 
-
 
207
        sleep(1000);
-
 
208
        irsend("tvbankut", "Yamaha_RAV34", "CD");
-
 
209
    }
-
 
210
    else if (mode == "tv")
-
 
211
    {
-
 
212
        irsend("tvbankut", "Yamaha_RAV34", "POWER");
-
 
213
       
-
 
214
        fadeto("bokhylla", 150, 135);
-
 
215
        fadeto("bardisk", 150, 135);
-
 
216
 
-
 
217
        sleep(1000);
-
 
218
        irsend("tvbankut", "Yamaha_RAV34", "DTV_CBL");
-
 
219
    }
-
 
220
    else if (mode == "off")
-
 
221
    {
-
 
222
        irsend("tvbankut", "Yamaha_RAV34", "STANDBY");
-
 
223
       
-
 
224
        fadeto("bokhylla", 0, 135);
-
 
225
        fadeto("bardisk", 0, 135);
-
 
226
    }
-
 
227
   
-
 
228
    return "OK";
-
 
229
}
-
 
230
RegisterConsoleCommand(media, function(args) { return StandardAutocomplete(args, [ "off", "tv", "movie" ]); });