Misleading log error with Hilderbrand Glow integration

A few days ago the following error began appearing in my logs (every 20s). I found an issue which looks like this one in the integration repo, and proceeded to try and solve it by editing the script to not use the value I thought was causing the problem (“standingcharge”:null).

2026-07-28 13:34:40.786 ERROR (MainThread) [homeassistant.util.logging] Exception in mqtt_message_received when handling msg on 'glow/E0E2E62C5520/SENSOR/electricitymeter': '{"electricitymeter":{"timestamp":"2026-07-28T12:34:38Z","energy":{"export":{"cumulative":0.000,"units":"kWh"},"import":{"cumulative":287.815,"day":2.120,"week":7.224,"month":66.709,"units":"kWh","mpan":"1416336061005","supplier":"HomeEnergy","price":{"unitrate":0.23880,"standingcharge":null}}},"power":{"value":0.136,"units":"kW"}}}'
Traceback (most recent call last):
  File "/config/custom_components/hildebrand_glow_ihd/sensor.py", line 330, in mqtt_message_received
    updateGroup.process_update(message)
    ~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^
  File "/config/custom_components/hildebrand_glow_ihd/sensor.py", line 393, in process_update
    sensor.process_update(parsed_data)
    ~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/config/custom_components/hildebrand_glow_ihd/sensor.py", line 480, in process_update
    new_value = self._func(mqtt_data)
  File "/config/custom_components/hildebrand_glow_ihd/sensor.py", line 175, in <lambda>
    js["electricitymeter"]["energy"]["import"]["price"]["standingcharge"]
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + (
    ^~~
        js["electricitymeter"]["energy"]["import"]["day"]
        ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
        * js["electricitymeter"]["energy"]["import"]["price"]["unitrate"]
        ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    ),
    ~
TypeError: unsupported operand type(s) for +: 'NoneType' and 'float'
 Live

Each time I tried an edit, the same error repeats but the output reflects the change I made. The error is always reported on line 175, even when I entirely remove the code block around line 175:

So removing the following block from ELECTRICITY_SENSORS = [ ... ] generates the same error, but refers to entirely different code inside GAS_SENSORS = [ ... ]:

    {
        "name": "Smart Meter Electricity: Cost (Today)",
        "device_class": SensorDeviceClass.MONETARY,
        "unit_of_measurement": "GBP",
        "state_class": SensorStateClass.TOTAL,
        "icon": "mdi:cash",
        "meter_interval": MeterInterval.DAY,
        "func": lambda js: round(
            js["electricitymeter"]["energy"]["import"]["price"]["standingcharge"]
            + (
                js["electricitymeter"]["energy"]["import"]["day"]
                * js["electricitymeter"]["energy"]["import"]["price"]["unitrate"]
            ),
            2,
        ),
    },

Why?! Each time I reload scripts and the log content reflects the changes (ie the content of line 175), but nothing I can do prevents the error even removing the code entirely.

I guess I’m trying to fix the wrong thing, so the error in the log seems to be being reported incorrectly.

Can someone take a look at this please. :folded_hands: