Eufy Security Integration

Resurfacing this: Big thanks to @bropat who made this possible. Please consider buying a coffee for him over here: https://ko-fi.com/bropat

3 Likes

Hi guys,

thank you for all the great work on this addon/integration.
i would like to share a node-red work around i made to control the indoorchime on-off and homebase chime on-off setting. This is only reachable via the app, and there is no schedule option available for these settings (at least to my knowledge)

Basically its a switch in HA that triggers a node-red websocket input to the ws docker container on port 3000. It sets the property to true or false for the chime settings.

[
    {
        "id": "ba5dd7f5.e0fa68",
        "type": "websocket out",
        "z": "f38f2e3c.5ad31",
        "name": "Eufy",
        "server": "",
        "client": "260ae035.e1a5c",
        "x": 750,
        "y": 2220,
        "wires": []
    },
    {
        "id": "ed1b91ec.43d9b",
        "type": "ha-entity",
        "z": "f38f2e3c.5ad31",
        "name": "indoorChimeSwitch",
        "server": "5f6a3bc8.a6fe14",
        "version": 1,
        "debugenabled": false,
        "outputs": 2,
        "entityType": "switch",
        "config": [
            {
                "property": "name",
                "value": "indoorChime"
            },
            {
                "property": "device_class",
                "value": ""
            },
            {
                "property": "icon",
                "value": ""
            },
            {
                "property": "unit_of_measurement",
                "value": ""
            }
        ],
        "state": "payload",
        "stateType": "msg",
        "attributes": [],
        "resend": true,
        "outputLocation": "",
        "outputLocationType": "none",
        "inputOverride": "allow",
        "outputOnStateChange": true,
        "outputPayload": "$entity().state ? \"on\": \"off\"",
        "outputPayloadType": "jsonata",
        "x": 110,
        "y": 2220,
        "wires": [
            [
                "f189e94d.ad7fa8",
                "1d731a67.406066"
            ],
            [
                "49b280aa.f83a7",
                "2267afd2.4bce7"
            ]
        ]
    },
    {
        "id": "f189e94d.ad7fa8",
        "type": "function",
        "z": "f38f2e3c.5ad31",
        "name": "format message",
        "func": "msg.payload= \n{\n    \"messageId\": \"device.set_property\",\n    \"command\": \"device.set_property\",\n    \"serialNumber\": \"T8210P3321211A7C\",\n    \"name\": \"chimeIndoor\",\n    \"value\": true\n}\nreturn msg;\n",
        "outputs": 1,
        "noerr": 0,
        "initialize": "",
        "finalize": "",
        "libs": [],
        "x": 500,
        "y": 2160,
        "wires": [
            [
                "ba5dd7f5.e0fa68"
            ]
        ]
    },
    {
        "id": "49b280aa.f83a7",
        "type": "function",
        "z": "f38f2e3c.5ad31",
        "name": "format message",
        "func": "msg.payload= \n{\n    \"messageId\": \"device.set_property\",\n    \"command\": \"device.set_property\",\n    \"serialNumber\": \"T8210P3321211A7C\",\n    \"name\": \"chimeIndoor\",\n    \"value\": false\n}\nreturn msg;\n",
        "outputs": 1,
        "noerr": 0,
        "initialize": "",
        "finalize": "",
        "libs": [],
        "x": 500,
        "y": 2200,
        "wires": [
            [
                "ba5dd7f5.e0fa68"
            ]
        ]
    },
    {
        "id": "1d731a67.406066",
        "type": "function",
        "z": "f38f2e3c.5ad31",
        "name": "format message",
        "func": "msg.payload= \n{\n    \"messageId\": \"device.set_property\",\n    \"command\": \"device.set_property\",\n    \"serialNumber\": \"T8210P3321211A7C\",\n    \"name\": \"chimeHomebase\",\n    \"value\": true\n}\nreturn msg;\n",
        "outputs": 1,
        "noerr": 0,
        "initialize": "",
        "finalize": "",
        "libs": [],
        "x": 500,
        "y": 2260,
        "wires": [
            [
                "ba5dd7f5.e0fa68"
            ]
        ]
    },
    {
        "id": "2267afd2.4bce7",
        "type": "function",
        "z": "f38f2e3c.5ad31",
        "name": "format message",
        "func": "msg.payload= \n{\n    \"messageId\": \"device.set_property\",\n    \"command\": \"device.set_property\",\n    \"serialNumber\": \"T8210P3321211A7C\",\n    \"name\": \"chimeHomebase\",\n    \"value\": false\n}\nreturn msg;\n",
        "outputs": 1,
        "noerr": 0,
        "initialize": "",
        "finalize": "",
        "libs": [],
        "x": 500,
        "y": 2300,
        "wires": [
            [
                "ba5dd7f5.e0fa68"
            ]
        ]
    },
    {
        "id": "260ae035.e1a5c",
        "type": "websocket-client",
        "path": "ws://192.168.1.100:3000",
        "tls": "",
        "wholemsg": "false"
    },
    {
        "id": "5f6a3bc8.a6fe14",
        "type": "server",
        "name": "Home Assistant",
        "version": 1,
        "legacy": false,
        "addon": false,
        "rejectUnauthorizedCerts": true,
        "ha_boolean": "y|yes|true|on|home|open",
        "connectionDelay": true,
        "cacheJson": true
    }
]

