pyhOn/pyhon
Dan Davies 728a891e6c Fix KeyError in MQTT publish handler dropping whole status update
_on_publish_received() indexes appliance.attributes["parameters"]
directly by parName when applying an incoming appliancestatus push:

    appliance.attributes["parameters"][parameter["parName"]].update(parameter)

If the payload contains a parName that hasn't been seen/initialized
locally yet, this raises KeyError before self._hon.notify() is
reached, so the entire push message (not just that one parameter) is
silently dropped for that appliance.

In practice this reproduced reliably on a Haier washing machine
(HW90-B14959U1-UK) at end-of-cycle, where the push includes a
"programStats" parameter:

    Exception ignored in: <class 'KeyError'>
    Traceback (most recent call last):
      File ".../awscrt/mqtt5.py", line 1540, in _on_publish
        self._on_publish_cb(publish_data)
      File ".../pyhon/connection/mqtt.py", line 109, in _on_publish_received
        appliance.attributes["parameters"][parameter["parName"]].update(
    KeyError: 'programStats'

Because the exception is swallowed by the underlying MQTT client as
"Exception ignored in", it fails silently with no log entry pointing
at the cause - the visible symptom is just that dependent entities
(e.g. door-open state bundled in the same push) never update.

Fix: use setdefault() instead of a raw index so an unseen parName
initializes its entry instead of raising.
2026-08-23 13:03:13 +01:00
..
appliances Handle mqtt connection events 2024-03-29 14:39:08 +01:00
connection Fix KeyError in MQTT publish handler dropping whole status update 2026-08-23 13:03:13 +01:00
parameter Fix missing program name Andre0512/hon#188 2024-03-29 13:51:35 +01:00
__init__.py Small fixes, Add checks 2023-04-10 06:45:56 +02:00
__main__.py Fix another issue with data path 2024-02-11 05:11:21 +01:00
appliance.py Handle mqtt connection events 2024-03-29 14:39:08 +01:00
attributes.py Add more type hints 2023-06-28 19:02:11 +02:00
command_loader.py Fix problems with refresh token 2024-02-11 05:11:21 +01:00
commands.py Fix crash in loading attributs Andre0512/hon#134 2024-01-11 01:21:38 +01:00
const.py Support cloud push with wss mqtt 2024-03-18 19:59:38 +01:00
diagnose.py Improvements 2023-07-01 14:31:37 +02:00
exceptions.py Fix command parameter issue hon#63 2023-06-09 02:09:20 +02:00
helper.py Add more type hints 2023-06-28 19:02:11 +02:00
hon.py Handle mqtt connection events 2024-03-29 14:39:08 +01:00
printer.py Enable more pylint checks 2023-07-16 05:53:23 +02:00
py.typed Improve type hints 2023-07-23 21:55:42 +02:00
rules.py Support new style rules hon#112 2023-10-02 01:38:40 +02:00
typedefs.py Update requirements 2024-02-11 05:11:21 +01:00