When multiple entities (e.g. a binary_sensor and a switch in Home Assistant) register a notify callback for the same resource ID via add_notify_event(), only the first-registered callback receives the value change. The second (and any subsequent) listener never gets called, because _ihcvalues[ihcid] is updated inside the inner loop over callbacks, causing the equality check value != self._ihcvalues[ihcid] to be False for every listener after the first one in the same notification cycle.
Relevant code in ihccontroller.py, _notify_fn():
for ihcid, value in changes:
if ihcid in self._ihcevents:
for callback in self._ihcevents[ihcid]:
if (
ihcid not in self._ihcvalues
or value != self._ihcvalues[ihcid]
):
callback(ihcid, value)
self._ihcvalues[ihcid] = value
Since self._ihcvalues[ihcid] = value is set inside the for callback loop, after the first callback executes, all later callbacks in the same loop see value == self._ihcvalues[ihcid] and are skipped.
Suggested fix: move self._ihcvalues[ihcid] = value outside the inner for callback loop, so the comparison happens once per resource change, not once per callback:
for ihcid, value in changes:
if ihcid in self._ihcevents:
if ihcid not in self._ihcvalues or value != self._ihcvalues[ihcid]:
for callback in self._ihcevents[ihcid]:
callback(ihcid, value)
self._ihcvalues[ihcid] = value
Reproduction:
- Define the same IHC resource ID both as a binary_sensor (autosetup) and as the status id for a switch (manual setup with on_id/off_id) in HA's IHC integration (haihc-betatest / version 2.0).
- Restart Home Assistant.
- Change the underlying IHC resource value (e.g. toggle an alarm panel physically).
- Observe: the binary_sensor (registered first) updates correctly. The switch (registered second) never updates and stays "unknown" forever, even though debug logs confirm both listeners are correctly registered via
add_notify_event().
Confirmed on:
- IHC Controller HW 6.1, Firmware 2.7.220
- Home Assistant 2026.x with haihc-betatest (IHC integration v2026.3.0)
When multiple entities (e.g. a binary_sensor and a switch in Home Assistant) register a notify callback for the same resource ID via
add_notify_event(), only the first-registered callback receives the value change. The second (and any subsequent) listener never gets called, because_ihcvalues[ihcid]is updated inside the inner loop over callbacks, causing the equality checkvalue != self._ihcvalues[ihcid]to beFalsefor every listener after the first one in the same notification cycle.Relevant code in
ihccontroller.py,_notify_fn():Since
self._ihcvalues[ihcid] = valueis set inside thefor callbackloop, after the first callback executes, all later callbacks in the same loop seevalue == self._ihcvalues[ihcid]and are skipped.Suggested fix: move
self._ihcvalues[ihcid] = valueoutside the innerfor callbackloop, so the comparison happens once per resource change, not once per callback:Reproduction:
add_notify_event().Confirmed on: