pyhive-integration 1.0.8.dev5__tar.gz → 1.0.8.dev7__tar.gz

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 (40) hide show
  1. {pyhive_integration-1.0.8.dev5/pyhive_integration.egg-info → pyhive_integration-1.0.8.dev7}/PKG-INFO +1 -1
  2. {pyhive_integration-1.0.8.dev5 → pyhive_integration-1.0.8.dev7/pyhive_integration.egg-info}/PKG-INFO +1 -1
  3. {pyhive_integration-1.0.8.dev5 → pyhive_integration-1.0.8.dev7}/setup.py +1 -1
  4. {pyhive_integration-1.0.8.dev5 → pyhive_integration-1.0.8.dev7}/src/alarm.py +1 -0
  5. {pyhive_integration-1.0.8.dev5 → pyhive_integration-1.0.8.dev7}/src/api/hive_api.py +1 -1
  6. {pyhive_integration-1.0.8.dev5 → pyhive_integration-1.0.8.dev7}/src/api/hive_async_api.py +2 -2
  7. {pyhive_integration-1.0.8.dev5 → pyhive_integration-1.0.8.dev7}/src/camera.py +1 -0
  8. {pyhive_integration-1.0.8.dev5 → pyhive_integration-1.0.8.dev7}/src/heating.py +29 -9
  9. {pyhive_integration-1.0.8.dev5 → pyhive_integration-1.0.8.dev7}/src/hotwater.py +1 -0
  10. {pyhive_integration-1.0.8.dev5 → pyhive_integration-1.0.8.dev7}/src/light.py +1 -0
  11. {pyhive_integration-1.0.8.dev5 → pyhive_integration-1.0.8.dev7}/src/plug.py +1 -0
  12. {pyhive_integration-1.0.8.dev5 → pyhive_integration-1.0.8.dev7}/src/sensor.py +1 -0
  13. {pyhive_integration-1.0.8.dev5 → pyhive_integration-1.0.8.dev7}/src/session.py +1 -1
  14. {pyhive_integration-1.0.8.dev5 → pyhive_integration-1.0.8.dev7}/LICENSE +0 -0
  15. {pyhive_integration-1.0.8.dev5 → pyhive_integration-1.0.8.dev7}/MANIFEST.in +0 -0
  16. {pyhive_integration-1.0.8.dev5 → pyhive_integration-1.0.8.dev7}/README.md +0 -0
  17. {pyhive_integration-1.0.8.dev5 → pyhive_integration-1.0.8.dev7}/pyhive_integration.egg-info/SOURCES.txt +0 -0
  18. {pyhive_integration-1.0.8.dev5 → pyhive_integration-1.0.8.dev7}/pyhive_integration.egg-info/dependency_links.txt +0 -0
  19. {pyhive_integration-1.0.8.dev5 → pyhive_integration-1.0.8.dev7}/pyhive_integration.egg-info/requires.txt +0 -0
  20. {pyhive_integration-1.0.8.dev5 → pyhive_integration-1.0.8.dev7}/pyhive_integration.egg-info/top_level.txt +0 -0
  21. {pyhive_integration-1.0.8.dev5 → pyhive_integration-1.0.8.dev7}/pyproject.toml +0 -0
  22. {pyhive_integration-1.0.8.dev5 → pyhive_integration-1.0.8.dev7}/requirements.txt +0 -0
  23. {pyhive_integration-1.0.8.dev5 → pyhive_integration-1.0.8.dev7}/requirements_test.txt +0 -0
  24. {pyhive_integration-1.0.8.dev5 → pyhive_integration-1.0.8.dev7}/setup.cfg +0 -0
  25. {pyhive_integration-1.0.8.dev5 → pyhive_integration-1.0.8.dev7}/src/__init__.py +0 -0
  26. {pyhive_integration-1.0.8.dev5 → pyhive_integration-1.0.8.dev7}/src/action.py +0 -0
  27. {pyhive_integration-1.0.8.dev5 → pyhive_integration-1.0.8.dev7}/src/api/__init__.py +0 -0
  28. {pyhive_integration-1.0.8.dev5 → pyhive_integration-1.0.8.dev7}/src/api/hive_auth.py +0 -0
  29. {pyhive_integration-1.0.8.dev5 → pyhive_integration-1.0.8.dev7}/src/api/hive_auth_async.py +0 -0
  30. {pyhive_integration-1.0.8.dev5 → pyhive_integration-1.0.8.dev7}/src/device_attributes.py +0 -0
  31. {pyhive_integration-1.0.8.dev5 → pyhive_integration-1.0.8.dev7}/src/helper/__init__.py +0 -0
  32. {pyhive_integration-1.0.8.dev5 → pyhive_integration-1.0.8.dev7}/src/helper/const.py +0 -0
  33. {pyhive_integration-1.0.8.dev5 → pyhive_integration-1.0.8.dev7}/src/helper/debugger.py +0 -0
  34. {pyhive_integration-1.0.8.dev5 → pyhive_integration-1.0.8.dev7}/src/helper/hive_exceptions.py +0 -0
  35. {pyhive_integration-1.0.8.dev5 → pyhive_integration-1.0.8.dev7}/src/helper/hive_helper.py +0 -0
  36. {pyhive_integration-1.0.8.dev5 → pyhive_integration-1.0.8.dev7}/src/helper/hivedataclasses.py +0 -0
  37. {pyhive_integration-1.0.8.dev5 → pyhive_integration-1.0.8.dev7}/src/helper/map.py +0 -0
  38. {pyhive_integration-1.0.8.dev5 → pyhive_integration-1.0.8.dev7}/src/hive.py +0 -0
  39. {pyhive_integration-1.0.8.dev5 → pyhive_integration-1.0.8.dev7}/src/hub.py +0 -0
  40. {pyhive_integration-1.0.8.dev5 → pyhive_integration-1.0.8.dev7}/tests/test_hub.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: pyhive-integration
3
- Version: 1.0.8.dev5
3
+ Version: 1.0.8.dev7
4
4
  Summary: A Python library to interface with the Hive API
5
5
  Home-page: https://github.com/Pyhive/pyhiveapi
6
6
  Author: KJonline24
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: pyhive-integration
3
- Version: 1.0.8.dev5
3
+ Version: 1.0.8.dev7
4
4
  Summary: A Python library to interface with the Hive API
5
5
  Home-page: https://github.com/Pyhive/pyhiveapi
6
6
  Author: KJonline24
@@ -17,7 +17,7 @@ def requirements_from_file(filename="requirements.txt"):
17
17
 
18
18
 
19
19
  setup(
20
- version="1.0.8.dev5",
20
+ version="1.0.8.dev7",
21
21
  packages=["apyhiveapi", "apyhiveapi.api", "apyhiveapi.helper"],
22
22
  package_dir={"apyhiveapi": "src"},
23
23
  package_data={"data": ["*.json"]},
@@ -131,4 +131,5 @@ class Alarm(HiveHomeShield):
131
131
  await self.session.helper.errorCheck(
132
132
  device["device_id"], "ERROR", device["deviceData"]["online"]
133
133
  )
134
+ device.setdefault("status", {"state": None, "mode": None})
134
135
  return device
@@ -33,7 +33,7 @@ class HiveApi:
33
33
  "actions": "/actions",
34
34
  "nodes": "/nodes/{0}/{1}",
35
35
  }
36
- self.timeout = 10
36
+ self.timeout = 5
37
37
  self.json_return = {
38
38
  "original": "No response to Hive API request",
39
39
  "parsed": "No response to Hive API request",
@@ -43,7 +43,7 @@ class HiveApiAsync:
43
43
  "long_lived": "https://api.prod.bgchprod.info/omnia/accessTokens",
44
44
  "weather": "https://weather.prod.bgchprod.info/weather",
45
45
  }
46
- self.timeout = 10
46
+ self.timeout = 5
47
47
  self.json_return = {
48
48
  "original": "No response to Hive API request",
49
49
  "parsed": "No response to Hive API request",
@@ -84,7 +84,7 @@ class HiveApiAsync:
84
84
  auth_token[-4:] if len(auth_token) >= 4 else auth_token,
85
85
  )
86
86
 
87
- timeout = ClientTimeout(total=10)
87
+ timeout = ClientTimeout(total=self.timeout)
88
88
  req_start = time.monotonic()
