Skip to content

Add support for AL-KO smart charger devices (ALKO-CHARGER)#46

Open
budisek wants to merge 1 commit into
jonkristian:masterfrom
budisek:feature/charger-support
Open

Add support for AL-KO smart charger devices (ALKO-CHARGER)#46
budisek wants to merge 1 commit into
jonkristian:masterfrom
budisek:feature/charger-support

Conversation

@budisek

@budisek budisek commented Apr 3, 2026

Copy link
Copy Markdown

Summary

This PR adds support for AL-KO smart charger devices (e.g. C 200 Li 36V / model C38-4260) that are registered in the AL-KO inTOUCH app but were previously invisible in Home Assistant.

Root causes fixed

  • API category filterpyalko fetches devices with thingCategory=ALKO-ROBOLINHO, which silently excludes chargers and other non-mower device types. This PR overrides get_devices() in a subclass to remove the filter so all registered devices are returned.
  • hasattr() checks — all attributes are defined as @property on ThingstateStateReported, so hasattr() always returned True regardless of what the device actually reports. Replaced throughout with direct key checks on the raw .attributes dict.

New entities for smart chargers

Sensors

  • Input voltage (V) and frequency (Hz)
  • Charger error code (0 = OK)
  • Total operation time
  • Per battery slot: level (%), voltage (V), charging current (A), temperature (°C), total charge cycles
  • RSSI / signal strength

Binary sensors

  • Per battery slot: inserted, charging
  • Is Connected

Switches

  • Eco Mode — reduces charging current to ~1.5 A (from ~3 A) for lower heat and longer battery life
  • Battery 1 / 2 Storage Mode — ON sets charging limit to 60 % (recommended for winter / long-term storage), OFF restores 100 %

Side effects on existing mower support

  • lawn_mower.py: fixed device filter so mower entities are not created for chargers
  • button.py: fixed filter so Reset Blade Life button is not created for chargers
  • All platforms: hasattr().attributes key checks (no functional change for mowers, just correctness)

Test plan

  • Mower entities still appear and function correctly after update
  • Smart charger device appears as a new HA device after update
  • Charger sensors show correct values (input voltage ~230 V, frequency 50 Hz)
  • Eco Mode switch toggles correctly in the AL-KO app
  • Storage Mode switch sets 60 % / 100 % limit correctly in the AL-KO app
  • Battery inserted / charging binary sensors update when battery is inserted and charging begins

Device tested

AL-KO C 200 Li 36V Smart Charger (model C38-4260, type ALKO-CHARGER)

🤖 Generated with Claude Code

- Fix API category filter: remove hard-coded thingCategory=ALKO-ROBOLINHO
  so all registered AL-KO IoT devices are fetched (chargers, batteries, etc.)
- Fix hasattr() checks across all platforms: properties are always defined
  on ThingstateStateReported so hasattr() always returned True; replaced
  with direct key checks on the raw .attributes dict
- Add comprehensive smart charger entities for model C38-4260 and similar:
  - Sensors: input voltage (V), input frequency (Hz), charger error,
    operation time, per-slot battery level (%), voltage (V), current (A),
    temperature (°C), total charge cycles, RSSI
  - Binary sensors: per-slot battery inserted, battery charging
  - Switches: charger eco mode (reduced ~1.5 A current),
    per-slot storage mode (ON = 60 % limit for winter storage,
    OFF = 100 % full charge)
- Add debug WARNING log for non-mower devices to aid future device support

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant