Skip to content

GoHeishaMon hang: heat-pump telemetry dead, climate optimizer blind

Incident 2026-11-26 to 2026-12-01, recovered 2026-12-01 ~07:38 UTC by a module reboot (owner approved). All times UTC unless noted. The heat-pump MQTT bridge (GoHeishaMon on the CZ-TAW1B module, cz-taw1b.iot.grigri) hung on its USB-serial read and published nothing for ~4 days: Home Assistant kept the last values (frozen, still "available") from 2026-11-26 ~08:30 and only showed them unknown after an HA restart at 2026-11-29 04:09. The climate optimizer planned on frozen heat-pump data for ~68 h, then lost its observer state and could not confirm a single heat-pump write for ~51 h. A telemetry-freshness alert was added afterwards (commit 6f5435827); it would have fired from 2026-11-26 ~08:25.

Not to be confused with office-iot-wifi-flapping: that is a dead ESP8285 radio on mini-switch-office-a (needs a serial reflash). This was a process hang on a healthy Wi-Fi link — different failure mode, do not merge them.

The device

  • There is no heishamon host in DNS or ~/.ssh/config. The bridge is the Panasonic CZ-TAW1B Wi-Fi module running GoHeishaMon (a Go binary) on OpenWrt: Linux cz-taw1b 3.14.0 ... mips. SSH as root with legacy algorithms (ssh-rsa host/pubkey, diffie-hellman-group1-sha1 kex) — the cz-taw1b.iot.grigri entry in ~/.ssh/config already sets them; a plain modern client fails the key exchange.
  • It reads the heat pump over /dev/ttyUSB0, a Prolific PL2303 USB-serial (067b:23a3) behind an Alcor hub (058f:6254), wired to the unit's CN-CNT connector. Config /etc/config/goheishamon.toml: ReadInterval=1, ForceRefreshTime=300, MqttServer=192.168.193.9:1883, topics panasonic_heat_pump/main (state) and panasonic_heat_pump/commands (set + LWT), HAAutoDiscover=true.
  • It is a procd service (/etc/init.d/goheishamon, with respawn), logging through logger -t goheishamon into the logd ring buffer (logd -S 16 = 16 KB).
  • Wi-Fi tomate_IoT, ~-70 dBm — healthy during the hang. The MQTT TCP connection showed ESTABLISHED even while the bridge was dead (a zombie/reconnect that never resumed publishing).

Problem

From 2026-11-26 ~08:30 UTC (last bridge output ~08:21-08:29) every sensor.aquarea_* in Home Assistant froze at its last value (hass_last_updated_time_seconds of sensor.aquarea_outside_ambient_temperature stays at 07:55, outlet temperature at 07:16, until the restart); MQTT sensors have no expire_after, so they stayed "available". At the HA restart of 2026-11-29 04:09 they came back unknown (no retained value). Between those times the optimizer read the frozen values as live data (outdoor stuck at 5 degC; heat inputs stuck at 0, which happened to be true with heating off). Downstream from 2026-11-29 04:09:

  • The climate observer lost state (no_state on every hourly run from 2026-11-29 05:10): it bridges up to 4 missing heat slots, then restarts and needs 96 unbroken slots (24 h) of heat readings before it plans again (app docs/components/climate-mpc.md).
  • The climate actuator could not confirm any write: its readback compares the unit's actual mode (sensor.aquarea_mode, the observed_mode entity), which was unknown. 1223 failed heat-mode writes, 0 confirmed, readback_timeout throughout.
  • The owner was on vacation (Leave 2026-11-25 00:00, Return 2026-12-02 22:00 local). The vacation hold did not apply: ADR-0010 keeps the normal fallback when the mode sensor is unavailable (the guard cannot be proven), so from 04:09 the actuator tried the safe state (Heat+DHW, 26 degC) on every tick (actuation records: reason=no_plan, result=failed). None landed because the bridge was hung; the unit stayed in its last mode (DHW). The house coasted to ~19.3 degC; the 12 degC guard never bound. After the reboot the safe state landed (07:39) and heated for 24.5 h until the observer had rebuilt its 24 h of data (first plan 2026-12-02 08:10).

The alerts the owner actually saw were the unrelated pipeline failures (BatteryOptimizerJobFailed, KubeJobFailed, ArgoCD battery-optimizer Degraded): the 2026-11-30 run hit an HA 404 (HA was down) and the 2026-12-01 monthly build refused for missing battery counters (fixed separately, homelab commit 1af945076).

