Skip to content

Luma litterbox support - #199

Merged
jjjonesjr33 merged 2 commits into
jjjonesjr33:devfrom
tjd-dev:luma-litterbox-support
Mar 13, 2026
Merged

Luma litterbox support#199
jjjonesjr33 merged 2 commits into
jjjonesjr33:devfrom
tjd-dev:luma-litterbox-support

Conversation

@tjd-dev

@tjd-dev tjd-dev commented Jan 28, 2026

Copy link
Copy Markdown
Contributor

Proposed change:

Adds full-ish support for the Luma Smart Litter Box (PLLB001) with comprehensive entity coverage including sensors, binary sensors, buttons, switches, and firmware update support.

I’m still working through the API and command executor to assess the feasibility of supporting the scheduling of the air filter on the device. I’ve tried to make the entities as helpful and verbose as possible, but many are disabled by default for everyone’s sanity. The goal of future updates will be to intercept or capture photo data and allow users to route poop selfies to an AI task and an AI agent of their choice, at their own cost.

Key Features:

Device Control:

  • 7 button entities: Start Clean, Empty Waste, Level Litter, Stop, Open/Close Door, Air Purifier
  • 3 switch entities: Sound, Light, Deodorization
  • Full door control (open/close)

Monitoring:

  • 21 sensor entities covering:
    • Connectivity (WiFi signal, online status)
    • Battery information (level, supply hours)
    • Weight measurements
    • Maintenance tracking (filter days, mat days)
    • Device states (clean state, filter state, mat state, door state)
    • Operational modes (clean mode, deodorization mode, sleep mode)
    • Volume levels
    • Motion sensitivity
  • 10 binary sensor entities:
    • Online status
    • Waste bin state
    • Vacuum state
    • Deodorization active
    • Door state
    • Error states (warehouse error, door error)
    • Sleep mode
    • Camera state
    • Hardware button lock

API Implementation:

  • Generic exec_device_command() method for executing device commands
  • 7 specific command methods for common operations
  • Support for 13 discovered API actions: CLEAN, STOP_CLEAN, SUSPEND_CLEAN, RESTART_CLEAN, EMPTY, STOP_EMPTY, RESTART_EMPTY, LEVELING, VACUUM, OPEN_DOOR, CLOSE_DOOR, STOP, CANCEL
  • Integration with 4 API endpoints: device_real_info, device_data_real_info, device_attribute_settings, get_device_upgrade

Firmware Updates:

  • Full support for firmware update entity via Home Assistant's update platform

Files Changed:

  • custom_components/petlibro/__init__.py - Device registration
  • custom_components/petlibro/api.py - New API methods for command execution and device info
  • custom_components/petlibro/binary_sensor.py - 10 binary sensor entities
  • custom_components/petlibro/button.py - 7 button entities
  • custom_components/petlibro/devices/litterboxes/__init__.py - Litter box device exports
  • custom_components/petlibro/devices/litterboxes/litter_box.py - Base litter box class
  • custom_components/petlibro/devices/litterboxes/luma_smart_litter_box.py - Main device implementation (491 lines)
  • custom_components/petlibro/number.py - Number entity support
  • custom_components/petlibro/select.py - Select entity support
  • custom_components/petlibro/sensor.py - 21 sensor entities
  • custom_components/petlibro/switch.py - 3 switch entities
  • custom_components/petlibro/text.py - Text entity support
  • custom_components/petlibro/update.py - Firmware update entity
  • README.md - Updated to move device from "Pending" to "Supported Devices"

Total: 14 files changed, 923 insertions(+), 3 deletions(-)

Closes # (issue)

Type of change:

  • New device.
  • Bug fix (non-breaking change which fixes an issue).
  • New feature or enhancement (non-breaking change which adds functionality).
  • Documentation only.
  • Other (please explain).

Checklist:

  • If applicable, I have added corresponding documentation changes.
  • If applicable, I have reviewed the feature / enhancement guidlines before submitting my request.
  • If applicable, I have tested my code for new features & regressions on the latest version of Home Assistant.

Additional notes:

  • All functionality has been tested against a real Luma Smart Litter Box (PLLB001) device
  • The API was reverse-engineered from the official PetLibro Flutter app (APK analysis of libapp.so)
  • All discovered API endpoints and commands have been verified to work correctly
  • The implementation follows the existing code patterns and structure used by other devices in the integration
  • Device supports 40+ properties across 4 different API endpoints
  • All entity types (sensors, binary sensors, buttons, switches, numbers, selects, text, update) are properly implemented
  • The device class includes comprehensive property accessors with proper type hints and error handling

Reverse-engineered the PetLibro API from the Flutter APK (libapp.so) to discover
/device/device/execCmdService with the "action" field as the command executor.
This enables triggering clean cycles, emptying waste, leveling litter, controlling
the door, and running the air purifier -- all confirmed working against a real device.

Key additions:
- Device class: LumaSmartLitterBox with 40+ properties from 4 API endpoints
- API: exec_device_command() generic command executor + 7 specific command methods
- Buttons: Start Clean, Empty Waste, Level Litter, Stop, Open/Close Door, Air Purifier
- Switches: Sound, Light, Deodorization
- Sensors: 21 sensors (WiFi, battery, weight, maintenance days, states, modes, volume)
- Binary sensors: 10 sensors (online, waste bin, vacuum, deodorization, door, errors, sleep)
- Firmware update entity support

Discovered API actions: CLEAN, STOP_CLEAN, SUSPEND_CLEAN, RESTART_CLEAN, EMPTY,
STOP_EMPTY, RESTART_EMPTY, LEVELING, VACUUM, OPEN_DOOR, CLOSE_DOOR, STOP, CANCEL
@jjjonesjr33 jjjonesjr33 added the Enhancement New feature or request label Jan 28, 2026
@github-project-automation github-project-automation Bot moved this to To triage in Petlibro Jan 28, 2026
@jjjonesjr33 jjjonesjr33 moved this from To triage to In review in Petlibro Jan 28, 2026
@jjjonesjr33

Copy link
Copy Markdown
Owner

Awesome work @tjd-dev , by chance do you have any pictures of the dashboard for the Luna litterbox that you could post so I could take a look?

@tjd-dev

tjd-dev commented Jan 28, 2026

Copy link
Copy Markdown
Contributor Author

A good bulk of these will be hidden by default, for some of the values I am still trying to "translate" what they actually mean like weight and water % (likely linked to litter level). Screenshot 2026-01-28 at 9 32 45 AM

@jjjonesjr33 jjjonesjr33 left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's give it a try.

@jjjonesjr33
jjjonesjr33 merged commit da9cdd1 into jjjonesjr33:dev Mar 13, 2026
2 checks passed
@github-project-automation github-project-automation Bot moved this from In review to Done in Petlibro Mar 13, 2026
@jjjonesjr33 jjjonesjr33 added the Completed Completed tasks label Aug 16, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Completed Completed tasks Enhancement New feature or request

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

2 participants