Skip to content

Add extended vacuum device - #653

Merged
michikrug merged 6 commits into
mainfrom
vacuum
Nov 30, 2025
Merged

Add extended vacuum device#653
michikrug merged 6 commits into
mainfrom
vacuum

Conversation

@michikrug

@michikrug michikrug commented Sep 10, 2025

Copy link
Copy Markdown
Collaborator

Vacuum as Group with advanced functionality

Device Type Vacuum
Supported Traits StartStop, Dock, Locator, RunCycle, EnergyStorage
Supported Items Group as Vacuum with the following members:
(required) Switch as vacuumPower
(optional) Switch as vacuumDock
(optional) Switch as vacuumLocate
(optional) Number or Dimmer as vacuumBattery
(optional) String as vacuumCurrentCycle
Configuration (optional) inverted=true/false
(optional) checkState=true/false
Group  vacuumRobot { ga="Vacuum" [ checkState=true ] }
Switch vacuumPowerItem     (vacuumRobot) { ga="vacuumPower" }
Switch vacuumDockItem      (vacuumRobot) { ga="vacuumDock" }
Switch vacuumLocateItem    (vacuumRobot) { ga="vacuumLocate" }
Number vacuumBatteryItem   (vacuumRobot) { ga="vacuumBattery" }
String vacuumCycleItem     (vacuumRobot) { ga="vacuumCurrentCycle" }

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull Request Overview

This PR adds advanced vacuum device support with Google Assistant traits for StartStop, Dock, Locator, RunCycle, and EnergyStorage. The implementation refactors the existing Vacuum class to support Group items with members, while introducing SimpleVacuum to maintain backward compatibility with simple Switch-based vacuums.

Key changes:

  • Implements full-featured Vacuum device as Group with multiple member types (vacuumPower, vacuumDock, vacuumLocate, vacuumBattery, vacuumCurrentCycle)
  • Adds new Locate and Dock commands with vacuum-specific getItemName logic
  • Refactors getMembers method in DefaultDevice for better readability and documentation
  • Extends StartStop command to handle vacuum group member routing

Reviewed Changes

Copilot reviewed 11 out of 11 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
functions/devices/vacuum.js Transformed from simple StartStopSwitch to full Group device with traits for advanced vacuum features
functions/devices/simplevacuum.js New backward-compatible simple vacuum for Switch items
functions/commands/startstop.js Added vacuum-specific getItemName to route to vacuumPower member
functions/commands/locate.js New command for Locator trait, routes to vacuumLocate member
functions/commands/dock.js New command for Dock trait with alreadyDocked state validation
functions/devices/default.js Refactored getMembers with improved readability and documentation
tests/devices/vacuum.test.js Comprehensive test coverage for all vacuum functionality
tests/commands/locate.test.js Full test coverage for Locate command
tests/commands/dock.test.js Full test coverage for Dock command
tests/commands/startstop.test.js Added getItemName tests for vacuum member routing
docs/USAGE.md Added documentation for vacuum group configuration

Comment thread functions/devices/vacuum.js Outdated
michikrug and others added 4 commits November 30, 2025 13:19
Signed-off-by: Michael Krug <michi.krug@gmail.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Signed-off-by: Michael Krug <michi.krug@gmail.com>
Signed-off-by: Michael Krug <michi.krug@gmail.com>
Signed-off-by: Michael Krug <michi.krug@gmail.com>

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 13 out of 13 changed files in this pull request and generated 3 comments.

Comment thread functions/devices/vacuum.js
Comment thread tests/devices/vacuum.test.js
Comment thread functions/devices/simplevacuum.js Outdated
Signed-off-by: Michael Krug <michi.krug@gmail.com>
Signed-off-by: Michael Krug <michi.krug@gmail.com>
@michikrug
michikrug merged commit 37c97e0 into main Nov 30, 2025
8 checks passed
@michikrug
michikrug deleted the vacuum branch November 30, 2025 12:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants