Skip to content

MaxWinterstein/eufy-ha-mqtt-bridge

 
 

Repository files navigation

Eufy Home Assistant MQTT Bridge

(Early version)

This script subscribes to push notifications of the Eufy Security app and publishes Motion and Doorbell pressed events via MQTT to Home Assistant. When using auto discovery, it automatically creates binary sensors for Motion and Doorbell pressed events.

Uses the eufy-node-client by JanLoebel and is heavily inspired on its examples.

Supported devices

For now very limited, and only tested with

  • Eufy Cam 2 Pro (T8140)
  • Eufy video doorbell 2K (T8210)

All push messages from all devices are logged, so it would be relatively easy to add support for new devices

Features

The following sensors are automatically added to Home Assistant via MQTT discovery:

  • Motion detected (binary sensor)
    • Eufy Cam 2 Pro
    • Eufy video doorbell 2K
  • Doorbell button pressed (binary sensor)
    • Eufy video doorbell 2K
  • Thumbnail of Last event (camera sensor)
    • Eufy Cam 2 Pro
    • Eufy video doorbell 2K

These can be used to trigger automations based on motion / button pressed.

Setup

Docker configuration

The data folder contains the config, logs and a record of all push notifications (so new types of notifications can be discovered). Mount this directory to a local folder. Replace /path/to/local/data/folder below with the location where you want to store this data.

If you run your MQTT broker on the same host as this Docker image, it cannot simply connect to localhost from inside this Docker image. In that case, add a line to add the correct IP for the Docker network inside the image as dockerhost. You can then use mqtt://dockerhost:1883 as the MQTT url. Otherwise, you can remove that line from the example below.

In the data directory, you will need to create a config.yml file with your credentials. It should contain the following contents:

eufy:
  username: "your@email"
  password: "password"
mqtt:
  url: "mqtt://dockerhost:1883"
  username: "user"
  password: "password"

At the moment it is not possible to use an account with 2FA enabled. If you use the same credentials on the app, you might be logged out here when you login in the app, so I recommend creating a second account (with a strong random generated password and no 2FA) and invite it to your Eufy account.

Run via Docker

Run the container, with a volume mapping to the local data directory, for example:

docker run \
   -d \
   --name eufy-bridge \
   --restart unless-stopped \
   -v /path/to/local/data/folder:/app/data \
   --add-host=dockerhost:`docker network inspect --format='{{range .IPAM.Config}}{{.Gateway}}{{end}}' bridge` \
   matijse/eufy-ha-mqtt-bridge

Run via npm

To run directly via npm:

  1. Clone this repository
  2. Create a config.yml file in the data folder, for contents see above.
  3. Run npm install
  4. Run npm run start

Manually adding sensors

When you have automatic discovery via MQTT disabled, you can add the binary sensors manually via YAML configuration:

Replace {device_sn} by the serial number of the device, for example T8140P0123456789

Motion detected:

binary_sensor:
  - platform: mqtt
    name: Camera motion detected
    device_class: motion
    state_topic: homeassistant/binary_sensor/eufy/{device_sn}_motion/state
    json_attribute_topic: homeassistant/binary_sensor/eufy/{device_sn}_motion/attributes
    payload_on: motion
    payload_off: clear
    off_delay: 5

Doorbell button pressed:

binary_sensor:
  - platform: mqtt
    name: Doorbell button pressed
    device_class: motion
    state_topic: homeassistant/binary_sensor/eufy/{device_sn}_doorbell/state
    json_attribute_topic: homeassistant/binary_sensor/eufy/{device_sn}_doorbell/attributes
    payload_on: motion
    payload_off: clear
    off_delay: 5

Thumbnail of last event:

camera:
  - platform: mqtt
    name: Camera - Last event
    topic: homeassistant/camera/eufy/{device_sn}_thumbnail

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • JavaScript 99.4%
  • Dockerfile 0.6%