python-kasa 0.7.0.dev1__py3-none-any.whl → 0.7.0.dev3__py3-none-any.whl

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 (47) hide show
  1. kasa/__init__.py +16 -9
  2. kasa/aestransport.py +3 -4
  3. kasa/cli.py +13 -11
  4. kasa/device.py +26 -3
  5. kasa/deviceconfig.py +45 -20
  6. kasa/discover.py +106 -46
  7. kasa/feature.py +2 -1
  8. kasa/httpclient.py +24 -0
  9. kasa/iot/iotdevice.py +1 -1
  10. kasa/iot/iotlightstrip.py +3 -2
  11. kasa/iot/iotplug.py +1 -1
  12. kasa/iot/iotstrip.py +30 -1
  13. kasa/iot/modules/lighteffect.py +13 -7
  14. kasa/iot/modules/lightpreset.py +6 -1
  15. kasa/smart/modules/autooff.py +13 -8
  16. kasa/smart/modules/fan.py +3 -2
  17. kasa/smartprotocol.py +3 -1
  18. kasa/tests/device_fixtures.py +10 -1
  19. kasa/tests/discovery_fixtures.py +82 -29
  20. kasa/tests/fakeprotocol_iot.py +36 -7
  21. kasa/tests/fixtures/HS110(EU)_1.0_1.2.5.json +1 -1
  22. kasa/tests/fixtures/HS110(US)_1.0_1.2.6.json +37 -0
  23. kasa/tests/fixtures/HS220(US)_1.0_1.5.7.json +1 -1
  24. kasa/tests/fixtures/HS220(US)_2.0_1.0.3.json +1 -1
  25. kasa/tests/fixtures/HS300(US)_1.0_1.0.21.json +89 -0
  26. kasa/tests/fixtures/KL120(US)_1.0_1.8.11.json +85 -0
  27. kasa/tests/fixtures/KL430(US)_1.0_1.0.10.json +51 -12
  28. kasa/tests/fixtures/KP303(UK)_1.0_1.0.3.json +1 -1
  29. kasa/tests/fixtures/smart/L530E(EU)_3.0_1.1.6.json +1 -1
  30. kasa/tests/fixtures/smart/P115(EU)_1.0_1.2.3.json +386 -0
  31. kasa/tests/fixtures/smart/S505D(US)_1.0_1.1.0.json +262 -0
  32. kasa/tests/smart/modules/test_autooff.py +103 -0
  33. kasa/tests/smart/modules/test_fan.py +5 -0
  34. kasa/tests/test_aestransport.py +90 -2
  35. kasa/tests/test_bulb.py +9 -4
  36. kasa/tests/test_common_modules.py +1 -1
  37. kasa/tests/test_device.py +28 -6
  38. kasa/tests/test_device_factory.py +8 -8
  39. kasa/tests/test_discovery.py +61 -4
  40. kasa/tests/test_readme_examples.py +37 -22
  41. kasa/tests/test_smartprotocol.py +3 -2
  42. kasa/tests/test_strip.py +8 -0
  43. {python_kasa-0.7.0.dev1.dist-info → python_kasa-0.7.0.dev3.dist-info}/METADATA +4 -4
  44. {python_kasa-0.7.0.dev1.dist-info → python_kasa-0.7.0.dev3.dist-info}/RECORD +47 -41
  45. {python_kasa-0.7.0.dev1.dist-info → python_kasa-0.7.0.dev3.dist-info}/LICENSE +0 -0
  46. {python_kasa-0.7.0.dev1.dist-info → python_kasa-0.7.0.dev3.dist-info}/WHEEL +0 -0
  47. {python_kasa-0.7.0.dev1.dist-info → python_kasa-0.7.0.dev3.dist-info}/entry_points.txt +0 -0
kasa/iot/iotstrip.py CHANGED
@@ -10,6 +10,7 @@ from typing import Any
10
10
  from ..device_type import DeviceType
