Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug]: Eufy Mode mapping doesn't fully support Schedule mode #636

Open
thepacketgeek opened this issue Oct 8, 2024 · 1 comment
Open
Labels
bug Something isn't working

Comments

@thepacketgeek
Copy link

thepacketgeek commented Oct 8, 2024

What happened?

Context: In the Eufy app, I typically oscillate between the Home mode when I'm home and Schedule mode when I'm away, which has a schedule for mostly "Away" mode, but I do have a window for "Home" mode so my yard cameras don't trigger an alarm during the time that my gardener visits. (This works well for me because the Eufy schedule mode has been much more reliable than trying to schedule it with HomeKit automations)

In the Eufy mode mappings I have likely what's pretty typical (except for hkAway mode):

hkHome => eufyHome
hkAway => eufySchedule
hkNight => eufyNight
hkOff => eufyDisabled

This causes an issue when setting the Eufy mode via (or even loading the homebridge Accessories page) with this error (more relevant logs and backtrace below):

Error  STATION Homebase3 No matching HomeKit mode found for Eufy mode 0

When Eufy is actually set to schedule (from the app), it's returning a StationCurrentMode of 0 for Away, but this doesn't match the "Schedule" mode (2) that the plugin knows to map to hkAway. I believe the fix is to use StationGuardMode as this is the configured vs. the active mode:

StationAccessory.js

    /**
     * Handle requests to get the current configured value of the 'Security System Target State' characteristic
     */
    handleSecuritySystemTargetStateGet(stateCharacteristic = 'handleSecuritySystemTargetStateGet') {
        try {
            const configuredValue = this.device.getPropertyValue(eufy_security_client_1.PropertyName.StationGuardMode);
            if (configuredValue === -1) {
                throw new Error('Something wrong with this device', configuredValue);
            }
            this.log.info(`GET StationGuardMode: ${configuredValue}`);
            return this.convertEufytoHK(configuredValue);
        }
        catch (error) {
            this.log.error(`${stateCharacteristic}: Wrong return value`, error);
            return false;
        }
    }

This change seems to at least let me load the Accessories page, but I imagine the change from StationCurrentMode -> StationGuardMode will need to be done in more places.

Device Type

Station (Supported)

Plugin Version

v4.3.x (Best Effort)

HomeBridge Version

v1.8.4 (Supported)

NodeJS Version

v20 (Supported)

Operating System

Ubuntu 22.04+ (Supported)

Relevant log output

[10/07/2024, 19:01:29]  [EufySecurity]  INFO    Homebase3 GET StationCurrentMode: 0
[10/07/2024, 19:01:29]  [EufySecurity]  DEBUG    Homebase3 [
  { hk: 0, eufy: 1 },
  { hk: 1, eufy: 2 },
  { hk: 2, eufy: 3 },
  { hk: 3, eufy: 63 }
]
[10/07/2024, 19:01:29]  [EufySecurity]  ERROR   Homebase3 handleSecuritySystemTargetStateGet: Wrong return value

 Error  STATION Homebase3 No matching HomeKit mode found for Eufy mode 0
error stack:
  • StationAccessory.ts StationAccessory.convertEufytoHK
        StationAccessory.ts:290
  • StationAccessory.ts StationAccessory.handleSecuritySystemTargetStateGet
        StationAccessory.ts:316
  • StationAccessory.ts getValue
        StationAccessory.ts:103
  • BaseAccessory.ts    SecuritySystemTargetState.getHandler
        BaseAccessory.ts:154
  • Characteristic.ts   SecuritySystemTargetState.<anonymous>
        Characteristic.ts:2404
  • tslib.js    step
        tslib.js:195
  • tslib.js    Object.next
        tslib.js:176
  • tslib.js
        tslib.js:169
  • 

  • tslib.js    Object.__awaiter
        tslib.js:165

config

{
            "platform": "EufySecurity",
            "name": "EufySecurity",
            ...
            "country": "US",
            "deviceName": "Homebase3",
            "hkHome": 1,
            "hkAway": 2,
            "hkNight": 3,
            "hkOff": 63,
            "_bridge": {
                ...
                "port": 33498
            }
        }
@thepacketgeek thepacketgeek added the bug Something isn't working label Oct 8, 2024
Copy link

github-actions bot commented Oct 8, 2024

Did you check this Common Issues pages ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Development

No branches or pull requests

1 participant