Skip to content

v1.4.3 — Fix Errors with Wired-only Devices

Choose a tag to compare

@Hackashaq666 Hackashaq666 released this 05 Apr 18:05
· 2 commits to main since this release
6cb5310

Fix: Wired-only device compatibility (GL-MT2500 / Brume 2)

The GL-MT2500 (Brume 2) is a wired-only router with no WiFi radio. The integration was calling WiFi-related RPC methods on every poll cycle, which the MT2500 firmware correctly rejects with -32601 Method not found. This caused cascading failures across the sensor, switch, and device tracker platforms.

api.py

  • In _make_rpc_call, RPC responses with error code -32601 (Method not found) are now logged at DEBUG level instead of ERROR. This suppresses log spam on hardware that legitimately doesn't support a given RPC method. All other error codes continue to log at ERROR.

sensor.py

  • Both .get("wifi_status_detail", {}) calls (in native_value and extra_state_attributes) replaced with .get("wifi_status_detail") or {} to correctly handle the case where the coordinator key exists but holds None rather than a missing key
  • native_value for wifi_devices_status now returns None early when wifi_status_detail is falsy
  • extra_state_attributes for wifi_devices_status now returns {} early under the same condition
  • The WiFi Devices Status sensor will show as unavailable on wired-only devices rather than crashing every 30 seconds

switch.py

  • async_setup_entry now guards wifi_config with or {} before iterating, preventing the switch platform from crashing at startup on wired-only devices
  • GLiNetWiFiSwitch.is_on applies the same guard on wifi_config
  • GLiNetWiFiSwitch.extra_state_attributes applies the same guard on wifi_status_detail
  • No WiFi switches will be created on devices that return no WiFi configuration

device_tracker.py

  • async_write_ha_state() is now guarded with a hass is not None check before being called on tracked devices
  • Previously, when the switch platform failed to set up cleanly, the coordinator would fire update callbacks against device tracker entities that had been created but not yet fully registered with HA, causing a RuntimeError: Attribute hass is None crash loop every 30 seconds
  • With the switch platform fix in place this guard may no longer trigger, but it is the correct defensive pattern regardless

General

All four files apply the same defensive pattern: .get("key") or {} rather than .get("key", {}) when the coordinator may store None explicitly for a key on unsupported hardware, rather than omitting the key entirely.