youā€™ll need the websocket node and the homeassistant addon that lets your create sensors and switches from within node-red.
its been an long time since i did anything in python / custom python components for HA, but i guess this could be implemented in this integration as a switch or with a service command maybe.

You could also use this with the bropat ws container without all the integration stuff in HA off course.

Random question, but does anyone know the RSSI range Eufy use for the wifi values? Wanting to convert it from a number eg. -56 in to a bar equivalent sensor if possibleā€¦

It depends on the device, but here you can find the functions:

    public static int m6911b(int i) {
        if (i >= 0) {
            return -1;
        }
        if (i >= -60) {
            return 3;
        }
        if (i >= -70) {
            return 2;
        }
        return i >= -80 ? 1 : 0;
    }

    /* renamed from: c */
    public static int m6910c(int i) {
        if (i >= 0) {
            return -1;
        }
        if (i >= -65) {
            return 3;
        }
        if (i >= -75) {
            return 2;
        }
        return i >= -85 ? 1 : 0;
    }

    /* renamed from: d */
    public static int m6909d(int i) {
        if (i >= -65) {
            return 3;
        }
        if (i >= -75) {
            return 2;
        }
        return i >= -85 ? 1 : 0;
    }

    /* renamed from: e */
    public static int m6908e(int i) {
        if (i >= -65) {
            return 3;
        }
        if (i >= -75) {
            return 2;
        }
        return i >= -80 ? 1 : 0;
    }

1 Like

Thanks heaps for this. I have Eufy 2c devices, donā€™t suppose you know how would I find the corresponding model number for these? All good if not, will use one of the above as estimates and tweak as needed :slight_smile:

Hi! I am looking for a camera system and came over this. A potential pro for me is that this system also includes alarm system with sensors etc.

Have anyone experience with Eufy vs. Google Nest vs. Arlo?

ā€¦and does anyone have a screenshot with how this integration looks in their dashboard? :smile:

Check camera attributes in developer tools page, you can see many information there.

image

hey, I do not think that this integration is ready to claim as a full fledge security solution. I have just integrated base station 5 days ago, so, there is still time to reach a steady point.

For screenshots, integration is using basic alarm entity, camera and binary sensors for motion triggers.

image

image

image

1 Like

you can contribute to integration and create specific sensors for these.

Eufycam 2c should be T8113 and therefore these would be the correct values:

    public static int m6910c(int i) {
        if (i >= 0) {
            return -1;
        }
        if (i >= -65) {
            return 3;
        }
        if (i >= -75) {
            return 2;
        }
        return i >= -85 ? 1 : 0;
    }

do you think this can be part of eufy-security-client as a property?

If you mean eufy-security-client, yes it is possible. I just donā€™t know if I should implement it now, when Iā€™m so close to the 1.0.0 release :wink:

3 Likes

any specific reason to use different methods for different sets of cameras? I believe these mappings should be global sth like this: https://android.stackexchange.com/a/176325

This is something you have to ask Eufy :stuck_out_tongue_closed_eyes:. From my point of view no.

Thanks guys, appreciate all the support! Great integration, keep it up :slight_smile:

I have now implemented it after all :sweat_smile:, but only for a subset of devices (@benm7 including Eufycam 2c).

Property: wifiSignalLevel
Values:

export enum WifiSignalLevel {
    NO_SIGNAL = 0,
    WEAK = 1,
    NORMAL = 2,
    STRONG = 3,
    FULL = 4,
}

@anon63427907 and @bropat - thank you both so much for your work. Iā€™ve been following this progress for a long time, and recently reached a point where my cameras are reliably able to stream the cameras through Home Assistant. Itā€™s awesome!

As this integration is providing a picture of the last motion event as the still image for the camera, I was thinking that it would be useful to display the timestamp of that last motion event in my Lovelace card. However, I am unsure what the best way to determine what the timestamp actually is. In the Developer Tools, I see a number of timestamp attributes assigned to the camera, but they arenā€™t specific to the last motion event, and Iā€™m not sure if they are truly accurate.

I know I could do something indirect, like monitoring the last changed attribute of the motion sensor, but was wondering if you had a better (more direct) suggestion based on what the API is providing you. Any suggestions are very much appreciated!

2 Likes

Yes, with the method ā€œdevice.get_propertiesā€ in eufy-security-ws you also get the timestamp of the last change for the respective property:

...
pictureUrl: {
        value: 'https://zhixin-security-eu.s3.eu-central-1.amazonaws.com/thumb/2021/08/07/station/...',
        timestamp: 1628328622000
      },
...

But here I think @anon63427907 has to implement it on his siteā€¦ :wink:

You just need to track last changed attribute for motion or person detected sensors created next to your camera

Ah, yesā€¦this makes sense. Thanks for the feedback. Looks like this is available in the debug attributes for now.

This works for me:

{{ (state_attr('camera.eufy_garage', 'debug').properties.pictureUrl.timestamp / 1000) | timestamp_local }}