11
11
  from ..deviceconfig import DeviceConfig
12
12
  from ..exceptions import KasaException
13
+ from ..feature import Feature
13
14
  from ..module import Module
14
15
  from ..protocol import BaseProtocol
15
16
  from .iotdevice import (
@@ -55,7 +56,7 @@ class IotStrip(IotDevice):
55
56
  >>> strip = IotStrip("127.0.0.1")
56
57
  >>> asyncio.run(strip.update())
57
58
  >>> strip.alias
58
- TP-LINK_Power Strip_CF69
59
+ Bedroom Power Strip
59
60
 
60
61
  All methods act on the whole strip:
61
62
 
@@ -125,6 +126,8 @@ class IotStrip(IotDevice):
125
126
  )
126
127
  for child in children
127
128
  }
129
+ for child in self._children.values():
130
+ await child._initialize_features()
128
131
 
129
132
  if update_children and self.has_emeter:
130
133
  for plug in self.children:
@@ -250,6 +253,32 @@ class IotStripPlug(IotPlug):
250
253
  await super()._initialize_modules()
251
254
  self.add_module("time", Time(self, "time"))
252
255
 
256
+ async def _initialize_features(self):
257
+ """Initialize common features."""
258
+ self._add_feature(
259
+ Feature(
260
+ self,
261
+ id="state",
262
+ name="State",
263
+ attribute_getter="is_on",
264
+ attribute_setter="set_state",
265
+ type=Feature.Type.Switch,
266
+ category=Feature.Category.Primary,
267
+ )
268
+ )
269
+ self._add_feature(
270
+ Feature(
271
+ device=self,
272
+ id="on_since",
273
+ name="On since",
274
+ attribute_getter="on_since",
275
+ icon="mdi:clock",
276
+ )
277
+ )
278
+ # If the strip plug has it's own modules we should call initialize
279
+ # features for the modules here. However the _initialize_modules function
280
+ # above does not seem to be called.
281
+
253
282
  async def update(self, update_children: bool = True):
254
283
  """Query the device to update the data.
255
284
 
@@ -3,6 +3,7 @@
3
3
  from __future__ import annotations
4
4
 
5
5
  from ...interfaces.lighteffect import LightEffect as LightEffectInterface
6
+ from ...module import Module
6
7
  from ..effects import EFFECT_MAPPING_V1, EFFECT_NAMES_V1
7
8
  from ..iotmodule import IotModule
8
9
 
@@ -59,19 +60,24 @@ class LightEffect(IotModule, LightEffectInterface):
59
60
  :param int transition: The wanted transition time
60
61
  """
61
62
  if effect == self.LIGHT_EFFECTS_OFF:
62
- effect_dict = dict(self.data["lighting_effect_state"])
63
- effect_dict["enable"] = 0
63
+ light_module = self._device.modules[Module.Light]
64
+ effect_off_state = light_module.state
65
+ if brightness is not None:
66
+ effect_off_state.brightness = brightness
67
+ if transition is not None:
68
+ effect_off_state.transition = transition
69
+ await light_module.set_state(effect_off_state)
64
70
  elif effect not in EFFECT_MAPPING_V1:
65
71
  raise ValueError(f"The effect {effect} is not a built in effect.")
66
72
  else:
67
73
  effect_dict = EFFECT_MAPPING_V1[effect]
68
74
 
69
- if brightness is not None:
70
- effect_dict["brightness"] = brightness
71
- if transition is not None:
72
- effect_dict["transition"] = transition
75
+ if brightness is not None:
76
+ effect_dict["brightness"] = brightness
77
+ if transition is not None:
78
+ effect_dict["transition"] = transition
73
79
 
74
- await self.set_custom_effect(effect_dict)
80
+ await self.set_custom_effect(effect_dict)
75
81
 
