New motionEye integration

Hello all,

You may have noticed there’s now a motionEye integration in the new release, that allows automated motionEye camera discovery and streaming.

This is the first part of a move of motionEye functionality from a new “full-featured” custom component into Core. It will take quite a while for the full functionality to get through the Home Assistant codereview process, but in the meantime I wanted to announce the custom component and get some feedback.

The custom component offers:

  • Dynamic motionEye camera addition/removal.
  • View motionEye MJPEG video streams as HA camera entities with no additional configuration.
  • Control major motionEye camera options as HA switch entities.
  • Camera motion detection events, and file (image or movie) storage events propagate into HA events which can be used in automations.
  • Custom services to set camera overlay text, to trigger motionEye snapshots, and to perform arbitrary configured motionEye Action Buttons.
  • View saved movies/images straight from the Home Assistant Media Browser.

Hopefully it will shortly be in the HACS default store, but in the meantime it can be installed via a custom HACS repository (see instructions in README).

Hope it’s useful to you – help me test the custom component!

Thanks.

3 Likes

I saw this in a recent blog post and it’s great to see it become a more seamless integration.

I run MotionEye as an add-on via Supervisor. It’s on the same system as Homeassistant, but in a separate docker container. I can access to the GUI for MotionEye via Ingress.

Is there a way of setup the integration on a local URL? I don’t have my MotionEye exposed to WAN. It’s only accessible via Homeassistant sidebar via Ingress.

Yes. However, documentation for that configuration is currently lacking. This is being discussed here: MotionEye integration not working with Motioneye addon · Issue #50409 · home-assistant/core · GitHub , feel free to watch that bug.

Thanks. How have you got it setup?

You may need to work with @frenck to add the missing credential options and ports to the Add-On if needed.

I have to say that I am really disappointed that neither the custom component or the integration work with the MotionEye Add-On which has been around for a while. But, My cameras are working with a manual config and this looks really promising for the future…

@cdrom1028 I suspect it’ll be easy to get working . Supporting addons wasn’t a priority, as (i) that is not my usecase, and (ii) the core integration is required first in either case. I’ve ordered some new hardware explicitly to get this working with addons if someone doesn’t beat me to it!

@dermotduffy, please understand I am not upset with you at all. This community is so awesome and helpful that it has been quite some time since I ran into any pot-hole at all. I’m sure things will get sorted as they usually do. If I sounded or off tone with you I apologize and thank you for the quick response.

Although I don’t have time to look at the code, I have tons of dev space to help test with including a way to snap-shot and rollback my dev environment cleanly. Just let me know when you are ready and I can have an instance with all the bells and whistles ready to test with functioning camera feeds all ready to go.

No worries at all! Looking forward to the seamless experience between the add-on and the integration.

Thanks for volunteering to test! Keep and eye on that bug for progress if you’d like, and I’ll update this thread as soon as my new hardware arrives and I’ve have a chance to (i) at least document how to get them to play nice, and (ii) maybe find a way to make it seamless.

New release has some new features below – the most exciting being media content-id included in file storage events: Cast your motionEye media as they’re created!

I also got the integration working with the motionEye add-on fairly easily – see section in documentation. Please file an issue against the custom component if that doesn’t work for your add-on configuration, so I can experiment and improve the documentation.

Changes

:rocket: Features

:hammer: Refactoring

:package: Dependencies

2 Likes

I’m trying to use the motioneye core integration with a raspberry pi zero W running motioneyeos.
It seems that it does not work when “Fast Network Camera” is enabled. Camera is detected and added by the integration but there is no picture in HA.
Also, is this integration working with the stream integration? I tried to add the camera to HomeKit but got error telling me that there’s no compatible stream.

I am really trying to find my way.
Can somebody point me in the right direction?
I have set up Frenck’s motioneye server addon which is separate from the integration(right lol?)
I have set up the motion eye integration that is already in the latest Home assistant OS by filling out the users/passwords field (it now accesses Frenck’s addon right lol?)

I can now see the cameras in lovelace (super nice thank you so much).
Are there any sensors that I can automate off of? I’m trying to find them? Do I need the custom HACS version to do that?

Addons: An easy way to run a totally different system/binary/server on Home Assistant OS.
Integration: Code that allows Home Assistant to talk to a huge array of devices/systems (including to those running as addons).

The integration that is part of Home Assistant Core (not the custom HACS version) has more limited functionality, but comes out of the box. All functionality is being migrated from the custom version, to the Core version – then the custom version will be retired. The codereview process is slow, so this is taking quite a while.