Root Cause

GoHeishaMon blocked on the PL2303 serial read and stopped its publish loop. Evidence at diagnosis (2026-12-01 ~07:15 UTC, before the reboot):

  • Process alive (state S) but ~0 % CPU: /proc/<pid>/stat utime did not advance over 10 s despite ReadInterval=1; every thread in futex_wait_queue_me / SyS_epoll_wait.
  • MQTT broker retained panasonic_heat_pump/commands/LWT Offline and panasonic_heat_pump/main/Status offline; a 10 s subscribe to panasonic_heat_pump/# got only those retained lines, no live data.
  • /dev/ttyUSB0 present, driver pl2303 bound, fd open in the process — but reads returned nothing (the adapter or the unit side of the CN-CNT link was wedged). PL2303 adapters are notorious for this.

The trigger is not provable after the fact: the 16 KB logd ring was flooded by the 5-minute USB config-update loop (update-config ... sda1 not found, three lines every 5 min), so logread only reached back ~3 h and the start of the hang was gone. The hang started around 2026-11-26 ~08:30 UTC (last sensor update), not during the nightly DHW window (~03:00-05:00); 2026-11-29 04:09 is only the HA restart that turned the frozen values into unknown.

Fix / Recovery

Applied 2026-12-01 ~07:38 UTC (owner chose a reboot over a service restart):

ssh cz-taw1b.iot.grigri reboot

A reboot resets the USB bus, the PL2303 and the process. The lighter /etc/init.d/goheishamon restart is the first thing to try, but a wedged PL2303 may survive a process restart (it re-blocks on the same dead read), so go straight to reboot if a restart does not bring telemetry back within a minute. If a reboot does not recover it, the fault is the CN-CNT cable or the unit side and needs physical access.

Verified recovery (all within ~1-2 min):

  • logread | grep goheishamon shows received TOP.. / It publishes to ... again; utime advances.
  • MQTT panasonic_heat_pump/main/Status publishes online live.
  • HA sensor.aquarea_mode = Heat+DHW (fresh), binary_sensor.aquarea_status = on.
  • Climate actuator's first confirmed write at 07:39:05 (result=ok); the safe_state_failed alert cleared. Compressor fired (68 Hz), outlet water rose, the hall began warming.

After telemetry returns the observer still needs ~24 h of unbroken readings before the first plan, so the optimal warm-up resume is ~1 day later; until then the confirmed safe state (Heat+DHW, 26 degC) heats the house. Near a vacation return that is the designed "extra kWh, never a cold return" fallback.

Detection gap and the new alert

What fired and what did not:

  • Nothing fired for the first ~68 h (2026-11-26 ~08:30 to 2026-11-29 04:09): the values were frozen but "available", and no rule checked their age.
  • From 2026-11-29 05:15 Prometheus (ALERTS, long-term) records BatteryOptimizerClimateActuatorAlert (critical, safe_state_failed), BatteryOptimizerClimateWriteFailures, BatteryOptimizerClimateNotDirectMode (~51 h each), BatteryOptimizerClimateHeartbeatStale (critical, ~25 h twice) and BatteryOptimizerClimateShadowNoState (~71 h) as firing. No Alertmanager silence matched them; whether they reached Telegram was not verified (the owner remembers only the pipeline alerts below). An earlier version of this page said the vacation hold kept the actuator quiet: wrong, see Problem.
  • These alerts name the symptom in the optimizer, not the dead bridge; a heat-pump telemetry alert is the direct signal.
  • An HA restart re-stamps every entity's last_updated (2026-11-30 05:34 here), temporarily masking staleness, and restores MQTT sensors without a retained value as unknown.

