lghorizon 0.7.3b2__py3-none-any.whl → 0.7.3b4__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.
@@ -277,7 +277,14 @@ class LGHorizonApi:
277
277
  box.register_mqtt()
278
278
 
279
279
  def _on_mqtt_message(self, message: str, topic: str) -> None:
280
- if "source" in message:
280
+ if "action" in message and message["action"] == "OPS.getProfilesUpdate":
281
+ self._update_customer()
282
+ self._channels.clear()
283
+ self._get_channels()
284
+ box: LGHorizonBox
285
+ for box in self.settop_boxes.values():
286
+ box.update_channels(self._channels)
287
+ elif "source" in message:
281
288
  deviceId = message["source"]
282
289
  if not isinstance(deviceId, str):
283
290
  _logger.debug("ignoring message - not a string")
@@ -289,6 +296,7 @@ class LGHorizonApi:
289
296
  self.settop_boxes[deviceId].update_state(message)
290
297
  if "status" in message:
291
298
  self._handle_box_update(deviceId, message)
299
+
292
300
  except Exception:
293
301
  _logger.exception("Could not handle status message")
294
302
  _logger.warning(f"Full message: {str(message)}")
@@ -388,14 +396,9 @@ class LGHorizonApi:
388
396
  return json_response
389
397
 
390
398
  def _register_customer_and_boxes(self):
391
- _logger.info("Get personalisation info...")
392
- personalisation_result = self._do_api_call(
393
- f"{self._config['personalizationService']['URL']}/v1/customer/{self._auth.householdId}?with=profiles%2Cdevices"
394
- )
395
- _logger.debug("Personalisation result: %s ", personalisation_result)
396
- self.customer = LGHorizonCustomer(personalisation_result)
399
+ self._update_customer()
397
400
  self._get_channels()
398
- if "assignedDevices" not in personalisation_result:
401
+ if len(self.customer.settop_boxes) == 0:
399
402
  _logger.warning("No boxes found.")
400
403
  return
401
404
  _logger.info("Registering boxes")
@@ -416,6 +419,14 @@ class LGHorizonApi:
416
419
  self.settop_boxes[box.deviceId] = box
417
420
  _logger.info("Box %s registered...", box.deviceId)
418
421
 
422
+ def _update_customer(self):
423
+ _logger.info("Get customer data")
424
+ personalisation_result = self._do_api_call(
425
+ f"{self._config['personalizationService']['URL']}/v1/customer/{self._auth.householdId}?with=profiles%2Cdevices"
426
+ )
427
+ _logger.debug("Personalisation result: %s ", personalisation_result)
428
+ self.customer = LGHorizonCustomer(personalisation_result)
429
+
419
430
  def _get_channels(self):
420
431
  self._update_entitlements()
421
432
  _logger.info("Retrieving channels...")
lghorizon/models.py CHANGED
@@ -438,6 +438,9 @@ class LGHorizonBox:
438
438
  self.manufacturer = platform_type["manufacturer"]
439
439
  self.model = platform_type["model"]
440
440
 
441
+ def update_channels(self, channels: Dict[str, LGHorizonChannel]):
442
+ self._channels = channels
443
+
441
444
  def register_mqtt(self) -> None:
442
445
  if not self._mqtt_client.is_connected:
443
446
  raise Exception("MQTT client not connected.")
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: lghorizon
3
- Version: 0.7.3b2
3
+ Version: 0.7.3b4
4
4
  Summary: Python client for Liberty Global Horizon settop boxes
5
5
  Home-page: https://github.com/sholofly/LGHorizon-python
6
6
  Author: Rudolf Offereins
@@ -0,0 +1,12 @@
1
+ lghorizon/__init__.py,sha256=XqePG0hj8NnudOcfCtEWqPsWP5l2headzrQhkfuDlv8,544
2
+ lghorizon/const.py,sha256=S8UWatG7JPCqd1zk-iOoILTvFDEj7YhLcEXxLGhyJXs,4755
3
+ lghorizon/exceptions.py,sha256=-6v55KDTogBldGAg1wV9Mrxm5L5BsaVguhBgVMOeJHk,404
4
+ lghorizon/helpers.py,sha256=ZWpi7B3hBvwGV02KWQQHVyj7FLLUDtIvKc-Iqsj5VHA,263
5
+ lghorizon/lghorizon_api.py,sha256=PcC-zmy_VK5WgUQChnwySE9CE5LPP1E3HXA_Pp_ExMg,21956
6
+ lghorizon/models.py,sha256=S_Pq8z9PpaN10b17aoi2j-mCIdZf-TK411pBGRPDkvc,24542
7
+ lghorizon/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
8
+ lghorizon-0.7.3b4.dist-info/LICENSE,sha256=6Dh2tur1gMX3r3rITjVwUONBEJxyyPZDY8p6DZXtimE,1059
9
+ lghorizon-0.7.3b4.dist-info/METADATA,sha256=HKyX_ZJFeWEnMOLdaL4MvHaU8_7Xo9t7UE-tnLqZV3A,1039
10
+ lghorizon-0.7.3b4.dist-info/WHEEL,sha256=OVMc5UfuAQiSplgO0_WdW7vXVGAt9Hdd6qtN4HotdyA,91
11
+ lghorizon-0.7.3b4.dist-info/top_level.txt,sha256=usii76_AxGfPI6gjrrh-NyZxcQQuF1B8_Q9kd7sID8Q,10
12
+ lghorizon-0.7.3b4.dist-info/RECORD,,
@@ -1,12 +0,0 @@
1
- lghorizon/__init__.py,sha256=XqePG0hj8NnudOcfCtEWqPsWP5l2headzrQhkfuDlv8,544
2
- lghorizon/const.py,sha256=S8UWatG7JPCqd1zk-iOoILTvFDEj7YhLcEXxLGhyJXs,4755
3
- lghorizon/exceptions.py,sha256=-6v55KDTogBldGAg1wV9Mrxm5L5BsaVguhBgVMOeJHk,404
4
- lghorizon/helpers.py,sha256=ZWpi7B3hBvwGV02KWQQHVyj7FLLUDtIvKc-Iqsj5VHA,263
5
- lghorizon/lghorizon_api.py,sha256=mLXu_A4rByx2Xu8vbVq3MnN5gXYe3W0NoGJVMFNy7Yo,21591
6
- lghorizon/models.py,sha256=lUKUJiebK65l0lfOwAzDvn0fC6UIvvQS6HI6a0ROZ_8,24437
7
- lghorizon/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
8
- lghorizon-0.7.3b2.dist-info/LICENSE,sha256=6Dh2tur1gMX3r3rITjVwUONBEJxyyPZDY8p6DZXtimE,1059
9
- lghorizon-0.7.3b2.dist-info/METADATA,sha256=dC0Fxghges-tPQRX0NkcWYM2mcV7kaYpc3qK-rqxwYc,1039
10
- lghorizon-0.7.3b2.dist-info/WHEEL,sha256=OVMc5UfuAQiSplgO0_WdW7vXVGAt9Hdd6qtN4HotdyA,91
11
- lghorizon-0.7.3b2.dist-info/top_level.txt,sha256=usii76_AxGfPI6gjrrh-NyZxcQQuF1B8_Q9kd7sID8Q,10
12
- lghorizon-0.7.3b2.dist-info/RECORD,,