@homebridge-plugins/homebridge-ecovacs 7.2.4-beta.2 → 7.2.4-beta.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/platform.js +48 -11
- package/package.json +1 -1
package/lib/platform.js
CHANGED
|
@@ -566,13 +566,24 @@ export default class {
|
|
|
566
566
|
async handleMatterPause(accessory) {
|
|
567
567
|
try {
|
|
568
568
|
accessory.logDebug('Matter: Pause request received')
|
|
569
|
-
|
|
570
|
-
//
|
|
571
|
-
|
|
569
|
+
|
|
570
|
+
// Don't continue if we can't send commands to the device
|
|
571
|
+
const control = this.getControl(accessory)
|
|
572
|
+
if (!control) {
|
|
573
|
+
throw new Error(platformLang.errNotInit)
|
|
574
|
+
}
|
|
575
|
+
if (!control.is_ready) {
|
|
576
|
+
throw new Error(platformLang.errNotReady)
|
|
577
|
+
}
|
|
578
|
+
|
|
579
|
+
// Send pause command to the device
|
|
580
|
+
accessory.log(`${platformLang.curCleaning} [pause]`)
|
|
581
|
+
accessory.logDebug(`${platformLang.sendCmd} [Pause]`)
|
|
582
|
+
control.run('Pause')
|
|
572
583
|
|
|
573
584
|
// Update Matter states immediately
|
|
574
|
-
this.updateMatterRunMode(accessory,
|
|
575
|
-
this.updateMatterOperationalState(accessory,
|
|
585
|
+
this.updateMatterRunMode(accessory, 1) // Still in Cleaning mode
|
|
586
|
+
this.updateMatterOperationalState(accessory, 2) // Paused state
|
|
576
587
|
} catch (err) {
|
|
577
588
|
accessory.logWarn(`Matter: Pause failed ${parseError(err)}`)
|
|
578
589
|
}
|
|
@@ -603,7 +614,24 @@ export default class {
|
|
|
603
614
|
async handleMatterResume(accessory) {
|
|
604
615
|
try {
|
|
605
616
|
accessory.logDebug('Matter: Resume request received')
|
|
606
|
-
|
|
617
|
+
|
|
618
|
+
// Don't continue if we can't send commands to the device
|
|
619
|
+
const control = this.getControl(accessory)
|
|
620
|
+
if (!control) {
|
|
621
|
+
throw new Error(platformLang.errNotInit)
|
|
622
|
+
}
|
|
623
|
+
if (!control.is_ready) {
|
|
624
|
+
throw new Error(platformLang.errNotReady)
|
|
625
|
+
}
|
|
626
|
+
|
|
627
|
+
// Send resume command to the device
|
|
628
|
+
accessory.log(`${platformLang.curCleaning} [resume]`)
|
|
629
|
+
accessory.logDebug(`${platformLang.sendCmd} [Resume]`)
|
|
630
|
+
control.run('Resume')
|
|
631
|
+
|
|
632
|
+
// Update Matter states immediately
|
|
633
|
+
this.updateMatterRunMode(accessory, 1) // Cleaning mode
|
|
634
|
+
this.updateMatterOperationalState(accessory, 1) // Running state (resumed from pause)
|
|
607
635
|
} catch (err) {
|
|
608
636
|
accessory.logWarn(`Matter: Resume failed ${parseError(err)}`)
|
|
609
637
|
}
|
|
@@ -1586,9 +1614,14 @@ export default class {
|
|
|
1586
1614
|
|
|
1587
1615
|
// Check if the new cleaning state is different from the cached state
|
|
1588
1616
|
if (accessory.context.cacheClean !== newVal) {
|
|
1589
|
-
|
|
1590
|
-
|
|
1591
|
-
|
|
1617
|
+
// Normalize the state value
|
|
1618
|
+
const normalizedState = newVal.toLowerCase().replace(/[^a-z]+/g, '')
|
|
1619
|
+
|
|
1620
|
+
// Check if device is actively cleaning
|
|
1621
|
+
const isActive = ['auto', 'clean', 'edge', 'spot', 'spotarea', 'customarea'].includes(normalizedState)
|
|
1622
|
+
|
|
1623
|
+
// Check if device is paused
|
|
1624
|
+
const isPaused = normalizedState === 'pause'
|
|
1592
1625
|
|
|
1593
1626
|
// State is different so update HAP service
|
|
1594
1627
|
accessory
|
|
@@ -1596,8 +1629,12 @@ export default class {
|
|
|
1596
1629
|
.updateCharacteristic(this.hapChar.On, isActive)
|
|
1597
1630
|
|
|
1598
1631
|
// Update Matter states
|
|
1599
|
-
if (
|
|
1600
|
-
// Vacuum is
|
|
1632
|
+
if (isPaused) {
|
|
1633
|
+
// Vacuum is paused
|
|
1634
|
+
this.updateMatterRunMode(accessory, 1) // Still in Cleaning mode
|
|
1635
|
+
this.updateMatterOperationalState(accessory, 2) // Paused state
|
|
1636
|
+
} else if (isActive) {
|
|
1637
|
+
// Vacuum is actively cleaning
|
|
1601
1638
|
this.updateMatterRunMode(accessory, 1) // Cleaning mode
|
|
1602
1639
|
this.updateMatterOperationalState(accessory, 1) // Running state
|
|
1603
1640
|
} else {
|
package/package.json
CHANGED