Eufy Security Integration

Now the doorbell works again, i’m trying to make something like this:

There are a couple of caviats here: p

  • im not sure about the url for the picture if it works
  • im not sure of the uri for the eufy app?

There is still something wrong in my code

alias: Deurbel activatie
  description: "Deurbel notificatie"
  trigger:
    - entity_id: binary_sensor.deurbel_ringing
      platform: state
      to: 'on'
  condition: []
  action:
    - service: notify.mobile_app_smartphone_me
      data:
        message: Er staat iemand aan de voordeur!
        title: Deurbel geactiveerd!
        data:
        image: http://x.x.X.x:8123/api/image_proxy/image.deurbel_event_image?token=f6143dcff7156456213153153435435135a2da946d727&state=unknown"
        priority: high
        ttl: 0
        actions:
          - action: URI
            title: Open Eufy App
            uri: fb1675493782511558://

Quick question, when using the service “generate image” - what happens behind the scenes? Does this activate streaming or is it required to first activate streaming and then trigger the “generate image” service? And secondly, is the image stored anywhere or is this “simply” updating the static image of the camera entity?

Also - is there a way to force update the Event Image? According to bropat’s scheme this should be possible (unless I misunderstood)

An example exists on readme

When streaming is happening, generate image saves a capture of the ongoing stream and store it as camera thumbnail.

This normally happens every 10 seconds when it is streaming but if you want to use the latest one from streaming for your notifications, you should first generate it to let home assistant store the latest one and use it on notification.

There is no way to force cameras to get a fresh image without an event, share with me what you found

Superb thx! Gonna look and do some testing !

Thanks - indeed not possible to force an event, but should be possible to force update the integration to show the last event.

At the moment the Event Image never updates unless the add on is restarted - even an update of the integration doesn’t trigger this - conversely, when the integration is updated the Snapshot of the camera entity reverts back to the image of the “event image”

In my case, last image on doorbell is dated 29 December 3pm; this is not in line with the eufy app. The moment I restart the add-on the image is updated to the last event image in the eufy app. This suggests that the functionality is included in the addon but not invoked by the integration - same discussion on GitHub - I cannot find this last event image sensor you refer to.

Perhaps my automations are useful. First takes a snapshot in case of person motion event or doorbell press and saves to JPEG.

Second triggers notification, both on the Google speakers (home office, time bound) and on the phone - I hope that the person motion picks it up timely for the picture to be refreshed by the time the doorbell is pressed. Ca 75% of time this works…

alias: Doorbell snapshot
description: ""
trigger:
  - platform: state
    entity_id:
      - binary_sensor.doorbell_person_detected
    to: "on"
  - type: running
    platform: device
    device_id: 0370086aa9fa1726253cd745957e53fe
    entity_id: binary_sensor.doorbell_ringing
    domain: binary_sensor
condition: []
action:
  - if:
      - condition: state
        entity_id: sensor.doorbell_stream_status
        state: StreamStatus.IDLE
    then:
      - service: eufy_security.start_p2p_livestream
        data: {}
        target:
          entity_id:
            - camera.doorbell
      - delay:
          hours: 0
          minutes: 0
          seconds: 0
          milliseconds: 750
      - service: camera.snapshot
        data:
          filename: /config/www/doorbell_snapshot.jpg
        target:
          entity_id: camera.doorbell
      - service: eufy_security.stop_p2p_livestream
        data: {}
        target:
          entity_id: camera.doorbell
    else:
      - delay:
          hours: 0
          minutes: 0
          seconds: 0
          milliseconds: 250
      - service: camera.snapshot
        target:
          entity_id: camera.doorbell
        data:
          filename: /config/www/doorbell_snapshot.jpg
mode: parallel
max: 3

Below includes an actionable notification, eg i can trigger an open door action on Nuki. Please ignore for your use case.

alias: Doorbell pressed
description: ""
trigger:
  - platform: state
    entity_id:
      - binary_sensor.doorbell_ringing
    to: "on"
condition: []
action:
  - parallel:
      - service: notify.mobile_app_nokia_7_2
        data:
          message: Someone at the door
          data:
            image: local/doorbell_snapshot.jpg
            actions:
              - action: Open_door
                authenticationRequired: null
                title: Open the front door
      - if:
          - condition: time
            after: "08:00"
            before: "19:00"
            weekday:
              - mon
              - tue
              - wed
              - thu
              - fri
        then:
          - service: media_player.play_media
            data:
              media_content_id: http://local-ha-ipaddress:8123/local/doorbell.mp3
              media_content_type: audio/mp3
            target:
              entity_id:
                - media_player.attic_back_speaker
                - media_player.attic_front_speaker
            enabled: true
mode: single

I would enable debug on add-on and integration and share findings. Integration is actively listening changes coming from add-on and presenting them in home assistant.

Your image might be in a different format than integration is expecting or add-on might be failing to pass it to integration.

Yes, will do that. Do you know how to log the add on for an extended period of time and get access to the full log? For some reason i can only see what’s on screen (which is not much).

Looking at the amount of people who indicate/refer to this there are ample with the same issue I think.

If you have portainer, you can access any container logs from the ui.

If not, you need to access system logs to read them all.

Not sure, if supervisor allows you to access container (add-on) logs without a limitation.

1 Like