Added BatteryOptimizerHeatPumpTelemetryStale (rules-service/climate-actuator.yaml, commit 6f5435827, power topics added 2026-12-03): fire when even the freshest of several bridge sensors (aquarea_outlet_temperature, aquarea_inlet_temperature, aquarea_pump_flow, aquarea_outside_ambient_temperature, aquarea_heat_power_consumed, aquarea_heat_power_produced, aquarea_dhw_power_consumed) is older than 30 min, and the shelly grid meter (sensor.shellyem_main_channel_1_power, a reliably-fresh HA feed) is younger than 5 min. The shelly clause isolates a heat-pump-bridge fault from a whole-HA outage (which has its own alerts). It reads hass_* from the long-term Prometheus, so it fires even when the optimizer service is down. HA stamps last_updated only when a value changes, so the first version (the four water-circuit sensors alone) would have false-fired on idle periods: over 2026-10-01 to 11-26 their freshest was older than 30 min in 758 five-minute samples (up to 2.4 h). The power topics update about every 5 min even at 0 W; with them the freshest never passed 12.2 min while healthy, and the rule fires from 2026-11-26 ~09:00 (last bridge output ~08:21-08:29, the outdoor sensor's last change 07:55). The optimizer's own freshness check (climate_shadow.heat_pump_telemetry, optimizer >= 0.22) uses the same seven entities.

How to Diagnose

Read-only, from the workstation unless noted.

  1. HA / Prometheus freshness (long-term Prometheus, hass_*):
    min(time() - hass_last_updated_time_seconds{entity=~"sensor.aquarea_outlet_temperature|sensor.aquarea_inlet_temperature|sensor.aquarea_pump_flow|sensor.aquarea_outside_ambient_temperature"})
    hass_last_updated_time_seconds{entity="sensor.aquarea_mode"}
    
    A growing min-age with a fresh shelly meter = dead bridge. sensor.aquarea_mode unknown after an HA restart is the same fault (no retained MQTT value).
  2. MQTT (subscribe from the mosquitto pod; credentials from the device config, do not log them):
    MQPASS=$(ssh cz-taw1b.iot.grigri "sed -n 's/^MqttPass=\"\(.*\)\"/\1/p' /etc/config/goheishamon.toml")
    kubectl --context grigri -n mosquitto exec mosquitto-0 -c mosquitto -- \
      mosquitto_sub -h 127.0.0.1 -u <MqttLogin> -P "$MQPASS" -t 'panasonic_heat_pump/#' -W 8 -v
    
    Retained LWT Offline / Status offline with no live lines = hung bridge. (The MQTT user is MqttLogin in the same toml; the broker requires auth.)
  3. On the device over SSH (read-only):
    ssh cz-taw1b.iot.grigri
    ps w | grep goheishamon                 # find the pid
    awk '{print $14}' /proc/<pid>/stat; sleep 5; awk '{print $14}' /proc/<pid>/stat
                                            # utime must advance (ReadInterval=1); frozen = hung
    logread | grep goheishamon | tail       # 'received TOP..' = reading; only update-config = idle/hung
    netstat -tn | grep 1883                 # MQTT TCP state (ESTABLISHED can be a zombie)
    ls -la /dev/ttyUSB*; cat /sys/class/tty/ttyUSB0/device/uevent   # pl2303 present?
    
  4. Optimizer side: kubectl --context grigri -n battery-optimizer logs deploy/battery-optimizer-service for climate actuator write failed: heat_mode ... readback_timeout and climate shadow run ... status=no_state; /status and /climate/plan/summary on the service.

Pitfalls / Dead Ends

  • Do not trust ESTABLISHED MQTT TCP or a running process. The bridge was hung with both looking normal. The decisive signals are CPU time not advancing and no live MQTT payload.
  • sensor.aquarea_mode last_updated is not a freshness signal on its own: a steady mode keeps an old timestamp while healthy, and an HA restart re-stamps it. Use the water-circuit sensors (they refresh every ~2 min) and the min-over-several approach.
  • The 16 KB log ring loses the event: the USB config-update noise fills it in ~3 h. Copy logread early, or raise logd -S / quiet the update loop, if you need the trigger after the fact.
  • A process restart may not clear a wedged PL2303; reboot the module to reset the USB bus.
  • Do not merge this with the office IoT Wi-Fi flapping — that is a dead radio needing a reflash; this was a process hang on a healthy link.
  • The climate no_state during a vacation is expected while heating is off; it is not itself the fault. The fault is the dead telemetry that prevents the observer from ever rebuilding.

References

  • App repo: docs/adr/0010-vacation-mode.md (vacation hold, ready_at − 48 h), docs/components/climate-mpc.md (observer 4-slot bridge / 24 h warm-up), docs/service.md#live-climate-control-adr-0009 (readback, safe state, watchdog).
  • Homelab: deployment/battery-optimizer.md (live climate control, watchdog, alerts), mqtt.md, office-iot-wifi-flapping.md (the unrelated dead-radio issue).