Best JavaScript code snippet using devicefarmer-stf
seed.ts
Source: seed.ts
...268 const date = new Date(new Date().getTime() - Math.random() * (1e+12))269 return date270}271const userList = [272 { "name": "Leanne Graham", "email": "Sincere@april.biz", countryCode: getCountry(), device: getDevice(), gender: getGender(), usageTimeInMin: getUtime(), lastActive: getRandomDate() },273 { "name": "Ervin Howell", "email": "Shanna@melissa.tv", countryCode: getCountry(), device: getDevice(), gender: getGender(), usageTimeInMin: getUtime(), lastActive: getRandomDate() },274 { "name": "Clementine Bauch", "email": "Nathan@yesenia.net", countryCode: getCountry(), device: getDevice(), gender: getGender(), usageTimeInMin: getUtime(), lastActive: getRandomDate() },275 { "name": "Patricia Lebsack", "email": "Julianne.OConner@kory.org", countryCode: getCountry(), device: getDevice(), gender: getGender(), usageTimeInMin: getUtime(), lastActive: getRandomDate() },276 { "name": "Chelsey Dietrich", "email": "Lucio_Hettinger@annie.ca", countryCode: getCountry(), device: getDevice(), gender: getGender(), usageTimeInMin: getUtime(), lastActive: getRandomDate() },277 { "name": "Mrs. Dennis Schulist", "email": "Karley_Dach@jasper.info", countryCode: getCountry(), device: getDevice(), gender: getGender(), usageTimeInMin: getUtime(), lastActive: getRandomDate() },278 { "name": "Kurtis Weissnat", "email": "Telly.Hoeger@billy.biz", countryCode: getCountry(), device: getDevice(), gender: getGender(), usageTimeInMin: getUtime(), lastActive: getRandomDate() },279 { "name": "Nicholas Runolfsdottir V", "email": "Sherwood@rosamond.me", countryCode: getCountry(), device: getDevice(), gender: getGender(), usageTimeInMin: getUtime(), lastActive: getRandomDate() },280 { "name": "Glenna Reichert", "email": "Chaim_McDermott@dana.io", countryCode: getCountry(), device: getDevice(), gender: getGender(), usageTimeInMin: getUtime(), lastActive: getRandomDate() },281 { "name": "Clementina DuBuque", "email": "Rey.Padberg@karina.biz", countryCode: getCountry(), device: getDevice(), gender: getGender(), usageTimeInMin: getUtime(), lastActive: getRandomDate() },282 { "name": "sunt", "email": "quiaas@me.com", countryCode: getCountry(), device: getDevice(), gender: getGender(), usageTimeInMin: getUtime(), lastActive: getRandomDate() },283 { "name": "qui", "email": "estdfsf@me.com", countryCode: getCountry(), device: getDevice(), gender: getGender(), usageTimeInMin: getUtime(), lastActive: getRandomDate() },284 { "name": "ea", "email": "etdfs@me.com", countryCode: getCountry(), device: getDevice(), gender: getGender(), usageTimeInMin: getUtime(), lastActive: getRandomDate() },285 { "name": "eum", "email": "ullamdfs@me.com", countryCode: getCountry(), device: getDevice(), gender: getGender(), usageTimeInMin: getUtime(), lastActive: getRandomDate() },286 { "name": "nesciunt", "email": "repudiandaese@me.com", countryCode: getCountry(), device: getDevice(), gender: getGender(), usageTimeInMin: getUtime(), lastActive: getRandomDate() },287 { "name": "dolorem", "email": "utewf@me.com", countryCode: getCountry(), device: getDevice(), gender: getGender(), usageTimeInMin: getUtime(), lastActive: getRandomDate() },288 { "name": "magnam", "email": "doloreewaew@me.com", countryCode: getCountry(), device: getDevice(), gender: getGender(), usageTimeInMin: getUtime(), lastActive: getRandomDate() },289 { "name": "dolorem", "email": "dignissimosacea@me.com", countryCode: getCountry(), device: getDevice(), gender: getGender(), usageTimeInMin: getUtime(), lastActive: getRandomDate() },290 { "name": "nesciunt", "email": "consecteturewv@me.com", countryCode: getCountry(), device: getDevice(), gender: getGender(), usageTimeInMin: getUtime(), lastActive: getRandomDate() },291 { "name": "optio", "email": "quouyj@me.com", countryCode: getCountry(), device: getDevice(), gender: getGender(), usageTimeInMin: getUtime(), lastActive: getRandomDate() },292 { "name": "et", "email": "delectuserb@me.com", countryCode: getCountry(), device: getDevice(), gender: getGender(), usageTimeInMin: getUtime(), lastActive: getRandomDate() },293 { "name": "in", "email": "itaquerb@me.com", countryCode: getCountry(), device: getDevice(), gender: getGender(), usageTimeInMin: getUtime(), lastActive: getRandomDate() },294 { "name": "dolorum", "email": "autdbfgs@me.com", countryCode: getCountry(), device: getDevice(), gender: getGender(), usageTimeInMin: getUtime(), lastActive: getRandomDate() },295 { "name": "voluptatem", "email": "fugasvd@me.com", countryCode: getCountry(), device: getDevice(), gender: getGender(), usageTimeInMin: getUtime(), lastActive: getRandomDate() },296 { "name": "eveniet", "email": "reprehenderitxx@me.com", countryCode: getCountry(), device: getDevice(), gender: getGender(), usageTimeInMin: getUtime(), lastActive: getRandomDate() },297 { "name": "sint", "email": "suscipit@me.com", countryCode: getCountry(), device: getDevice(), gender: getGender(), usageTimeInMin: getUtime(), lastActive: getRandomDate() },298 { "name": "fugit", "email": "eosxdd@me.com", countryCode: getCountry(), device: getDevice(), gender: getGender(), usageTimeInMin: getUtime(), lastActive: getRandomDate() },299 { "name": "voluptate", "email": "evenietdsfd@me.com", countryCode: getCountry(), device: getDevice(), gender: getGender(), usageTimeInMin: getUtime(), lastActive: getRandomDate() },300 { "name": "adipisci", "email": "illumsfdsf@me.com", countryCode: getCountry(), device: getDevice(), gender: getGender(), usageTimeInMin: getUtime(), lastActive: getRandomDate() },301 { "name": "doloribus", "email": "quixxxxe3e@me.com", countryCode: getCountry(), device: getDevice(), gender: getGender(), usageTimeInMin: getUtime(), lastActive: getRandomDate() },302 { "name": "asperiores", "email": "repellat222@me.com", countryCode: getCountry(), device: getDevice(), gender: getGender(), usageTimeInMin: getUtime(), lastActive: getRandomDate() },303 { "name": "dolor", "email": "eoscs@me.com", countryCode: getCountry(), device: getDevice(), gender: getGender(), usageTimeInMin: getUtime(), lastActive: getRandomDate() },304 { "name": "maxime", "email": "vscdseritatis@me.com", countryCode: getCountry(), device: getDevice(), gender: getGender(), usageTimeInMin: getUtime(), lastActive: getRandomDate() },305 { "name": "autem", "email": "ensdvgsim@me.com", countryCode: getCountry(), device: getDevice(), gender: getGender(), usageTimeInMin: getUtime(), lastActive: getRandomDate() },306 { "name": "rem", "email": "ullagdgm@me.com", countryCode: getCountry(), device: getDevice(), gender: getGender(), usageTimeInMin: getUtime(), lastActive: getRandomDate() },307 { "name": "est", "email": "simdvilique@me.com", countryCode: getCountry(), device: getDevice(), gender: getGender(), usageTimeInMin: getUtime(), lastActive: getRandomDate() },308 { "name": "quasi", "email": "esdrfum@me.com", countryCode: getCountry(), device: getDevice(), gender: getGender(), usageTimeInMin: getUtime(), lastActive: getRandomDate() },309 { "name": "delectus", "email": "nfddon@me.com", countryCode: getCountry(), device: getDevice(), gender: getGender(), usageTimeInMin: getUtime(), lastActive: getRandomDate() },310 { "name": "iusto", "email": "odsfsdit@me.com", countryCode: getCountry(), device: getDevice(), gender: getGender(), usageTimeInMin: getUtime(), lastActive: getRandomDate() },311 { "name": "a", "email": "alisvsdas@me.com", countryCode: getCountry(), device: getDevice(), gender: getGender(), usageTimeInMin: getUtime(), lastActive: getRandomDate() },312 { "name": "ullam", "email": "debitsis@me.com", countryCode: getCountry(), device: getDevice(), gender: getGender(), usageTimeInMin: getUtime(), lastActive: getRandomDate() },313 { "name": "doloremque", "email": "desvserunt@me.com", countryCode: getCountry(), device: getDevice(), gender: getGender(), usageTimeInMin: getUtime(), lastActive: getRandomDate() },314 { "name": "qui", "email": "rerumsss@me.com", countryCode: getCountry(), device: getDevice(), gender: getGender(), usageTimeInMin: getUtime(), lastActive: getRandomDate() },315 { "name": "magnam", "email": "esvsda@me.com", countryCode: getCountry(), device: getDevice(), gender: getGender(), usageTimeInMin: getUtime(), lastActive: getRandomDate() },316 { "name": "id", "email": "nissvsdi@me.com", countryCode: getCountry(), device: getDevice(), gender: getGender(), usageTimeInMin: getUtime(), lastActive: getRandomDate() },317 { "name": "fuga", "email": "adsvdsv@me.com", countryCode: getCountry(), device: getDevice(), gender: getGender(), usageTimeInMin: getUtime(), lastActive: getRandomDate() },318 { "name": "provident", "email": "desvbitis@me.com", countryCode: getCountry(), device: getDevice(), gender: getGender(), usageTimeInMin: getUtime(), lastActive: getRandomDate() },319 { "name": "explicabo", "email": "anisdvmi@me.com", countryCode: getCountry(), device: getDevice(), gender: getGender(), usageTimeInMin: getUtime(), lastActive: getRandomDate() },320 { "name": "eos", "email": "corsvdporis@me.com", countryCode: getCountry(), device: getDevice(), gender: getGender(), usageTimeInMin: getUtime(), lastActive: getRandomDate() },321 { "name": "enim", "email": "usvrtet@me.com", countryCode: getCountry(), device: getDevice(), gender: getGender(), usageTimeInMin: getUtime(), lastActive: getRandomDate() },322 { "name": "non", "email": "molsdvestias@me.com", countryCode: getCountry(), device: getDevice(), gender: getGender(), usageTimeInMin: getUtime(), lastActive: getRandomDate() },323 { "name": "commodi", "email": "odsdvsio@me.com", countryCode: getCountry(), device: getDevice(), gender: getGender(), usageTimeInMin: getUtime(), lastActive: getRandomDate() },324 { "name": "eligendi", "email": "similsdique@me.com", countryCode: getCountry(), device: getDevice(), gender: getGender(), usageTimeInMin: getUtime(), lastActive: getRandomDate() },325 { "name": "optio", "email": "tesdvmporibus@me.com", countryCode: getCountry(), device: getDevice(), gender: getGender(), usageTimeInMin: getUtime(), lastActive: getRandomDate() },326 { "name": "ut", "email": "estsvdw@me.com", countryCode: getCountry(), device: getDevice(), gender: getGender(), usageTimeInMin: getUtime(), lastActive: getRandomDate() },327 { "name": "aut", "email": "volusvhyptatem@me.com", countryCode: getCountry(), device: getDevice(), gender: getGender(), usageTimeInMin: getUtime(), lastActive: getRandomDate() },328 { "name": "quibusdam", "email": "savoluptatem@me.com", countryCode: getCountry(), device: getDevice(), gender: getGender(), usageTimeInMin: getUtime(), lastActive: getRandomDate() },329 { "name": "ut", "email": "voluptdvates@me.com", countryCode: getCountry(), device: getDevice(), gender: getGender(), usageTimeInMin: getUtime(), lastActive: getRandomDate() },330 { "name": "laborum", "email": "insdvaventore@me.com", countryCode: getCountry(), device: getDevice(), gender: getGender(), usageTimeInMin: getUtime(), lastActive: getRandomDate() },331 { "name": "repellendus", "email": "errovar@me.com", countryCode: getCountry(), device: getDevice(), gender: getGender(), usageTimeInMin: getUtime(), lastActive: getRandomDate() },332 { "name": "soluta", "email": "savebunt@me.com", countryCode: getCountry(), device: getDevice(), gender: getGender(), usageTimeInMin: getUtime(), lastActive: getRandomDate() },333 { "name": "qui", "email": "iustvsvdo@me.com", countryCode: getCountry(), device: getDevice(), gender: getGender(), usageTimeInMin: getUtime(), lastActive: getRandomDate() },334 { "name": "ut", "email": "minimsaea@me.com", countryCode: getCountry(), device: getDevice(), gender: getGender(), usageTimeInMin: getUtime(), lastActive: getRandomDate() },335 { "name": "sit", "email": "totambra@me.com", countryCode: getCountry(), device: getDevice(), gender: getGender(), usageTimeInMin: getUtime(), lastActive: getRandomDate() },336 { "name": "sit", "email": "debitibres@me.com", countryCode: getCountry(), device: getDevice(), gender: getGender(), usageTimeInMin: getUtime(), lastActive: getRandomDate() },337 { "name": "qui", "email": "aaveraut@me.com", countryCode: getCountry(), device: getDevice(), gender: getGender(), usageTimeInMin: getUtime(), lastActive: getRandomDate() },338 { "name": "sed", "email": "aabrnt@me.com", countryCode: getCountry(), device: getDevice(), gender: getGender(), usageTimeInMin: getUtime(), lastActive: getRandomDate() },339 { "name": "voluptatum", "email": "veveaniam@me.com", countryCode: getCountry(), device: getDevice(), gender: getGender(), usageTimeInMin: getUtime(), lastActive: getRandomDate() },340 { "name": "qui", "email": "perspicavaiatis@me.com", countryCode: getCountry(), device: getDevice(), gender: getGender(), usageTimeInMin: getUtime(), lastActive: getRandomDate() },341 { "name": "consequatur", "email": "aspvdsaeriores@me.com", countryCode: getCountry(), device: getDevice(), gender: getGender(), usageTimeInMin: getUtime(), lastActive: getRandomDate() },342 { "name": "voluptatem", "email": "aabvab@me.com", countryCode: getCountry(), device: getDevice(), gender: getGender(), usageTimeInMin: getUtime(), lastActive: getRandomDate() },343 { "name": "beatae", "email": "eniavam@me.com", countryCode: getCountry(), device: getDevice(), gender: getGender(), usageTimeInMin: getUtime(), lastActive: getRandomDate() },344 { "name": "voluptas", "email": "enimotnt@me.com", countryCode: getCountry(), device: getDevice(), gender: getGender(), usageTimeInMin: getUtime(), lastActive: getRandomDate() },345 { "name": "et", "email": "iddys@me.com", countryCode: getCountry(), device: getDevice(), gender: getGender(), usageTimeInMin: getUtime(), lastActive: getRandomDate() },346 { "name": "consequatur", "email": "volsnytuptatibus@me.com", countryCode: getCountry(), device: getDevice(), gender: getGender(), usageTimeInMin: getUtime(), lastActive: getRandomDate() },347 { "name": "repudiandae", "email": "offsnticia@me.com", countryCode: getCountry(), device: getDevice(), gender: getGender(), usageTimeInMin: getUtime(), lastActive: getRandomDate() },348 { "name": "aliquid", "email": "represtnhenderit@me.com", countryCode: getCountry(), device: getDevice(), gender: getGender(), usageTimeInMin: getUtime(), lastActive: getRandomDate() },349 { "name": "odio", "email": "magnasntm@me.com", countryCode: getCountry(), device: getDevice(), gender: getGender(), usageTimeInMin: getUtime(), lastActive: getRandomDate() },350 { "name": "fugiat", "email": "offstniciis@me.com", countryCode: getCountry(), device: getDevice(), gender: getGender(), usageTimeInMin: getUtime(), lastActive: getRandomDate() },351 { "name": "voluptatem", "email": "ssntunt@me.com", countryCode: getCountry(), device: getDevice(), gender: getGender(), usageTimeInMin: getUtime(), lastActive: getRandomDate() },352 { "name": "et", "email": "occasntecati@me.com", countryCode: getCountry(), device: getDevice(), gender: getGender(), usageTimeInMin: getUtime(), lastActive: getRandomDate() },353 { "name": "sint", "email": "quastnm@me.com", countryCode: getCountry(), device: getDevice(), gender: getGender(), usageTimeInMin: getUtime(), lastActive: getRandomDate() },354 { "name": "consequuntur", "email": "volusntptatem@me.com", countryCode: getCountry(), device: getDevice(), gender: getGender(), usageTimeInMin: getUtime(), lastActive: getRandomDate() },355 { "name": "enim", "email": "odistt@me.com", countryCode: getCountry(), device: getDevice(), gender: getGender(), usageTimeInMin: getUtime(), lastActive: getRandomDate() },356 { "name": "dignissimos", "email": "commonstdi@me.com", countryCode: getCountry(), device: getDevice(), gender: getGender(), usageTimeInMin: getUtime(), lastActive: getRandomDate() },357 { "name": "doloremque", "email": "sntsnut@me.com", countryCode: getCountry(), device: getDevice(), gender: getGender(), usageTimeInMin: getUtime(), lastActive: getRandomDate() },358 { "name": "necessitatibus", "email": "mosntsdi@me.com", countryCode: getCountry(), device: getDevice(), gender: getGender(), usageTimeInMin: getUtime(), lastActive: getRandomDate() },359 { "name": "quam", "email": "nostnsbis@me.com", countryCode: getCountry(), device: getDevice(), gender: getGender(), usageTimeInMin: getUtime(), lastActive: getRandomDate() },360 { "name": "pariatur", "email": "libersnto1@me.com", countryCode: getCountry(), device: getDevice(), gender: getGender(), usageTimeInMin: getUtime(), lastActive: getRandomDate() },361 { "name": "labore", "email": "sntsex@me.com", countryCode: getCountry(), device: getDevice(), gender: getGender(), usageTimeInMin: getUtime(), lastActive: getRandomDate() },362 { "name": "tempora", "email": "fasntscere@me.com", countryCode: getCountry(), device: getDevice(), gender: getGender(), usageTimeInMin: getUtime(), lastActive: getRandomDate() },363 { "name": "laudantium", "email": "ustnt@me.com", countryCode: getCountry(), device: getDevice(), gender: getGender(), usageTimeInMin: getUtime(), lastActive: getRandomDate() },364 { "name": "odit", "email": "etnsnst@me.com", countryCode: getCountry(), device: getDevice(), gender: getGender(), usageTimeInMin: getUtime(), lastActive: getRandomDate() },365 { "name": "optio", "email": "sitnsntnt@me.com", countryCode: getCountry(), device: getDevice(), gender: getGender(), usageTimeInMin: getUtime(), lastActive: getRandomDate() },366 { "name": "dolore", "email": "sisntsmilique@me.com", countryCode: getCountry(), device: getDevice(), gender: getGender(), usageTimeInMin: getUtime(), lastActive: getRandomDate() },367 { "name": "placeat", "email": "qustnstasi@me.com", countryCode: getCountry(), device: getDevice(), gender: getGender(), usageTimeInMin: getUtime(), lastActive: getRandomDate() },368 { "name": "nostrum", "email": "esntsos@me.com", countryCode: getCountry(), device: getDevice(), gender: getGender(), usageTimeInMin: getUtime(), lastActive: getRandomDate() },369 { "name": "sapiente", "email": "consstnsequatur@me.com", countryCode: getCountry(), device: getDevice(), gender: getGender(), usageTimeInMin: getUtime(), lastActive: getRandomDate() },370 { "name": "sint", "email": "resntpellat@me.com", countryCode: getCountry(), device: getDevice(), gender: getGender(), usageTimeInMin: getUtime(), lastActive: getRandomDate() },371 { "name": "ad", "email": "minsntus@me.com", countryCode: getCountry(), device: getDevice(), gender: getGender(), usageTimeInMin: getUtime(), lastActive: getRandomDate() },372 { "name": "aut", "email": "libstnero@me.com", countryCode: getCountry(), device: getDevice(), gender: getGender(), usageTimeInMin: getUtime(), lastActive: getRandomDate() },373 { "name": "ratione", "email": "asntut@me.com", countryCode: getCountry(), device: getDevice(), gender: getGender(), usageTimeInMin: getUtime(), lastActive: getRandomDate() },374 { "name": "beatae", "email": "dosntlorem@me.com", countryCode: getCountry(), device: getDevice(), gender: getGender(), usageTimeInMin: getUtime(), lastActive: getRandomDate() },375 { "name": "qui", "email": "assntpernatur@me.com", countryCode: getCountry(), device: getDevice(), gender: getGender(), usageTimeInMin: getUtime(), lastActive: getRandomDate() },376 { "name": "id", "email": "earusntm@me.com", countryCode: getCountry(), device: getDevice(), gender: getGender(), usageTimeInMin: getUtime(), lastActive: getRandomDate() },377 { "name": "quaerat", "email": "instn@me.com", countryCode: getCountry(), device: getDevice(), gender: getGender(), usageTimeInMin: getUtime(), lastActive: getRandomDate() },378 { "name": "quas", "email": "eusnttsntm@me.com", countryCode: getCountry(), device: getDevice(), gender: getGender(), usageTimeInMin: getUtime(), lastActive: getRandomDate() },379 { "name": "laboriosam", "email": "dolorstnemque@me.com", countryCode: getCountry(), device: getDevice(), gender: getGender(), usageTimeInMin: getUtime(), lastActive: getRandomDate() },380 { "name": "temporibus", "email": "qusntntnjto@me.com", countryCode: getCountry(), device: getDevice(), gender: getGender(), usageTimeInMin: getUtime(), lastActive: getRandomDate() },381 { "name": "cupiditate", "email": "cupidsntitate@me.com", countryCode: getCountry(), device: getDevice(), gender: getGender(), usageTimeInMin: getUtime(), lastActive: getRandomDate() }382]383const doSeed = async () => {384 // clear seed385 await prisma.country.deleteMany()386 await prisma.users.deleteMany()387 //* create demo country388 await prisma.country.createMany({389 data: countryList390 })391 //* create demo users392 await prisma.users.createMany({393 data: userList394 })395}...
test-device.ts
Source: test-device.ts
...94 if (childId !== undefined) {95 // @ts-ignore: childId is only on plugs, but harmless96 testDevice.deviceOptions.childId = childId;97 }98 testDevice.getDevice = function getDevice(99 deviceOptions?: Parameters<Client['getDevice']>[0],100 sendOptions?: Parameters<Client['getDevice']>[1]101 ): ReturnType<Client['getDevice']> {102 return client.getDevice(103 {104 ...testDevice.deviceOptions,105 defaultSendOptions: sendOptions,106 ...deviceOptions,107 } as Parameters<Client['getDevice']>[0], // TODO: I don't like this cast but only way I could get it to work108 sendOptions109 );110 };111 if ('children' in device && device.children.size > 0) {112 if (testDevice.childId === undefined) {113 testDevice.children = ((): MarkRequired<114 TestDevice,115 'getDevice' | 'childId' | 'parent'116 >[] => {117 return Array.from(device.children.keys()).map((key) => {118 return createTestDevice(device, client, {119 name: testDevice.name,120 model: testDevice.model,121 hardwareVersion: testDevice.hardwareVersion,122 isSimulated: testDevice.isSimulated,123 parent: testDevice as TestDevice,124 childId: key,125 }) as MarkRequired<TestDevice, 'getDevice' | 'childId' | 'parent'>;126 });127 })();128 } else {129 testDevice.getOtherChildren = function getOtherChildren(): MarkRequired<130 TestDevice,131 'getDevice' | 'childId' | 'parent'132 >[] {133 if (!(parent !== undefined && parent.children !== undefined))134 throw new TypeError();135 return parent.children.filter((oc) => oc.childId !== this.childId);136 };137 testDevice.getOtherChildrenState =138 async function getOtherChildrenState(): Promise<139 Array<{140 childId: string;141 relayState: boolean;142 alias: string;143 }>144 > {145 if (146 !(147 'getOtherChildren' in testDevice &&148 testDevice.getOtherChildren !== undefined149 )150 ) {151 throw new Error();152 }153 return Promise.all(154 testDevice.getOtherChildren().map(async (childDevice) => {155 const d = (await childDevice.getDevice()) as Plug;156 if (d.childId === undefined) throw new TypeError();157 return {158 childId: d.childId,159 relayState: d.relayState,160 alias: d.alias,161 };162 })163 );164 };165 }166 }167 }168 testDevices.push(testDevice as TestDevice);169 return testDevice as TestDevice;...
WIRENBOARD.js
Source: WIRENBOARD.js
1// Unit: MQTT2//Control3IR.AddListener(IR.EVENT_TAG_CHANGE, IR.GetDevice("MQTT"), function(name, value){4 switch (name) {5 case "OfficeVentStatus": //ÐенÑилÑÑÐ¸Ñ Ð² подÑобке оÑиÑа (OH Control)6 if(value == false){7 IR.GetDevice("Mix23 (stend)").Set("Relay Channel 06 Switch Off", 0);8 break;9 }else{10 IR.GetDevice("Mix23 (stend)").Set("Relay Channel 06 Switch On", 0);11 break;12 }13 case "LeftRollerShutterStatus": // ÐÐµÐ²Ð°Ñ ÑÑоÑа(OH Control)14 if(value == "UP"){//UP15 IR.GetDevice("Relay 3-channel").Set("Channel 01 Switch On", true);16 break;17 }else if(value == "DOWN"){//DOWN18 IR.GetDevice("Relay 3-channel").Set("Channel 02 Switch On", true);19 break;20 }else{//STOP21 IR.Log("STOP");22 IR.GetDevice("Relay 3-channel").Set("Channel 01 Switch Off", false);23 IR.GetDevice("Relay 3-channel").Set("Channel 02 Switch Off", false);24 break;25 }26 case "CentralRollerShutterStatus": // ЦенÑÑалÑÐ½Ð°Ñ ÑÑоÑа(OH Control)27 if(value == "UP"){//UP28 IR.GetDevice("Relay 2-channel2").Set("Channel 01 Switch On", true);29 break;30 }else if(value == "DOWN"){//DOWN31 IR.GetDevice("Relay 2-channel2").Set("Channel 02 Switch On", true);32 break;33 }else{//STOP34 IR.Log("STOP");35 IR.GetDevice("Relay 2-channel2").Set("Channel 01 Switch Off", false);36 IR.GetDevice("Relay 2-channel2").Set("Channel 02 Switch Off", false);37 break;38 }39 case "RightlRollerShutterStatus": // ÐÑÐ°Ð²Ð°Ñ ÑÑоÑа(OH Control)40 if(value == "UP"){//UP41 IR.GetDevice("Relay 2-channel1").Set("Channel 02 Switch On", true);42 break;43 }else if(value == "DOWN"){//DOWN44 IR.GetDevice("Relay 2-channel1").Set("Channel 01 Switch On", true);45 break;46 }else{//STOP47 IR.Log("STOP");48 IR.GetDevice("Relay 2-channel1").Set("Channel 02 Switch Off", false);49 IR.GetDevice("Relay 2-channel1").Set("Channel 01 Switch Off", false);50 break;51 }52 case "OfficeLampStatus"://Ð¡Ð²ÐµÑ Ð² главной комнаÑе оÑиÑа (OH Control)53 if(value == false){54 IR.GetDevice("Mix23").Set("Relay Channel 09 Switch Off", 0);55 break;56 }else{57 IR.GetDevice("Mix23").Set("Relay Channel 09 Switch On", 0);58 break;59 }60 case "OfficeLamp2Status": //Ð¡Ð²ÐµÑ Ð² подÑобке оÑиÑа (OH Control)61 if(value == false){62 IR.GetDevice("Mix23").Set("Relay Channel 08 Switch Off", 0);63 break;64 }else{65 IR.GetDevice("Mix23").Set("Relay Channel 08 Switch On", 0);66 break;67 }68 }69});70//Control FB71IR.AddListener(IR.EVENT_TAG_CHANGE, IR.GetDevice("Mix23 (stend)"), function(name, value){72 switch (name) {73 case "Relay Channel 06": //ÐенÑилÑÑÐ¸Ñ Ð² подÑобке оÑиÑа (OH Control FB)74 if(value){75 IR.GetDevice("MQTT").Set("OfficeVentControl", 1); //on76 break;77 }else{78 IR.GetDevice("MQTT").Set("OfficeVentControl", 0); //off79 break;80 }81 }82});83//Control FB84IR.AddListener(IR.EVENT_TAG_CHANGE, IR.GetDevice("Relay 3-channel"), function(name, value){85 switch (name) { //LEFT ROLLERSHUTTER86 case "Channel 01": //UP87 IR.Log("UP On = " + value);88 break;89 case "Channel 02": //DOWN90 IR.Log("DOWN On = " + value);91 break;92 }93});94//Control FB95IR.AddListener(IR.EVENT_TAG_CHANGE, IR.GetDevice("Mix23"), function(name, value){96 switch (name) {97 case "Relay Channel 09": //Ð¡Ð²ÐµÑ Ð² главной комнаÑе оÑиÑа (OH Control FB)98 if(value){99 IR.GetDevice("MQTT").Set("OfficeLampControl", 1); //on100 break;101 }else{102 IR.GetDevice("MQTT").Set("OfficeLampControl", 0); //off103 break;104 }105 case "Relay Channel 08": //Ð¡Ð²ÐµÑ Ð² подÑобке оÑиÑа (OH Control FB)106 if(value){107 IR.GetDevice("MQTT").Set("OfficeLamp2Control", 1); //on108 break;109 }else{110 IR.GetDevice("MQTT").Set("OfficeLamp2Control", 0); //off111 break;112 }113 }...
JVCDriver.js
Source: JVCDriver.js
1var JVCDriver = function() {2 var that = this;3 4 this.powerOn = function() {5 IR.SetTimeout(0, function() {IR.GetDevice("PR").Disconnect();});6 IR.SetTimeout(100, function() {IR.GetDevice("PR").Connect();});7 IR.SetTimeout(200, function() {IR.GetDevice("PR").Send(["PJREQ"]);});8 IR.SetTimeout(300, function() {IR.GetDevice("PR").Send([0x21,0x89,0x01,0x50,0x57,0x31,0x0A]);});9 IR.SetTimeout(500, function() {IR.GetDevice("PR").Disconnect();});10 IR.SetTimeout(600, function() {IR.GetDevice("PR").Connect();});11 IR.SetTimeout(700, function() {IR.GetDevice("PR").Send(["PJREQ"]);});12 IR.SetTimeout(800, function() {IR.GetDevice("PR").Send([0x21,0x89,0x01,0x50,0x57,0x31,0x0A]);});13 IR.SetTimeout(10500, function() {IR.GetDevice("PR").Disconnect();});14 IR.SetTimeout(10600, function() {IR.GetDevice("PR").Connect();});15 IR.SetTimeout(10700, function() {IR.GetDevice("PR").Send(["PJREQ"]);});16 IR.SetTimeout(10800, function() {IR.GetDevice("PR").Send([0x21,0x89,0x01,0x50,0x57,0x31,0x0A]);});17 IR.SetTimeout(20500, function() {IR.GetDevice("PR").Disconnect();});18 IR.SetTimeout(20600, function() {IR.GetDevice("PR").Connect();});19 IR.SetTimeout(20700, function() {IR.GetDevice("PR").Send(["PJREQ"]);});20 IR.SetTimeout(20800, function() {IR.GetDevice("PR").Send([0x21,0x89,0x01,0x50,0x57,0x31,0x0A]);});21 }22 23 this.powerOff = function() {24 IR.SetTimeout(0, function() {IR.GetDevice("PR").Disconnect();});25 IR.SetTimeout(100, function() {IR.GetDevice("PR").Connect();});26 IR.SetTimeout(200, function() {IR.GetDevice("PR").Send(["PJREQ"]);});27 IR.SetTimeout(300, function() {IR.GetDevice("PR").Send([0x21,0x89,0x01,0x50,0x57,0x30,0x0A]);});28 IR.SetTimeout(500, function() {IR.GetDevice("PR").Disconnect();});29 IR.SetTimeout(600, function() {IR.GetDevice("PR").Connect();});30 IR.SetTimeout(700, function() {IR.GetDevice("PR").Send(["PJREQ"]);});31 IR.SetTimeout(800, function() {IR.GetDevice("PR").Send([0x21,0x89,0x01,0x50,0x57,0x30,0x0A]);});32 IR.SetTimeout(10500, function() {IR.GetDevice("PR").Disconnect();});33 IR.SetTimeout(10600, function() {IR.GetDevice("PR").Connect();});34 IR.SetTimeout(10700, function() {IR.GetDevice("PR").Send(["PJREQ"]);});35 IR.SetTimeout(10800, function() {IR.GetDevice("PR").Send([0x21,0x89,0x01,0x50,0x57,0x30,0x0A]);});36 IR.SetTimeout(20500, function() {IR.GetDevice("PR").Disconnect();});37 IR.SetTimeout(20600, function() {IR.GetDevice("PR").Connect();});38 IR.SetTimeout(20700, function() {IR.GetDevice("PR").Send(["PJREQ"]);});39 IR.SetTimeout(20800, function() {IR.GetDevice("PR").Send([0x21,0x89,0x01,0x50,0x57,0x30,0x0A]);});40 }41 42 this.aspect = function() {43 IR.SetTimeout(0, function() {IR.GetDevice("PR").Disconnect();});44 IR.SetTimeout(100, function() {IR.GetDevice("PR").Connect();});45 IR.SetTimeout(200, function() {IR.GetDevice("PR").Send(["PJREQ"]);});46 IR.SetTimeout(300, function() {IR.GetDevice("PR").Send([0x21,0x89,0x01,0x52,0x43,0x37,0x33,0x37,0x37,0x0A]);});47 }48 49 this.on3d_auto = function() {50 IR.SetTimeout(0, function() {IR.GetDevice("PR").Disconnect();});51 IR.SetTimeout(100, function() {IR.GetDevice("PR").Connect();});52 IR.SetTimeout(200, function() {IR.GetDevice("PR").Send(["PJREQ"]);});53 IR.SetTimeout(300, function() {IR.GetDevice("PR").Send([0x21,0x89,0x01,0x49,0x53,0x33,0x44,0x31,0x0A]);});54 }55 56 this.on3d_off = function() {57 IR.SetTimeout(0, function() {IR.GetDevice("PR").Disconnect();});58 IR.SetTimeout(100, function() {IR.GetDevice("PR").Connect();});59 IR.SetTimeout(200, function() {IR.GetDevice("PR").Send(["PJREQ"]);});60 IR.SetTimeout(300, function() {IR.GetDevice("PR").Send([0x21,0x89,0x01,0x49,0x53,0x33,0x44,0x30,0x0A]);});61 }62 63 /*IR.AddListener(IR.EVENT_RECEIVE_TEXT, IR.GetDevice("PR"), function(text) {64 IR.Log("from pr: " + text);65 });*/...
Using AI Code Generation
1const stf = require('devicefarmer-stf');2const device = stf.getDevice('deviceid');3console.log(device);4const stf = require('devicefarmer-stf');5stf.getDevice('deviceid', function(err, device) {6 console.log(device);7});8const stf = require('devicefarmer-stf');9stf.getDevice('deviceid').then(function(device) {10 console.log(device);11});12const stf = require('devicefarmer-stf');13stf.getDevice('deviceid').then((device) => {14 console.log(device);15});16const stf = require('devicefarmer-stf');17stf.getDevice('deviceid').then(console.log);18const stf = require('devicefarmer-stf');19stf.getDevice('deviceid').then(console.log).catch(console.error);20const stf = require('devicefarmer-stf');21stf.getDevice('deviceid')22 .then(console.log)23 .catch(console.error);24const stf = require('devicefarmer-stf');25stf.getDevice('deviceid')26 .then(console.log)27 .catch(console.error)28 .then(() => {29 console.log('done');30 });31const stf = require('devicefarmer-stf');32stf.getDevice('deviceid')33 .then(console.log)34 .catch(console.error)35 .then(() => {36 console.log('done');37 })38 .catch(console.error);
Using AI Code Generation
1var stf = require('devicefarmer-stf-client');2stfClient.getDevice('serialNumber')3.then(function(device) {4 console.log(device);5})6.catch(function(err) {7 console.error(err);8});9var stf = require('devicefarmer-stf-client');10stfClient.getDevices()11.then(function(devices) {12 console.log(devices);13})14.catch(function(err) {15 console.error(err);16});17var stf = require('devicefarmer-stf-client');18stfClient.getDevicesByOwner('owner')19.then(function(devices) {20 console.log(devices);21})22.catch(function(err) {23 console.error(err);24});25var stf = require('devicefarmer-stf-client');26stfClient.getDevicesByGroup('group')27.then(function(devices) {28 console.log(devices);29})30.catch(function(err) {31 console.error(err);32});33var stf = require('devicefarmer-stf-client');34stfClient.getDevicesByStatus('status')35.then(function(devices) {36 console.log(devices);37})38.catch(function(err) {39 console.error(err);40});41var stf = require('devicefarmer-stf-client');42stfClient.getDevicesByOwnerGroup('owner', 'group')43.then(function(devices) {44 console.log(devices);45})46.catch(function(err) {47 console.error(err);48});
Using AI Code Generation
1var stf = require('devicefarmer-stf');2 if(err){3 console.log(err);4 }5 else{6 console.log(device);7 }8});9 if(err){10 console.log(err);11 }12 else{13 console.log(devices);14 }15});16 if(err){17 console.log(err);18 }19 else{20 console.log(devices);21 }22});23 if(err){24 console.log(err);25 }26 else{27 console.log(devices);28 }29});30 if(err){31 console.log(err);32 }33 else{34 console.log(devices);35 }36});37 if(err){38 console.log(err);39 }40 else{41 console.log(devices);42 }43});44 if(err){45 console.log(err);46 }47 else{48 console.log(devices);49 }50});51 if(err){52 console.log(err);
Using AI Code Generation
1var deviceFarmer = require('devicefarmer-stf-client');2client.getDevice("deviceID", function (err, device) {3 if (err) {4 console.log(err);5 }6 else {7 console.log("Device Found");8 }9});10var deviceFarmer = require('devicefarmer-stf-client');11client.getDevices(function (err, devices) {12 if (err) {13 console.log(err);14 }15 else {16 console.log("Devices Found");17 }18});19var deviceFarmer = require('devicefarmer-stf-client');20client.getDeviceBySerial("serialNumber", function (err, device) {21 if (err) {22 console.log(err);23 }24 else {25 console.log("Device Found");26 }27});28var deviceFarmer = require('devicefarmer-stf-client');29client.getDevicesBySerial(["serialNumber1","serialNumber2"], function (err, devices) {30 if (err) {31 console.log(err);32 }33 else {34 console.log("Devices Found");35 }36});37var deviceFarmer = require('devicefarmer-stf-client');38client.getDevicesBySerial(["serialNumber1","serialNumber2"], function (err, devices) {39 if (err) {40 console.log(err);41 }42 else {43 console.log("Devices Found");44 }45});46var deviceFarmer = require('devicefarmer-stf-client');
Using AI Code Generation
1const stf = require('devicefarmer-stf');2stf.getDevice('device_id', function(err, device) {3 console.log(device);4});5const stf = require('devicefarmer-stf');6stf.getDevices(function(err, devices) {7 console.log(devices);8});9const stf = require('devicefarmer-stf');10stf.getDevicesByOwner('owner', function(err, devices) {11 console.log(devices);12});13const stf = require('devicefarmer-stf');14stf.getDevicesByGroup('group', function(err, devices) {15 console.log(devices);16});17const stf = require('devicefarmer-stf');18stf.getDevicesByUser('user', function(err, devices) {19 console.log(devices);20});21const stf = require('devicefarmer-stf');22stf.getDevicesByProvider('provider', function(err, devices) {23 console.log(devices);24});25const stf = require('devicefarmer-stf');26stf.getDevicesByStatus('status', function(err, devices) {27 console.log(devices);28});29const stf = require('devicefarmer-stf');30stf.getDevicesByAvailability('availability', function(err, devices) {31 console.log(devices);32});33const stf = require('devicefarmer-stf');34stf.getDevicesByPlatform('platform', function(err, devices) {35 console.log(devices);36});37const stf = require('devicefarmer-stf');38stf.getDevicesByModel('model', function(err, devices) {39 console.log(devices);40});
Check out the latest blogs from LambdaTest on this topic:
JavaScript is one of the most widely used programming languages. This popularity invites a lot of JavaScript development and testing frameworks to ease the process of working with it. As a result, numerous JavaScript testing frameworks can be used to perform unit testing.
With the change in technology trends, there has been a drastic change in the way we build and develop applications. It is essential to simplify your programming requirements to achieve the desired outcomes in the long run. Visual Studio Code is regarded as one of the best IDEs for web development used by developers.
The holidays are just around the corner, and with Christmas and New Year celebrations coming up, everyone is busy preparing for the festivities! And during this busy time of year, LambdaTest also prepped something special for our beloved developers and testers – #LambdaTestYourBusiness
The rapid shift in the use of technology has impacted testing and quality assurance significantly, especially around the cloud adoption of agile development methodologies. With this, the increasing importance of quality and automation testing has risen enough to deliver quality work.
Xamarin is an open-source framework that offers cross-platform application development using the C# programming language. It helps to simplify your overall development and management of cross-platform software applications.
Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.
You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.
Get 100 minutes of automation test minutes FREE!!