Conversation
Contributor
There was a problem hiding this comment.
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 |
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>
Signed-off-by: Michael Krug <michi.krug@gmail.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Vacuum as Group with advanced functionality
Vacuumwith the following members:(required) Switch as
vacuumPower(optional) Switch as
vacuumDock(optional) Switch as
vacuumLocate(optional) Number or Dimmer as
vacuumBattery(optional) String as
vacuumCurrentCycleinverted=true/false(optional)
checkState=true/falseGroup 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" }