@lumiastream/tapo-cove 0.0.1-alpha.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (78) hide show
  1. package/dist/module/discovery.d.ts +8 -0
  2. package/dist/module/discovery.js +118 -0
  3. package/dist/module/index.d.ts +5 -0
  4. package/dist/module/index.js +12 -0
  5. package/dist/module/lightstate.d.ts +39 -0
  6. package/dist/module/lightstate.js +123 -0
  7. package/dist/module/shared/cipher.d.ts +11 -0
  8. package/dist/module/shared/cipher.js +66 -0
  9. package/dist/module/shared/color-transformer.d.ts +8 -0
  10. package/dist/module/shared/color-transformer.js +42 -0
  11. package/dist/module/shared/helpers.d.ts +5 -0
  12. package/dist/module/shared/helpers.js +105 -0
  13. package/dist/module/shared/tapo-ca-cert.d.ts +2 -0
  14. package/dist/module/shared/tapo-ca-cert.js +3 -0
  15. package/dist/module/shared/tapo.constants.d.ts +21 -0
  16. package/dist/module/shared/tapo.constants.js +25 -0
  17. package/dist/module/shared/utils.d.ts +23 -0
  18. package/dist/module/shared/utils.js +152 -0
  19. package/dist/module/tapo-api.d.ts +48 -0
  20. package/dist/module/tapo-api.js +142 -0
  21. package/dist/module/types/interfaces.d.ts +3 -0
  22. package/dist/module/types/interfaces.js +2 -0
  23. package/dist/module/types/raw-types.d.ts +84 -0
  24. package/dist/module/types/raw-types.js +2 -0
  25. package/lib/cjs/discovery.d.ts +8 -0
  26. package/lib/cjs/discovery.js +118 -0
  27. package/lib/cjs/index.d.ts +5 -0
  28. package/lib/cjs/index.js +12 -0
  29. package/lib/cjs/lightstate.d.ts +39 -0
  30. package/lib/cjs/lightstate.js +123 -0
  31. package/lib/cjs/shared/cipher.d.ts +11 -0
  32. package/lib/cjs/shared/cipher.js +66 -0
  33. package/lib/cjs/shared/color-transformer.d.ts +8 -0
  34. package/lib/cjs/shared/color-transformer.js +42 -0
  35. package/lib/cjs/shared/helpers.d.ts +5 -0
  36. package/lib/cjs/shared/helpers.js +105 -0
  37. package/lib/cjs/shared/tapo-ca-cert.d.ts +2 -0
  38. package/lib/cjs/shared/tapo-ca-cert.js +3 -0
  39. package/lib/cjs/shared/tapo.constants.d.ts +21 -0
  40. package/lib/cjs/shared/tapo.constants.js +25 -0
  41. package/lib/cjs/shared/utils.d.ts +23 -0
  42. package/lib/cjs/shared/utils.js +152 -0
  43. package/lib/cjs/tapo-api.d.ts +48 -0
  44. package/lib/cjs/tapo-api.js +142 -0
  45. package/lib/cjs/types/interfaces.d.ts +3 -0
  46. package/lib/cjs/types/interfaces.js +2 -0
  47. package/lib/cjs/types/raw-types.d.ts +84 -0
  48. package/lib/cjs/types/raw-types.js +2 -0
  49. package/lib/esm/discovery.d.ts +8 -0
  50. package/lib/esm/discovery.js +116 -0
  51. package/lib/esm/index.d.ts +5 -0
  52. package/lib/esm/index.js +5 -0
  53. package/lib/esm/lightstate.d.ts +39 -0
  54. package/lib/esm/lightstate.js +120 -0
  55. package/lib/esm/shared/cipher.d.ts +11 -0
  56. package/lib/esm/shared/cipher.js +56 -0
  57. package/lib/esm/shared/color-transformer.d.ts +8 -0
  58. package/lib/esm/shared/color-transformer.js +40 -0
  59. package/lib/esm/shared/helpers.d.ts +5 -0
  60. package/lib/esm/shared/helpers.js +98 -0
  61. package/lib/esm/shared/tapo-ca-cert.d.ts +2 -0
  62. package/lib/esm/shared/tapo-ca-cert.js +1 -0
  63. package/lib/esm/shared/tapo.constants.d.ts +21 -0
  64. package/lib/esm/shared/tapo.constants.js +22 -0
  65. package/lib/esm/shared/utils.d.ts +23 -0
  66. package/lib/esm/shared/utils.js +146 -0
  67. package/lib/esm/tapo-api.d.ts +48 -0
  68. package/lib/esm/tapo-api.js +140 -0
  69. package/lib/esm/types/interfaces.d.ts +3 -0
  70. package/lib/esm/types/interfaces.js +1 -0
  71. package/lib/esm/types/raw-types.d.ts +84 -0
  72. package/lib/esm/types/raw-types.js +1 -0
  73. package/package.json +38 -0
  74. package/test/auth.test.ts +22 -0
  75. package/test/discover.test.ts +9 -0
  76. package/test/light.test.ts +17 -0
  77. package/test/plug.test.ts +16 -0
  78. package/tslint.json +53 -0
@@ -0,0 +1,17 @@
1
+ import { LightState, TapoApi } from '../src';
2
+
3
+ const email = '';
4
+ const password = '';
5
+ const token = '';
6
+ const deviceId = '';
7
+ const deviceIp = '';
8
+
9
+ (async () => {
10
+ const api = new TapoApi({ token });
11
+
12
+ const devices = await api.setup({ email, password, devices: [{ id: deviceId, ip: deviceIp }] });
13
+ console.log('devices: ', devices);
14
+
15
+ const state = new LightState({ rgb: { r: 200, g: 0, b: 10 }, brightness: 100 });
16
+ await api.sendState({ device: { id: deviceId }, state });
17
+ })();
@@ -0,0 +1,16 @@
1
+ import { TapoApi } from '../src';
2
+
3
+ const email = '';
4
+ const password = '';
5
+ const token = '';
6
+ const deviceId = '';
7
+ const deviceIp = '';
8
+
9
+ (async () => {
10
+ const api = new TapoApi({ token });
11
+
12
+ const devices = await api.setup({ email, password, devices: [{ id: deviceId, ip: deviceIp }] });
13
+ console.log('devices: ', devices);
14
+
15
+ await api.sendPower({ device: { id: deviceId }, power: false });
16
+ })();
package/tslint.json ADDED
@@ -0,0 +1,53 @@
1
+ {
2
+ "extends": ["tslint:recommended", "tslint-react", "tslint-config-prettier", "tslint-eslint-rules"],
3
+ "linterOptions": {
4
+ "exclude": [
5
+ "config/**/*.js",
6
+ "node_modules/**/*.ts",
7
+ "coverage/lcov-report/*.js"
8
+ ]
9
+ },
10
+ "parser": "babel-eslint",
11
+ "parserOptions": {
12
+ "ecmaFeatures": {
13
+ "jsx": true
14
+ },
15
+ "ecmaVersion": 2018,
16
+ "sourceType": "module"
17
+ },
18
+ "plugins": [
19
+ "react"
20
+ ],
21
+ "rules": {
22
+ "arrow-parens": true,
23
+ "arrow-return-shorthand": true,
24
+ "callable-types": false,
25
+ "curly": false,
26
+ "defaultSeverity": "warning",
27
+ "forin": false,
28
+ "indent": [true, "tabs", 2],
29
+ "jsx-alignment": false,
30
+ "jsx-boolean-value": 1,
31
+ "jsx-curly-spacing": 1,
32
+ "jsx-key": 1,
33
+ "jsx-no-lambda": false,
34
+ "linebreak-style": [true, "unix"],
35
+ "max-classes-per-file": false,
36
+ "member-access": false,
37
+ "no-console": false,
38
+ "no-debugger": false,
39
+ "no-empty": false,
40
+ "no-irregular-whitespace": true,
41
+ "no-unnecessary-initializer": true,
42
+ "no-unused-expression": false,
43
+ "no-unused-variable": false,
44
+ "object-curly-spacing": [true, "always"],
45
+ "object-literal-sort-keys": false,
46
+ "ordered-imports": false,
47
+ "prefer-conditional-expression": [true, "check-else-if"],
48
+ "prefer-object-spread": true,
49
+ "quotemark": [true, "single", "avoid-escape", "avoid-template"],
50
+ "semicolon": [true, "always", "ignore-bound-class-methods"],
51
+ "variable-name": false
52
+ }
53
+ }