On a different note, curious to hear if anyone else experiences the same. I use the poster feature in web-rtc to generate the still image. However when for some reason the camera entity does not contain a valid picture (and this happens a few times per day) It throws up a rather nasty error ultimately resulting in a login fail in turn culminating in a ban.

Anyone else experiencing the same? Wonder if it’s my reverse proxy or webrtc causing this.

Login attempt or request with invalid authentication from Pixel-6.iot (my-ip). Requested URL: '/api/webrtc/ws?authSig=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiIwN2EzMjU4OTM3YzU0N2QzODY5ZGQyYjk5NGEwOTk5NyIsInBhdGgiOiIvYXBpL3dlYnJ0Yy93cyIsInBhcmFtcyI6W10sImlhdCI6MTcwNDAwOTU5MiwiZXhwIjoxNzA0MDA5NjIyfQ.hmFR9LEzfa1wz3XGdnyYZVVO_ODCz7LeSxxNRBW-zwI&poster=image.front_yard_front_event_image'. 
(Mozilla/5.0 (Linux; Android 14; Pixel 6 Build/UQ1A.231205.015; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/120.0.6099.144 Mobile Safari/537.36 Home Assistant/2023.12.4-11898 (Android 14; Pixel 6))
Logger: aiohttp.server
Source: /usr/local/lib/python3.11/site-packages/aiohttp/web_protocol.py:421
First occurred: 29 December 2023 at 16:00:50 (78 occurrences)
Last logged: 09:04:15

Error handling request
Traceback (most recent call last):
  File "/usr/local/lib/python3.11/site-packages/aiohttp/web_protocol.py", line 452, in _handle_request
    resp = await request_handler(request)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/aiohttp/web_app.py", line 543, in _handle
    resp = await handler(request)
           ^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/aiohttp/web_middlewares.py", line 114, in impl
    return await handler(request)
           ^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/http/security_filter.py", line 85, in security_filter_middleware
    return await handler(request)
           ^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/http/forwarded.py", line 227, in forwarded_middleware
    return await handler(request)
           ^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/http/request_context.py", line 28, in request_context_middleware
    return await handler(request)
           ^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/http/ban.py", line 80, in ban_middleware
    return await handler(request)
           ^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/http/auth.py", line 233, in auth_middleware
    return await handler(request)
           ^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/http/headers.py", line 31, in headers_middleware
    response = await handler(request)
               ^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/http/view.py", line 149, in handle
    result = await handler(request, **request.match_info)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/config/custom_components/webrtc/__init__.py", line 253, in get
    return await ws_poster(hass, params)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/config/custom_components/webrtc/__init__.py", line 199, in ws_poster
    image = await camera_get_image(hass, poster)
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/camera/__init__.py", line 210, in async_get_image
    return await _async_get_image(camera, timeout, width, height)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/camera/__init__.py", line 194, in _async_get_image
    raise HomeAssistantError("Unable to get image")
homeassistant.exceptions.HomeAssistantError: Unable to get image

Not facing this issue

Hi @anon63427907

Since the config flow doesn’t work with the 8.0 version, is there a way to set the set the ‘overide names’ of the custom alarm names via a config file or so?

Thanks,
Rien

OK, I was able to reinstall everything following this and I have working video now! But, a couple issues. First is both previews have an error in the upper left (blocking the play and stop buttons) “Can’t get URL for camera.xxx”. Second is that the poster image is odd. For my garage floodlight camera, it’s an event image from a couple days ago, which I guess is somewhat valid as it’s the last “event”. For my doorbell camera though, it’s an image from a year ago! Same image I was getting on the default dashboard before. I’ve obviously had lots of events since then.

Not sure if it matters, but when I go to the WebRTC dashboard on :1984, I can now see the cameras, but none of the streams will play. Odd since they play within HA.

1 Like

To remove the error message (still there but no longer visible) you can use:

style:
  - '.header {display: none}'

The other issue… that is exactly my issue aswell, see earlier post:

I also can’t get it to update other than through a restart of the addon. No clue what is driving this. Still trying to debug. A lot of people seem to have this issue but apparently it does work for fuatakgun. He uses a normal docker container as opposed to a ha addon. Who knows… maybe that is the differentiating factor.

As for the streams, you can not initiate from webrtc. Once activated from ha you can access them through the webrtc portal as well

Interestingly, my garage camera is actually faster in HA than the Eufy app! Both when viewing on my desktop and my phone (verified in split screen view). And more clear! So that’s really nice. Doesn’t seem like audio works on either stream though. Also on desktop I can’t maximize the video to full screen. It just flickers then goes back to normal. Works on mobile though.

Thanks, that style fix worked. For the other issue, I’m also running Eufy Security through a docker container and not addon, so don’t think that’s it! And restarting doesn’t help since I’m stuck with a year old image! Seems like there should be a way to periodically grab an image from the stream in the background to use.

Edit: I re-read your earlier post, and noticed you said restart of the add-on (or in my case eufy security docker) re-loaded the image. And indeed that did work to at least get an image that isn’t a year old! I assume next time I restart HA it will go back to the year old one though.

Ah yeah, that does work. And full screen in desktop works there too.

The camera image will now revert back to the image you have since the most current docker restart. Event image will likely stay as is.

For some reason the push doesn’t work for the image refresh. For a long time we had the same for battery percentage, it only changed on a reload but now it’s working as intended; convinced this can be fixed but my coding is not good at all so will instead debug. Perhaps you can also set debug on and observe what happens when the doorbell is triggered?