You can see the entities that your motionEye integration supports by going:

Home Assistant -> Configuration -> Integrations -> (Click the '<N> devices') link -> (Choose a device)

… this will show you the list of what’s available. With the non-custom version of the integration, this is a few switches. Motion automations may also be triggered by listening for the events that the integration generates. An example of how to do this (for either the default, or custom versions) can be found here: GitHub - dermotduffy/hass-motioneye: motionEye Home Assistant Component

Good luck.

Thank you for your patient clarification

I visited the page in your link(to your Github) prior to posting and looked at the devices(in my install) and their associated entities with your default integration(a few handy switches).
Does the current non custom integration have for example “motioneye.motion_detected” occur in the event bus or is that only in the custom integration?

I’m probably a good example of the kind of guy that the binary sensors that come with the custom integration really help out…but I can learn

The events fire in the same way in both Core and custom versions, right now.

The migration of functionality from custom to Core is now almost complete, so the distinction between the two will be entirely removed once the custom integration is retired.

I’m trying to move over from the HACS version of motion eye integration to the one native one inside the integrations panel. However, I can’t delete the version installed via HACS and I can’t install the native version.

I keep getting this error:

Error occurred loading configuration flow for integration motioneye: cannot import name 'HTTP_NOT_FOUND' from 'homeassistant.const' (/usr/src/homeassistant/homeassistant/const.py)
Error handling request

Traceback (most recent call last):
  File "/usr/local/lib/python3.9/site-packages/aiohttp/web_protocol.py", line 435, in _handle_request
    resp = await request_handler(request)
  File "/usr/local/lib/python3.9/site-packages/aiohttp/web_app.py", line 504, in _handle
    resp = await handler(request)
  File "/usr/local/lib/python3.9/site-packages/aiohttp/web_middlewares.py", line 117, in impl
    return await handler(request)
  File "/usr/src/homeassistant/homeassistant/components/http/security_filter.py", line 60, in security_filter_middleware
    return await handler(request)
  File "/usr/src/homeassistant/homeassistant/components/http/forwarded.py", line 98, 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/auth.py", line 181, in auth_middleware
    return await handler(request)
  File "/usr/src/homeassistant/homeassistant/components/http/view.py", line 137, in handle
    result = await result
  File "/usr/src/homeassistant/homeassistant/components/config/config_entries.py", line 71, in delete
    result = await hass.config_entries.async_remove(entry_id)
  File "/usr/src/homeassistant/homeassistant/config_entries.py", line 831, in async_remove
    await entry.async_remove(self.hass)
  File "/usr/src/homeassistant/homeassistant/config_entries.py", line 487, in async_remove
    component = integration.get_component()
  File "/usr/src/homeassistant/homeassistant/loader.py", line 522, in get_component
    cache[self.domain] = importlib.import_module(self.pkg_path)
  File "/usr/local/lib/python3.9/importlib/__init__.py", line 127, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 1030, in _gcd_import
  File "<frozen importlib._bootstrap>", line 1007, in _find_and_load
  File "<frozen importlib._bootstrap>", line 986, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 680, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 850, in exec_module
  File "<frozen importlib._bootstrap>", line 228, in _call_with_frames_removed
  File "/config/custom_components/motioneye/__init__.py", line 51, in <module>
    from homeassistant.const import (
ImportError: cannot import name 'HTTP_NOT_FOUND' from 'homeassistant.const' (/usr/src/homeassistant/homeassistant/const.py)

That’s an exception from the old now-archived code, and is fully expected (as that code is not maintained, the matching code in Home Assistant Core is maintained). You don’t need to install the native version, it is already installed – you just need to get the old integration removed.

What happens when you try to just delete the old integration from HACS and restart Home Assistant?

Deleting it from HACs seemed to work. Thank you.

1 Like

Hello!

same problem here but cannot remove the integration and if I try to remove the motioneye from hacs it forwards me to first delete the integration. but this does not work.

where can I manually delete the motioneye integration (actually with a “not loaded” label) from the integrations panel.
I also removed the motioneye add-on (or do I still need this?)

thanks in advance

Martin

1 Like

The motionEye integration connects to a motionEye server. Unless you have another motionEye server in your network, you still need the add-on (which contains your motionEye server)

thank you!

yes there is a raspberry pi with motioneye os running and via the add-on I can connect easily. also login via browser works perfect but if I try the integration the authentication is not working.

greez