76
82
  async def set_custom_effect(
77
83
  self,
@@ -45,6 +45,9 @@ class LightPreset(IotModule, LightPresetInterface):
45
45
  self._presets = {
46
46
  f"Light preset {index+1}": IotLightPreset(**vals)
47
47
  for index, vals in enumerate(self.data["preferred_state"])
48
+ # Devices may list some light effects along with normal presets but these
49
+ # are handled by the LightEffect module so exclude preferred states with id
50
+ if "id" not in vals
48
51
  }
49
52
  self._preset_list = [self.PRESET_NOT_SET]
50
53
  self._preset_list.extend(self._presets.keys())
@@ -133,7 +136,9 @@ class LightPreset(IotModule, LightPresetInterface):
133
136
  def _deprecated_presets(self) -> list[IotLightPreset]:
134
137
  """Return a list of available bulb setting presets."""
135
138
  return [
136
- IotLightPreset(**vals) for vals in self._device.sys_info["preferred_state"]
139
+ IotLightPreset(**vals)
140
+ for vals in self._device.sys_info["preferred_state"]
141
+ if "id" not in vals
137
142
  ]
138
143
 
139
144
  async def _deprecated_save_preset(self, preset: IotLightPreset):
@@ -2,14 +2,13 @@
2
2
 
3
3
  from __future__ import annotations
4
4
 
5
+ import logging
5
6
  from datetime import datetime, timedelta
6
- from typing import TYPE_CHECKING
7
7
 
8
8
  from ...feature import Feature
9
9
  from ..smartmodule import SmartModule
10
10
 
11
- if TYPE_CHECKING:
12
- from ..smartdevice import SmartDevice
11
+ _LOGGER = logging.getLogger(__name__)
13
12
 
14
13
 
15
14
  class AutoOff(SmartModule):
@@ -18,11 +17,17 @@ class AutoOff(SmartModule):
18
17
  REQUIRED_COMPONENT = "auto_off"
19
18
  QUERY_GETTER_NAME = "get_auto_off_config"
20
19
 
21
- def __init__(self, device: SmartDevice, module: str):
22
- super().__init__(device, module)
20
+ def _initialize_features(self):
21
+ """Initialize features after the initial update."""
22
+ if not isinstance(self.data, dict):
23
+ _LOGGER.warning(
24
+ "No data available for module, skipping %s: %s", self, self.data
25
+ )
26
+ return
27
+
23
28
  self._add_feature(
24
29
  Feature(
25
- device,
30
+ self._device,
26
31
  id="auto_off_enabled",
27
32
  name="Auto off enabled",
28
33
  container=self,
@@ -33,7 +38,7 @@ class AutoOff(SmartModule):
33
38
  )
34
39
  self._add_feature(
35
40
  Feature(
36
- device,
41
+ self._device,
37
42
  id="auto_off_minutes",
38
43
  name="Auto off minutes",
39
44
  container=self,
@@ -44,7 +49,7 @@ class AutoOff(SmartModule):
44
49
  )
45
50
  self._add_feature(
46
51
  Feature(
47
- device,
52
+ self._device,
48
53
  id="auto_off_at",
49
54
  name="Auto off at",
50
55
  container=self,
kasa/smart/modules/fan.py CHANGED
@@ -5,13 +5,14 @@ from __future__ import annotations
5
5
  from typing import TYPE_CHECKING
6
6
 
7
7
  from ...feature import Feature
8
+ from ...interfaces.fan import Fan as FanInterface
8
9
  from ..smartmodule import SmartModule
9
10
 
10
11
  if TYPE_CHECKING:
11
12
  from ..smartdevice import SmartDevice
12
13
 
13
14
 
14
- class Fan(SmartModule):
15
+ class Fan(SmartModule, FanInterface):
15
16
  """Implementation of fan_control module."""
16
17
 
17
18
  REQUIRED_COMPONENT = "fan_control"
@@ -54,7 +55,7 @@ class Fan(SmartModule):
54
55
  @property
55
56
  def fan_speed_level(self) -> int:
56
57
  """Return fan speed level."""
57
- return self.data["fan_speed_level"]
58
+ return 0 if self.data["device_on"] is False else self.data["fan_speed_level"]
58
59
 
59
60
  async def set_fan_speed_level(self, level: int):
60
61
  """Set fan speed level, 0 for off, 1-4 for on."""
kasa/smartprotocol.py CHANGED
@@ -402,7 +402,9 @@ class _ChildProtocolWrapper(SmartProtocol):
402
402
  ret_val = {}
403
403
  for multi_response in multi_responses:
404
404
  method = multi_response["method"]
405
- self._handle_response_error_code(multi_response, method)
405
+ self._handle_response_error_code(
406
+ multi_response, method, raise_on_error=False
407
+ )
406
408
  ret_val[method] = multi_response.get("result")
407
409
  return ret_val
408
410
 
@@ -75,6 +75,7 @@ PLUGS_IOT = {
75
75
  PLUGS_SMART = {
76
76
  "P100",
77
77
  "P110",
78
+ "P115",
78
79
  "KP125M",
79
80
  "EP25",
80
81
  "P125M",
@@ -95,6 +96,7 @@ SWITCHES_SMART = {
95
96
  "KS240",
96
97
  "S500D",
97
98
  "S505",
99
+ "S505D",
98
100
  }
99
101
  SWITCHES = {*SWITCHES_IOT, *SWITCHES_SMART}
100
102
  STRIPS_IOT = {"HS107", "HS300", "KP303", "KP200", "KP400", "EP40"}
@@ -113,7 +115,7 @@ SENSORS_SMART = {"T310", "T315", "T300", "T110"}
113
115
  THERMOSTATS_SMART = {"KE100"}
114
116
 
115
117
  WITH_EMETER_IOT = {"HS110", "HS300", "KP115", "KP125", *BULBS_IOT}
116
- WITH_EMETER_SMART = {"P110", "KP125M", "EP25"}
118
+ WITH_EMETER_SMART = {"P110", "P115", "KP125M", "EP25"}
117
119
  WITH_EMETER = {*WITH_EMETER_IOT, *WITH_EMETER_SMART}
118
120
 
119
121
  DIMMABLE = {*BULBS, *DIMMERS}
@@ -396,6 +398,13 @@ async def get_device_for_fixture_protocol(fixture, protocol):
396
398
  return await get_device_for_fixture(fixture_info)
397
399
 
398
400
 
401
+ def get_fixture_info(fixture, protocol):
402
+ finfo = FixtureInfo(name=fixture, protocol=protocol, data={})
403
+ for fixture_info in FIXTURE_DATA:
404
+ if finfo == fixture_info:
405
+ return fixture_info
406
+
407
+
399
408
  @pytest.fixture(params=filter_fixtures("main devices"), ids=idgenerator)
400
409
  async def dev(request) -> AsyncGenerator[Device, None]:
401
410
  """Device fixture.
@@ -44,9 +44,14 @@ UNSUPPORTED_DEVICES = {
44
44
  }
45
45
 
46
46
 
47
- def parametrize_discovery(desc, *, data_root_filter, protocol_filter=None):
47
+ def parametrize_discovery(
48
+ desc, *, data_root_filter=None, protocol_filter=None, model_filter=None
49
+ ):
48
50
  filtered_fixtures = filter_fixtures(
49
- desc, data_root_filter=data_root_filter, protocol_filter=protocol_filter
51
+ desc,
52
+ data_root_filter=data_root_filter,
53
+ protocol_filter=protocol_filter,
54
+ model_filter=model_filter,
50
55
  )
51
56
  return pytest.mark.parametrize(
52
57
  "discovery_mock",
@@ -65,10 +70,14 @@ new_discovery = parametrize_discovery(
65
70
  params=filter_fixtures("discoverable", protocol_filter={"SMART", "IOT"}),
66
71
  ids=idgenerator,
67
72
  )
68
- def discovery_mock(request, mocker):
73
+ async def discovery_mock(request, mocker):
69
74
  """Mock discovery and patch protocol queries to use Fake protocols."""
70
75
  fixture_info: FixtureInfo = request.param
71
- fixture_data = fixture_info.data
76
+ yield patch_discovery({"127.0.0.123": fixture_info}, mocker)
77
+
78
+
79
+ def create_discovery_mock(ip: str, fixture_data: dict):
80
+ """Mock discovery and patch protocol queries to use Fake protocols."""
72
81
 
73
82
  @dataclass
74
83
  class _DiscoveryMock:
@@ -79,6 +88,7 @@ def discovery_mock(request, mocker):
79
88
  query_data: dict
80
89
  device_type: str
81
90
  encrypt_type: str
91
+ _datagram: bytes
82
92
  login_version: int | None = None
83
93
  port_override: int | None = None
84
94
 
@@ -94,13 +104,14 @@ def discovery_mock(request, mocker):
94
104
  + json_dumps(discovery_data).encode()
95
105
  )
96
106
  dm = _DiscoveryMock(
97
- "127.0.0.123",
107
+ ip,
98
108
  80,
99
109
  20002,
100
110
  discovery_data,
101
111
  fixture_data,
102
112
  device_type,
103
113
  encrypt_type,
114
+ datagram,
104
115
  login_version,
105
116
  )
106
117
  else:
@@ -111,45 +122,87 @@ def discovery_mock(request, mocker):
111
122
  login_version = None
112
123
  datagram = XorEncryption.encrypt(json_dumps(discovery_data))[4:]
113
124
  dm = _DiscoveryMock(
114
- "127.0.0.123",
125
+ ip,
115
126
  9999,
116
127
  9999,
117
128
  discovery_data,
118
129
  fixture_data,
119
130
  device_type,
120
131
  encrypt_type,
132
+ datagram,
121
133
  login_version,
122
134
  )
123
135
 
136
+ return dm
137
+
138
+
139
+ def patch_discovery(fixture_infos: dict[str, FixtureInfo], mocker):
140
+ """Mock discovery and patch protocol queries to use Fake protocols."""
141
+ discovery_mocks = {
142
+ ip: create_discovery_mock(ip, fixture_info.data)
143
+ for ip, fixture_info in fixture_infos.items()
144
+ }
145
+ protos = {
146
+ ip: FakeSmartProtocol(fixture_info.data, fixture_info.name)
147
+ if "SMART" in fixture_info.protocol
148
+ else FakeIotProtocol(fixture_info.data, fixture_info.name)
149
+ for ip, fixture_info in fixture_infos.items()
150
+ }
151
+ first_ip = list(fixture_infos.keys())[0]
152
+ first_host = None
153
+
124
154
  async def mock_discover(self):
125
- port = (
126
- dm.port_override
127
- if dm.port_override and dm.discovery_port != 20002
128
- else dm.discovery_port
129
- )
130
- self.datagram_received(
131
- datagram,
132
- (dm.ip, port),
133
- )
155
+ """Call datagram_received for all mock fixtures.
156
+
157
+ Handles test cases modifying the ip and hostname of the first fixture
158
+ for discover_single testing.
159
+ """
160
+ for ip, dm in discovery_mocks.items():
161
+ first_ip = list(discovery_mocks.values())[0].ip
162
+ fixture_info = fixture_infos[ip]
163
+ # Ip of first fixture could have been modified by a test
164
+ if dm.ip == first_ip:
165
+ # hostname could have been used
166
+ host = first_host if first_host else first_ip
167
+ else:
168
+ host = dm.ip
169
+ # update the protos for any host testing or the test overriding the first ip
170
+ protos[host] = (
171
+ FakeSmartProtocol(fixture_info.data, fixture_info.name)
172
+ if "SMART" in fixture_info.protocol
173
+ else FakeIotProtocol(fixture_info.data, fixture_info.name)
174
+ )
175
+ port = (
176
+ dm.port_override
177
+ if dm.port_override and dm.discovery_port != 20002
178
+ else dm.discovery_port
179
+ )
180
+ self.datagram_received(
181
+ dm._datagram,
182
+ (dm.ip, port),
183
+ )
184
+
185
+ async def _query(self, request, retry_count: int = 3):
186
+ return await protos[self._host].query(request)
134
187
 
188
+ def _getaddrinfo(host, *_, **__):
189
+ nonlocal first_host, first_ip
190
+ first_host = host # Store the hostname used by discover single
191
+ first_ip = list(discovery_mocks.values())[
192
+ 0
193
+ ].ip # ip could have been overridden in test
194
+ return [(None, None, None, None, (first_ip, 0))]
195
+
196
+ mocker.patch("kasa.IotProtocol.query", _query)
197
+ mocker.patch("kasa.SmartProtocol.query", _query)
135
198
  mocker.patch("kasa.discover._DiscoverProtocol.do_discover", mock_discover)
136
199
  mocker.patch(
137
200
  "socket.getaddrinfo",
138
- side_effect=lambda *_, **__: [(None, None, None, None, (dm.ip, 0))],
201
+ # side_effect=lambda *_, **__: [(None, None, None, None, (first_ip, 0))],
202
+ side_effect=_getaddrinfo,
139
203
  )
140
-
141
- if "SMART" in fixture_info.protocol:
142
- proto = FakeSmartProtocol(fixture_data, fixture_info.name)
143
- else:
144
- proto = FakeIotProtocol(fixture_data)
145
-
146
- async def _query(request, retry_count: int = 3):
147
- return await proto.query(request)
148
-
149
- mocker.patch("kasa.IotProtocol.query", side_effect=_query)
150
- mocker.patch("kasa.SmartProtocol.query", side_effect=_query)
151
-
152
- yield dm
204
+ # Only return the first discovery mock to be used for testing discover single
205
+ return discovery_mocks[first_ip]
153
206
 
154
207
 
155
208
  @pytest.fixture(
@@ -3,7 +3,7 @@ import logging
3
3
 
4
4
  from ..deviceconfig import DeviceConfig
5
5
  from ..iotprotocol import IotProtocol
6
- from ..xortransport import XorTransport
6
+ from ..protocol import BaseTransport
7
7
 
8
8
  _LOGGER = logging.getLogger(__name__)
9
9
 
@@ -178,17 +178,26 @@ MOTION_MODULE = {
178
178
 
179
179
 
180
180
  class FakeIotProtocol(IotProtocol):
181
- def __init__(self, info):
181
+ def __init__(self, info, fixture_name=None):
182
182
  super().__init__(
183
- transport=XorTransport(
184
- config=DeviceConfig("127.0.0.123"),
185
- )
183
+ transport=FakeIotTransport(info, fixture_name),
186
184
  )
185
+
186
+ async def query(self, request, retry_count: int = 3):
187
+ """Implement query here so tests can still patch IotProtocol.query."""
188
+ resp_dict = await self._query(request, retry_count)
189
+ return resp_dict
190
+
191
+
192
+ class FakeIotTransport(BaseTransport):
193
+ def __init__(self, info, fixture_name=None):
194
+ super().__init__(config=DeviceConfig("127.0.0.123"))
187
195
  info = copy.deepcopy(info)
188
196
  self.discovery_data = info
197
+ self.fixture_name = fixture_name
189
198
  self.writer = None
190
199
  self.reader = None
191
- proto = copy.deepcopy(FakeIotProtocol.baseproto)
200
+ proto = copy.deepcopy(FakeIotTransport.baseproto)
192
201
 
193
202
  for target in info:
194
203
  # print("target %s" % target)
@@ -220,6 +229,14 @@ class FakeIotProtocol(IotProtocol):
220
229
 
221
230
  self.proto = proto
222
231
 
232
+ @property
233
+ def default_port(self) -> int:
234
+ return 9999
235
+
236
+ @property
237
+ def credentials_hash(self) -> str:
238
+ return ""
239
+
223
240
  def set_alias(self, x, child_ids=None):
224
241
  if child_ids is None:
225
242
  child_ids = []
@@ -300,6 +317,12 @@ class FakeIotProtocol(IotProtocol):
300
317
  _LOGGER.debug("New light state: %s", new_state)
301
318
  self.proto["system"]["get_sysinfo"]["light_state"] = new_state
302
319
 
320
+ # Setting the light state on a device will turn off any active lighting effects.
321
+ if lighting_effect_state := self.proto["system"]["get_sysinfo"].get(
322
+ "lighting_effect_state"
323
+ ):
324
+ lighting_effect_state["enable"] = 0
325
+
303
326
  def set_preferred_state(self, new_state, *args):
304
327
  """Implement set_preferred_state."""
305
328
  self.proto["system"]["get_sysinfo"]["preferred_state"][new_state["index"]] = (
@@ -367,7 +390,7 @@ class FakeIotProtocol(IotProtocol):
367
390
  "smartlife.iot.common.cloud": CLOUD_MODULE,
368
391
  }
369
392
 
370
- async def query(self, request, port=9999):
393
+ async def send(self, request, port=9999):
371
394
  proto = self.proto
372
395
 
373
396
  # collect child ids from context
@@ -414,3 +437,9 @@ class FakeIotProtocol(IotProtocol):
414
437
  response.update(get_response_for_module(target))
415
438
 
416
439
  return copy.deepcopy(response)
440
+
441
+ async def close(self) -> None:
442
+ pass
443
+
444
+ async def reset(self) -> None:
445
+ pass
@@ -11,7 +11,7 @@
11
11
  "system": {
12
12
  "get_sysinfo": {
13
13
  "active_mode": "schedule",
14
- "alias": "Kitchen",
14
+ "alias": "Bedroom Lamp Plug",
15
15
  "dev_name": "Wi-Fi Smart Plug With Energy Monitoring",
16
16
  "deviceId": "0000000000000000000000000000000000000000",
17
17
  "err_code": 0,
@@ -0,0 +1,37 @@
1
+ {
2
+ "emeter": {
3
+ "get_realtime": {
4
+ "current": 0.128037,
5
+ "err_code": 0,
6
+ "power": 7.677094,
7
+ "total": 30.404,
8
+ "voltage": 118.917389
9
+ }
10
+ },
11
+ "system": {
12
+ "get_sysinfo": {
13
+ "active_mode": "schedule",
14
+ "alias": "Home Google WiFi HS110",
15
+ "dev_name": "Wi-Fi Smart Plug With Energy Monitoring",
16
+ "deviceId": "0000000000000000000000000000000000000000",
17
+ "err_code": 0,
18
+ "feature": "TIM:ENE",
19
+ "fwId": "00000000000000000000000000000000",
20
+ "hwId": "00000000000000000000000000000000",
21
+ "hw_ver": "1.0",
22
+ "icon_hash": "",
23
+ "latitude": 0,
24
+ "led_off": 0,
25
+ "longitude": 0,
26
+ "mac": "00:00:00:00:00:00",
27
+ "model": "HS110(US)",
28
+ "oemId": "00000000000000000000000000000000",
29
+ "on_time": 14048150,
30
+ "relay_state": 1,
31
+ "rssi": -38,
32
+ "sw_ver": "1.2.6 Build 200727 Rel.121701",
33
+ "type": "IOT.SMARTPLUGSWITCH",
34
+ "updating": 0
35
+ }
36
+ }
37
+ }
@@ -28,7 +28,7 @@
28
28
  "system": {
29
29
  "get_sysinfo": {
30
30
  "active_mode": "none",
31
- "alias": "Living room left dimmer",
31
+ "alias": "Living Room Dimmer Switch",
32
32
  "brightness": 25,
33
33
  "dev_name": "Smart Wi-Fi Dimmer",
34
34
  "deviceId": "000000000000000000000000000000000000000",
@@ -17,7 +17,7 @@
17
17
  "system": {
18
18
  "get_sysinfo": {
19
19
  "active_mode": "none",
20
- "alias": "Living Room Lights",
20
+ "alias": "Living Room Dimmer Switch",
21
21
  "brightness": 100,
22
22
  "dev_name": "Wi-Fi Smart Dimmer",
23
23
  "deviceId": "0000000000000000000000000000000000000000",
@@ -0,0 +1,89 @@
1
+ {
2
+ "emeter": {
3
+ "get_realtime": {
4
+ "current_ma": 544,
5
+ "err_code": 0,
6
+ "power_mw": 62430,
7
+ "total_wh": 26889,
8
+ "voltage_mv": 118389
9
+ }
10
+ },
11
+ "system": {
12
+ "get_sysinfo": {
13
+ "alias": "TP-LINK_Power Strip_2CA9",
14
+ "child_num": 6,
15
+ "children": [
16
+ {
17
+ "alias": "Home CameraPC",
18
+ "id": "800623145DFF1AA096363EFD161C2E661A9D8DED00",
19
+ "next_action": {
20
+ "type": -1
21
+ },
22
+ "on_time": 1449897,
23
+ "state": 1
24
+ },
25
+ {
26
+ "alias": "Home Firewalla",
27
+ "id": "800623145DFF1AA096363EFD161C2E661A9D8DED01",
28
+ "next_action": {
29
+ "type": -1
30
+ },
31
+ "on_time": 1449897,
32
+ "state": 1
33
+ },
34
+ {
35
+ "alias": "Home Cox modem",
36
+ "id": "800623145DFF1AA096363EFD161C2E661A9D8DED02",
37
+ "next_action": {
38
+ "type": -1
39
+ },
40
+ "on_time": 1449897,
41
+ "state": 1
42
+ },
43
+ {
44
+ "alias": "Home rpi3-2",
45
+ "id": "800623145DFF1AA096363EFD161C2E661A9D8DED03",
46
+ "next_action": {
47
+ "type": -1
48
+ },
49
+ "on_time": 1449897,
50
+ "state": 1
51
+ },
52
+ {
53
+ "alias": "Home Camera Switch",
54
+ "id": "800623145DFF1AA096363EFD161C2E661A9D8DED05",
55
+ "next_action": {
56
+ "type": -1
57
+ },
58
+ "on_time": 1449897,
59
+ "state": 1
60
+ },
61
+ {
62
+ "alias": "Home Network Switch",
63
+ "id": "800623145DFF1AA096363EFD161C2E661A9D8DED04",
64
+ "next_action": {
65
+ "type": -1
66
+ },
67
+ "on_time": 1449897,
68
+ "state": 1
69
+ }
70
+ ],
71
+ "deviceId": "0000000000000000000000000000000000000000",
72
+ "err_code": 0,
73
+ "feature": "TIM:ENE",
74
+ "hwId": "00000000000000000000000000000000",
75
+ "hw_ver": "1.0",
76
+ "latitude_i": 0,
77
+ "led_off": 0,
78
+ "longitude_i": 0,
79
+ "mac": "00:00:00:00:00:00",
80
+ "mic_type": "IOT.SMARTPLUGSWITCH",
81
+ "model": "HS300(US)",
82
+ "oemId": "00000000000000000000000000000000",
83
+ "rssi": -39,
84
+ "status": "new",
85
+ "sw_ver": "1.0.21 Build 210524 Rel.161309",
86
+ "updating": 0
87
+ }
88
+ }
89
+ }