Skip to content

_map_power silently coerces power.value: None to 0, masking missing telemetry as a real zero reading #451

Description

@njloof

Describe the bug

When Hilo's SignalR onAnyDeviceUpdated subscription reports a device's power attribute
as {"value": null, "kind": "WATT"} (i.e. Hilo itself has no current power reading for the
device), GraphqlValueMapper._map_power converts that None into 0 before it ever becomes
a DeviceReading:

def _map_power(self, device: Dict[str, Any]) -> Dict[str, Any]:
    value = device["power"]["value"] if device["power"]["value"] is not None else 0
    return self.build_attribute(
        device["hiloId"],
        "Power",
        self._power_kw_to_w(value, device["power"]["kind"]),
    )

By the time this reaches the hilo HA integration's PowerSensor.state
(str(int(self._device.get_value("power", 0)))), the distinction between "Hilo has no power
data for this device right now" and "Hilo confirms this device is drawing 0W" is already gone.
The sensor reports a normal-looking 0 — not unknown/unavailable — so there's no visual or
programmatic signal that the reading is missing rather than genuinely zero.

_map_heating has the same pattern (power.value is not None and value > 0 else not heating),
so a missing power reading is also silently interpreted as "not heating."

Impact

On our install (Home Assistant Green, HA Core 2026.9.0, Hilo integration v2026.8.2/pyhilo
installed via HACS), the following device types have been reporting power.value: None from
Hilo's backend continuously since at least Aug 26, 2026 (confirmed via custom_components.hilo

  • pyhilo debug logging over ~2 weeks of history):
  • lowvoltagetstat (Sinope24V HVAC thermostat, model TH6250WF)
  • cee (SinopeWaterHeater, model RM3500WF)
  • unknown_source_tracker (Hilo's own "Unknown Source Tracker" device)

All of the corresponding sensor.*_power entities, and any utility_meter/energy-integration
sensors derived from them, have been flatlined at exactly 0 for the entire period — which is
indistinguishable from "device draws no power" without cross-referencing an independent power
source. We only caught it by comparing whole-home Hydro Quebec hourly grid consumption against
these devices' reported states and noticing the power sensors never moved despite the grid
showing multi-hundred-watt swings correlated with HVAC hvac_action.

We don't know whether the None values originate from a real gap in Hilo's own telemetry for
these device types, or from something specific to our account/hardware — but either way, the
client shouldn't present "no data" as a confident zero.

Suggested fix

In _map_power (and _map_heating), preserve None rather than coercing to 0:

def _map_power(self, device: Dict[str, Any]) -> Dict[str, Any]:
    raw = device["power"]["value"]
    value = self._power_kw_to_w(raw, device["power"]["kind"]) if raw is not None else None
    return self.build_attribute(device["hiloId"], "Power", value)

This would let DeviceReading.value be None, and the hilo HA integration's PowerSensor
could then report unavailable/unknown instead of 0 when the underlying reading is
genuinely absent (that part would need a corresponding change in dvd-dev/hilo's
PowerSensor.state, since get_value("power", 0) currently defaults missing/None values to
0 as well — happy to file that as a follow-up over there once the semantics here are agreed).

Steps to reproduce

  1. Install pyhilo-based Hilo integration for a location with a Sinope24V HVAC thermostat,
    SinopeWaterHeater, or a location using "track unknown sources."
  2. Enable debug logging for custom_components.hilo and pyhilo.
  3. Observe Received subscription result {'onAnyDeviceUpdated': ... 'power': {'value': None, ...}}
    in the logs for the affected device.
  4. Observe the immediately following [<Device>] Received <Reading power 0W> log line — the
    None has already become 0.
  5. The corresponding sensor.<device>_power entity in Home Assistant shows 0, not
    unavailable.

Environment

  • Home Assistant OS 18.2, Core 2026.9.0, Home Assistant Green
  • Hilo integration v2026.8.2 (HACS)
  • pyhilo (bundled dependency of the above)

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions