Eufy Camera Integration

My experience has been the same as yours; I never could get MQTT sensors to update, so I ended up moving over to REST. But the URLs I am using are different from the ones that were in Fuzzy’s article. When I finally figured it out, I started getting updated last event images and my motion sensors started posting logbook entries which showed me that things were communicating.

I’m not sure why MQTT doesn’t work for me; I’m using the same external MQTT broker that I use for my weather station, under the same discovery topic and I see near real-time topic posts for things like wind speed/direction. But for the Eufy stuff, nothing updates until I restart the mqtt instance or the ioBroker add on itself.

@rpitera, @rucknapucknavitz

look here:

Eufy Camera Integration - Feature Requests - Home Assistant Community (home-assistant.io)

Unfortunately that didn’t help. And now I can’t get into the config to change it; both io and ha have become unresponsive. I’m trying to delete the MQTT instance so I can set it up again. Will report back.

Would you mind sharing those URLs (anonymized), please?

Yeah, give me a few though - trying to recover here. Finally got the MQTT instance deleted and things are almost back to normal again. Have to do a restart because I lost my zwave during the resource flood.

Here’s what I am using for motion sensors:


- platform: rest
  resource: http://IOBROKER_IP:8087/getPlainValue/eufy-security.0.BASE_STATION_ID.cameras.CAMERA_ID.motion_detected
  name: eufy front right motion
  device_class: motion
- platform: rest
  resource: http://IOBROKER_IP:8087/getPlainValue/eufy-security.0.BASE_STATION_ID.cameras.CAMERA_ID.person_detected
  name: eufy front right person
  device_class: motion

And this is what is working for me for cameras (gets last event image and updates when new event)

- platform: generic
  still_image_url: http://IOBROKER_IP:8082/eufy-security.0/BASE_STATION_ID/last_event/CAMERA_ID.jpeg
  name: eufy_front_right

Note that it’s JPEG and not JPG.

1 Like

Also here’s what I am using for battery and for base station status:

- platform: rest
  name: eufy front right battery
  resource: http://IOBROKER_IP:8087/getPlainValue/eufy-security.0.BASE_STATION_ID.cameras.CAMERA_ID.battery
  device_class: battery
  unit_of_measurement: '%'
  scan_interval: 60
- platform: rest
  name: eufy base station mode
  resource: http://IOBROKER_IP:8087/getPlainValue/eufy-security.0.BASE_STATION_ID.station.guard_mode
  scan_interval: 10
  value_template: >-
    {% set v = value | replace('"', "")|int  %}
    {{ {0: "Away",
        1: "Home",
        2: "Schedule",
        3: "Custom1",
        4: "Custom2",
        5: "Custom3",
        47: "Geofence",
        63: "Disarmed"}[v] | default("Unknown state:" + (value|urlencode)) }}

Having to restart my VM as ZW got hosed when I had the MQTT meltdown. Yikes.

1 Like

@rucknapucknavitz

can you try manually triggering the rest_command? Cut and paste the string into a web browser.

That works for me 100% of the time, both for reading states, and changing them.

I am having some weird issues here. So I wanted to upgrade the IoBroker adapter (https://github.com/bropat/ioBroker.eufy-security) so i just installed it again and it upgraded. I then got the error;

startInstance system.adapter.eufy-security.0: required adapter "web" not found!

So I tried to install the web adapter (that was missing for some reason?) and then things just started to blow up. I tried restarting the ioBroker with no success. Did I install some wrong dependency or something? Any one now?

|eufy-security.0|2021-04-08 22:15:39.464|error|at processTicksAndRejections (internal/process/task_queues.js:97:5)|
|---|---|---|---|
|eufy-security.0|2021-04-08 22:15:39.464|error|at fulfilled (/opt/iobroker/node_modules/eufy-security-client/build/http/station.js:5:58)|
|eufy-security.0|2021-04-08 22:15:39.464|error|at Generator.next (<anonymous>)|
|eufy-security.0|2021-04-08 22:15:39.464|error|at Station.<anonymous> (/opt/iobroker/node_modules/eufy-security-client/build/http/station.js:177:43)|
|eufy-security.0|2021-04-08 22:15:39.464|error|(864) TypeError: this.hub.devices is not iterable|
|eufy-security.0|2021-04-08 22:15:39.463|error|(864) unhandled promise rejection: this.hub.devices is not iterable|
|Unhandled|2021-04-08 22:15:39.463|error|promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch().|

|eufy-security.0|2021-04-08 22:15:57.244|info|(891) Connected to station T8010P2320280BE5 on host 192.168.0.33 and port 21275.|
|---|---|---|---|
|eufy-security.0|2021-04-08 22:15:57.213|info|(891) Terminated (NO_ERROR): Without reason|
|eufy-security.0|2021-04-08 22:15:57.212|info|(891) terminating|
|eufy-security.0|2021-04-08 22:15:56.947|info|(891) Disconnect from station T8010P2320280BE5.|
|eufy-security.0|2021-04-08 22:15:56.947|info|(891) Disconnect from station T8010P2320270ADF.|
|eufy-security.0|2021-04-08 22:15:56.945|error|(891) TypeError: this.hub.devices is not iterable at Station.<anonymous> (/opt/iobroker/node_modules/eufy-security-client/build/http/station.js:177:43) at Generator.next (<anonymous>) at f|
|eufy-security.0|2021-04-08 22:15:56.944|error|(891) unhandled promise rejection: this.hub.devices is not iterable|
|eufy-security.0|2021-04-08 22:15:56.944|error|Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch().|

Apparently I got the FNG Block this morning for too many replies on my first day, and had to wait 6 hours to respond. :slight_smile:

Sorry it messed up your system. Mine just crashed the container (I have it installed via MaxW’s add-on repo). I was able to restart the add-on and switch off the setting before it overwhelmed my system.

Thanks so much for these REST entries. They worked great for REST sensors (but I’m now using the Eufy Home Assistant MQTT Bridge (again via MaxW) as it all self-configured and is working great (a little faster refresh than REST).

I am still having issues with rest_command switches for guard_mode via ioBroker being recognized on the Indoor cameras (works absolutely fine and near instant on a HomeBase 2).

Well, switches on next on my list so I’ll post back here once I get them working. I might give the bridge another chance at some point to see if the motion sensors are any better, but I’m done with MQTT on ioBroker. It never seems to update unless restarted and REST cams/sensors are working for me.

As an FYI, i’m working to update my blog to be statically generated and have the source in github, so people can make PRs to update anything that’s wrong/needs updating. Figured my Eufy Security post would probably be a prime candidate for that.

2 Likes

This didn’t work for me either, unfortunately.

I tried with “Send states (ack=true) too” set to on and the “Subscribe patterns” set to something random (notopic/#). It certainly stopped the flood of topics but I’m unable to communicate back to the cameras unless the Subscribe patters are “all” (#) or specific to eufy-security - in which case the infinite loop starts all over again.

I suppose this approach may be a fix For MQTT sensors, but not for deploying MQTT switches.

Is there something with the “Default QoS” settings, perhaps?

I’m finding the Eufy Home Assistant MQTT Bridge (I have it installed via MaxW’s add-on repo.) to be flawless with motion states (if they only last a brief second… I want the sensor to stay “on” for a period of time after the trigger but haven’t figured that out), last event images, and battery %, and is updating more quickly than the rest_sensor camera images (thanks @riptera for getting me sorted there!). So there has got to be a solution hidden in here someplace for the ioBroker MQTT instance.

Pasting the rest_command into a web browser works, but the behavior is the same as when I trigger from a button/switch.

HomeBase: the sensor updates and the mode changes (and all is reflected properly in the Eufy App). A win!

Indoor: HA sensor updates based on the value written into ioBroker but the camera’s mode does not actually change. It’s as if the ioBroker can’t talk to the Indoor 2k camera’s station.

EDIT: Disregard all this. Works fine for both Home Base and Indoor 2k cameras. It was a VLAN/ remote site issue.

I’ve got REST switches working half-way. What I mean is, they work great for the HomeBase but do not seem to work for the Indoor cams.

A functioning REST switch seem to require 3 parts:

  1. The sensor
  2. The rest_command
  3. The switch itself that draws from the sensor state and implements the rest_command

Sensor Sample:

sensor:
  - platform: rest
    name: Eufy Home Base Guard Mode
    resource: "http://IP:PORT/getPlainValue/eufy-security.0.T8010XXXXXXXXXXX.station.guard_mode"
    scan_interval: 10
    value_template: >-
      {% set v = value | replace('"', "")|int  %}
      {{ {0: "Away",
          1: "Home",
          2: "Schedule",
          3: "Custom1",
          4: "Custom2",
          5: "Custom3",
          47: "Geofence",
          63: "Disarmed"}[v] | default("Unknown state:" + (value|urlencode)) }}

rest_command Sample: (I’ve only set it up for Home and Disarmed, the two features I use most. But you could set up rest_commands for all the modes identified in the sensor above)

rest_command:
  eufy_home_base_guard_mode_home:
    url: "http://IP:PORT/set/eufy-security.0.T8010XXXXXXXXXXX.station.guard_mode?value=1&ack=false"
  eufy_home_base_guard_mode_disarmed:
    url: "http://IP:PORT/set/eufy-security.0.T8010XXXXXXXXXXX.station.guard_mode?value=63&ack=false"

Switch Sample:

switch:
  - platform: template
    switches:
      give_it_a_name_switch:
        friendly_name: "Give It A Name Switch"
        icon_template: hass:shield-home-outline
        value_template: "{{ is_state('sensor.eufy_d_home_base_guard_mode', 'Home') }}"
        turn_on:
          service: rest_command.eufy_home_base_guard_mode_home
        turn_off:
          service: rest_command.eufy_home_base_guard_mode_disarmed

EDIT: Regarding the rest_commands working on HomeBase but not on indoor cameras. I think it’s possibly (v. likely!) an I.D.-10-T (idiot) error on my part. I thought both devices were configured the same, but they’re not: the HomeBase is on the main network and the indoor cameras are on an isolated IoT VLAN. This is a remote site that is connected to my home network (where I’m running HA and all this stuff) via a site-to-site OpenVPN connection. My home network xxx.xxx.1.xxx can see the remote network xxx.xxx.2.xxx but cannot see the remote IoT VLAN xxx.xxx.40.xxx. So as I see it, there are two possible ways to fix this: 1. get physical access to the remote indoor cameras and change them over to the xxx.xxx.2.xxx network so they can be seen by Home Assistant. Or 2, spin up a ioBroker docker container on the xxx.xxx.2.xxx network that can “see” the IoT VLAN xxx.xxx.40.xxx network and be seen by my HA instance running on xxx.xxx.1.xxx. I’ve wasted a lot of air time here on the HomeBase vs. Indoor cameras (SORRY!!), and I think it’s probably a dum-dum user mistake. Will report back after implementing either 1 or 2. If I’m correct in my assumption that this is the issue, the rest_commands should be working great!

EDIT2: YEP. User error. Spun up a container on the 2.xxx network that can see the 40.xxx network, and I’m now able to change mode for the indoor cameras no problem. Just remapped my configuration.yml entries to the location of the 2.xxx container and good to go. Shoot, I’m sorry everyone for all the back and forth on the indoor cameras not working. They work fine using rest_commands.

made a quick gif of it working, take a look:

Indoor cam

shows off in the android app too actually, but the iobroker value doesnt update back to true when you turn it back on.

ha, and you solved it just as i was showing you it worked…

Glad you figured it out!

When you turn it back on where? In the app? If yes, there is unfortunately as far as I know no realtime notification via P2P or other interfaces, so the ioBroker adapter only recognizes the setting after it performs the “static” refresh (adjustable setting in the adapter; default: every 10 minutes).

@rama3124 I’ve added support for your camera along with support for mine. Very quick turn around from both the guys and you should see the update in supervisor. Grab this and your camera should work. :slight_smile:

1 Like

Thanks Chris, your help is much appreciated. I’m sick of getting notifications to my eufy app every time I step outside and plan to program an automation that only notifies me if no one’s home when the motion is detected

1 Like