89
89
  async with self.websession.request(
90
90
  method, url, headers=headers, data=data, timeout=timeout
@@ -189,4 +189,5 @@ class Camera(HiveCamera):
189
189
  await self.session.helper.errorCheck(
190
190
  device["device_id"], "ERROR", device["deviceData"]["online"]
191
191
  )
192
+ device.setdefault("status", {"state": None})
192
193
  return device
@@ -54,7 +54,6 @@ class HiveHeating:
54
54
  """
55
55
  from datetime import datetime
56
56
 
57
- f_state = None
58
57
  state = None
59
58
  final = None
60
59
 
@@ -62,6 +61,16 @@ class HiveHeating:
62
61
  data = self.session.data.products[device["hiveID"]]
63
62
  state = data["props"]["temperature"]
64
63
 
64
+ try:
65
+ state = float(state)
66
+ except (ValueError, TypeError):
67
+ _LOGGER.debug(
68
+ "Non-numeric temperature value '%s' for %s.",
69
+ state,
70
+ device.get("haName", device.get("hiveID")),
71
+ )
72
+ return None
73
+
65
74
  if device["hiveID"] in self.session.data.minMax:
66
75
  if self.session.data.minMax[device["hiveID"]]["TodayDate"] == str(
67
76
  datetime.date(datetime.now())
@@ -94,8 +103,7 @@ class HiveHeating:
94
103
  }
95
104
  self.session.data.minMax[device["hiveID"]] = data
96
105
 
97
- f_state = round(float(state), 1)
98
- final = f_state
106
+ final = round(state, 1)
99
107
  except KeyError as e:
100
108
  _LOGGER.error(e)
101
109
 
@@ -159,12 +167,13 @@ class HiveHeating:
159
167
  try:
160
168
  current_temp = await self.getCurrentTemperature(device)
161
169
  target_temp = await self.getTargetTemperature(device)
162
- if current_temp < target_temp:
163
- state = "ON"
164
- else:
165
- state = "OFF"
166
- final = HIVETOHA[self.heatingType].get(state, state)
167
- except KeyError as e:
170
+ if current_temp is not None and target_temp is not None:
171
+ if current_temp < target_temp:
172
+ state = "ON"
173
+ else:
174
+ state = "OFF"
175
+ final = HIVETOHA[self.heatingType].get(state, state)
176
+ except (KeyError, TypeError) as e:
168
177
  _LOGGER.error(e)
169
178
 
170
179
  return final
@@ -503,6 +512,17 @@ class Climate(HiveHeating):
503
512
  device["haName"],
504
513
  )
505
514
  return cached
515
+ device.setdefault(
516
+ "status",
517
+ {
518
+ "current_temperature": None,
519
+ "target_temperature": None,
520
+ "action": None,
521
+ "mode": None,
522
+ "boost": None,
523
+ "state": None,
524
+ },
525
+ )
506
526
  return device
507
527
 
508
528
  async def getScheduleNowNextLater(self, device: dict):
@@ -271,6 +271,7 @@ class WaterHeater(HiveHotwater):
271
271
  device["haName"],
272
272
  )
273
273
  return cached
274
+ device.setdefault("status", {"current_operation": None})
274
275
  return device
275
276
 
276
277
  async def getScheduleNowNextLater(self, device: dict):
@@ -428,6 +428,7 @@ class Light(HiveLight):
428
428
  device["haName"],
429
429
  )
430
430
  return cached
431
+ device.setdefault("status", {"state": None})
431
432
  return device
432
433
 
433
434
  async def turnOn(self, device: dict, brightness: int, color_temp: int, color: list):
@@ -188,6 +188,7 @@ class Switch(HiveSmartPlug):
188
188
  device["haName"],
189
189
  )
190
190
  return cached
191
+ device.setdefault("status", {"state": None})
191
192
  return device
192
193
 
193
194
  async def getSwitchState(self, device: dict):
@@ -160,4 +160,5 @@ class Sensor(HiveSensor):
160
160
  device["haName"],
161
161
  )
162
162
  return cached
163
+ device.setdefault("status", {"state": None})
163
164
  return device
@@ -540,7 +540,7 @@ class HiveSession:
540
540
  except HiveAuthError as retry_err:
541
541
  raise HiveReauthRequired from retry_err
542
542
  api_call_duration = time.monotonic() - api_call_start
543
- if api_call_duration > 8:
543
+ if api_call_duration > 3:
544
544
  _LOGGER.warning(
545
545
  "Hive API response took %.1fs — marking poll as slow.",
546
546
  api_call_duration,