Skip to content

Instantly share code, notes, and snippets.

@enegaard
Last active July 24, 2024 16:58
Show Gist options
  • Save enegaard/a57af286205914bd912270c89650fb1b to your computer and use it in GitHub Desktop.
Save enegaard/a57af286205914bd912270c89650fb1b to your computer and use it in GitHub Desktop.
Getting the Raspberry Pi Camera to Work on HASSOS

Getting the Raspberry Pi Camera to Work on HASSOS

Enabling the Raspberry Pi camera on HASSOS installations is unfortunately not as simple as connecting the camera and configuring Home Assistant as described at https://www.home-assistant.io/integrations/rpi_camera.

For the camera to work at all, an alternate firmware needs to be loaded when the Raspberry Pi boots. On Raspberry Pi OS (and many others), the alternate firmware is included with the OS installation image, and switching to the alternate firmware is accomplished by running raspi-config and selecting "Enable Camera" from the menu. HASSOS does not include either the alternate firmware or the raspi-config program, so all of the steps need to be done manually.

The steps below attempt to describe the steps that need to be performed. They have worked for me on a Raspberry Pi 3B+ running HASSOS 4.11 through 4.15. If you have a different setup your mileage may vary (but hopefully you'll get enough hints from the below to get it working).

As of HASSOS 6.0, as mentioned in the closing notes of home-assistant/operating-system#947 on June 17th 2021, the alternate firmware files are automatically included in the builds. Therefore much of this guide is obsolete - only the last two sections need to be followed (enable the camera in config.txt and reboot).

Shortly after HASSOS 6.0 was released, some code change between Home Assistant Core 2021.7.4 and Home Assistant Core 2021.8.1 broke the camera support on HASSOS platforms. A fix was applied and core versions 2021.11.3 and later work once again, so avoid core versions 2021.8.0 through 2021.11.2 to retain a working rpi_camera.

The high-level overview of what needs to be done is:

  • Find the alternate firmware files compatible with the version of HASSOS that you are running or are going to be running after the next reboot.
  • Place the firmware files on a machine that your HASSOS box has scp/sftp access to.
  • Copy the firmware files to the HASSOS addon_core_ssh container.
  • Copy the firmware files to the HASSOS /mnt/boot partition.
  • Edit the HASSOS /mnt/boot/config.txt file to enable the alternate firmware and make other camera related changes.
  • Reboot HASSOS, then configure the camera as documented elsewhere.

Find the correct start_x.elf and fixup_x.dat firmware files

(skip this step on HASSOS 6.0 and later)

Find your HASSOS version if you don't already know it. There are many ways to do this, like looking at the host system information information in the Home Assistant client you use. Another way is to run the following from an SSH connection to Home Assistant:

ha info | grep hassos:

E.g. 4.13

Go to https://github.com/home-assistant/operating-system/blob/HASSOS-VERSION/buildroot/package/rpi-firmware/rpi-firmware.mk

(NOTE: replace HASSOS-VERSION with your version of HASSOS, e.g. https://github.com/home-assistant/operating-system/blob/4.13/buildroot/package/rpi-firmware/rpi-firmware.mk)

The firmware hash is the value of the make variable RPI_FIRMWARE_VERSION

In this example, the firmware hash is: 7caead9416f64b2d33361c703fb243b8e157eba4

Go to https://github.com/raspberrypi/firmware/commit/FIRMWARE-HASH

E.g. https://github.com/raspberrypi/firmware/commit/7caead9416f64b2d33361c703fb243b8e157eba4

And download the start_x.elf and fixup_x.dat files from there. If start_x.elf and fixup_x.dat are NOT in that commit, click on "Browse Files (at this point in history)", navigate to boot/, and download the firmware files from there.

Save both firmware files on a system that your HASSOS box will be able to access with scp or sftp.

Operating System Firmware Hash Firmware Link
4.13 7caead9416f64b2d33361c703fb243b8e157eba4 https://github.com/raspberrypi/firmware/commit/7caead9416f64b2d33361c703fb243b8e157eba4
4.14 7caead9416f64b2d33361c703fb243b8e157eba4 https://github.com/raspberrypi/firmware/commit/7caead9416f64b2d33361c703fb243b8e157eba4
4.15 7caead9416f64b2d33361c703fb243b8e157eba4 https://github.com/raspberrypi/firmware/commit/7caead9416f64b2d33361c703fb243b8e157eba4
4.16 7caead9416f64b2d33361c703fb243b8e157eba4 https://github.com/raspberrypi/firmware/commit/7caead9416f64b2d33361c703fb243b8e157eba4
4.17 7caead9416f64b2d33361c703fb243b8e157eba4 https://github.com/raspberrypi/firmware/commit/7caead9416f64b2d33361c703fb243b8e157eba4
4.18 7caead9416f64b2d33361c703fb243b8e157eba4 https://github.com/raspberrypi/firmware/commit/7caead9416f64b2d33361c703fb243b8e157eba4
4.19 7caead9416f64b2d33361c703fb243b8e157eba4 https://github.com/raspberrypi/firmware/commit/7caead9416f64b2d33361c703fb243b8e157eba4
4.20 7caead9416f64b2d33361c703fb243b8e157eba4 https://github.com/raspberrypi/firmware/commit/7caead9416f64b2d33361c703fb243b8e157eba4
5.0 7caead9416f64b2d33361c703fb243b8e157eba4 https://github.com/raspberrypi/firmware/commit/7caead9416f64b2d33361c703fb243b8e157eba4
5.1 7caead9416f64b2d33361c703fb243b8e157eba4 https://github.com/raspberrypi/firmware/commit/7caead9416f64b2d33361c703fb243b8e157eba4
5.2 7caead9416f64b2d33361c703fb243b8e157eba4 https://github.com/raspberrypi/firmware/commit/7caead9416f64b2d33361c703fb243b8e157eba4
5.3 7caead9416f64b2d33361c703fb243b8e157eba4 https://github.com/raspberrypi/firmware/commit/7caead9416f64b2d33361c703fb243b8e157eba4
5.4 2b41f509710d99758a5b8efa88d95dd0e9169c0a https://github.com/raspberrypi/firmware/commit/2b41f509710d99758a5b8efa88d95dd0e9169c0a
5.5 2ba11f2a07760588546821aed578010252c9ecb3 https://github.com/raspberrypi/firmware/commit/2ba11f2a07760588546821aed578010252c9ecb3
5.6 2ba11f2a07760588546821aed578010252c9ecb3 https://github.com/raspberrypi/firmware/commit/2ba11f2a07760588546821aed578010252c9ecb3
5.7 2ba11f2a07760588546821aed578010252c9ecb3 https://github.com/raspberrypi/firmware/commit/2ba11f2a07760588546821aed578010252c9ecb3
5.8 2ba11f2a07760588546821aed578010252c9ecb3 https://github.com/raspberrypi/firmware/commit/2ba11f2a07760588546821aed578010252c9ecb3
5.9 2ba11f2a07760588546821aed578010252c9ecb3 https://github.com/raspberrypi/firmware/commit/2ba11f2a07760588546821aed578010252c9ecb3
5.10 2ba11f2a07760588546821aed578010252c9ecb3 https://github.com/raspberrypi/firmware/commit/2ba11f2a07760588546821aed578010252c9ecb3
5.11 2ba11f2a07760588546821aed578010252c9ecb3 https://github.com/raspberrypi/firmware/commit/2ba11f2a07760588546821aed578010252c9ecb3
5.12 0d458874a89921fbe460e422b239695e1e101e2b https://github.com/raspberrypi/firmware/commit/0d458874a89921fbe460e422b239695e1e101e2b
5.13 0d458874a89921fbe460e422b239695e1e101e2b https://github.com/raspberrypi/firmware/commit/0d458874a89921fbe460e422b239695e1e101e2b

Copy the firmware files to the HASSOS host

(skip this step on HASSOS 6.0 and later)

This is a two-step process, since the HASSOS host does not have any support for copying remote files directly to the host. Therefore the concept is to copy the firmware files to a container that does have support for remote file transfer, then copy those files to the host using the docker cp command.

Enable camera in config.txt

Connect to the HASSOS host on port 22222, and edit (with "vi") the /mnt/boot/config.txt file as follows.

The camera needs more GPU memory than the default setting provides. Increase the GPU memory to 128 MB where possible by adding the following lines. See https://www.raspberrypi.org/documentation/raspbian/applications/camera.md and https://www.raspberrypi.org/documentation/configuration/config-txt/memory.md for reference.

gpu_mem=128
gpu_mem_256=64
gpu_mem_512=128
gpu_mem_1024=128

Enable the alternate firmware:

# Setting start_x to 1 does exactly the same
# thing as the following 2 lines that are commented
# out, but with reduced risk for errors due to typos
start_x=1
#start_file=start_x.elf
#fixup_file=fixup_x.dat
# The next line is optional, if you don't want the
# red LED on the camera to light while the camera
# is active
disable_camera_led=1

Reboot the HASSOS host and start using the camera

After all of the steps above have been completed, reboot the HASSOS host and continue configuring the camera as documented in https://www.home-assistant.io/integrations/rpi_camera.

@rubinho101
Copy link

I'm not able to show motionEye configuration, but you shouldn't edit a file, try to configure camera from motionEye GUI. In comments above there are lots of unnecessary steps, only 3 steps are really required

At least in my case I had to modify the videodevice property to reflect the correct camera-number to make it work...

@nepozs
Copy link

nepozs commented Jan 11, 2023

At least in my case I had to modify the videodevice property to reflect the correct camera-number to make it work...

I can't say: "editing this file is never needed", maybe in some circumstances really is.

BUT

I've configured many motionEye installations, using different hardware (RPi's 0W2, 3B, 3B+, 4B with different CSI cameras: OmniVision OVxxxx or Sony IMXxxx), different OSes and always proper device was on the list, if camera was properly initialized before (config.txt).
(I'm not sure if it always was something like 'mmal-service', maybe in some configurations it was something like 'bcm-some-number-something', but always list contains unwanted devices with indistinguishable names, so trial and error method is necessary).

@generalbytes
Copy link

Hi,
I just want to share what helped in my case to get RaspberryPi camera working with motioneye:
RaspBerryPI 3 B+
Home Assistant 2023.4.6
Supervisor 2023.04.0
Operating System 10.0
motioneye version: 0.19.1

  1. Install motioneye.
  2. Shutdown HA
  3. Take out SDcard mount it on separate computer.
  4. Modify config.txt by adding:
    gpu_mem=128
    gpu_mem_256=64
    gpu_mem_512=128
    gpu_mem_1024=128
    start_x=1
  5. Insert SDcard back to RPi and start motioneye.
  6. Cameras can be now created. Create V4L2 Camera. Unfortunately motioneye creates /dev/video10 by default. We need to change that to /dev/video0
  7. Shutdown HA
  8. Take out SDcard mount it on separate computer.
  9. Modify etc/motioneye/camera-1.conf from videodevice /dev/video10 to video0
  10. Insert SDcard back to RPi
  11. Start RPi
  12. Camera in motioneye should be now working.

@Dris101
Copy link

Dris101 commented Jun 13, 2023

@generalbytes Thanks for the info on the config.txt setup. Very helpful and worked for me.
@nepozs That was my experience as well. There was an option for me (PI3 with camera module) I think near or at the bottom of the list which worked for me and set /dev/video0 by default without me having to edit camera-1.conf

@csprocket777
Copy link

I'm struggling to install motion-eye on Alpine linux. Does this indicate that my installation method doesn't match the requirements?

@Aljumaili85
Copy link

Hi @nepozs
I Couldn't manage to make it work.
Im using
Home Assistant OS: 11.2
Home Assistant Core: 2023.11.3
on Raspberry Pi 4
I followed the setps to enable the camera from the config.txt but nothing changed motioneye coudnt find it, then some guys @generalbytes
mention to edit the camera config file "camera-1.conf" but unfortunately I am using the Motioneye addon so I cant even find where the camera config file is located. any help will be appreciated. Thanks

@nepozs
Copy link

nepozs commented Dec 5, 2023

Hello @Aljumaili85 , I simply can't support this anymore because I don't use RPi in a real HAOS installation and I have to run test at an additional installation to see if this sollution still works. So in fact I don't know if it still works now (today).

If I will do that, I will only post one piece of information: whether it still works on current versions of HA and HAOS or not (as I only will turn on that RPi with cam and update all software needed).

There may be some tricks you need to do at the MotionEye level, but all the ones that were required to run at the time I described them worked, but read this:
https://gist.github.com/enegaard/a57af286205914bd912270c89650fb1b?permalink_comment_id=4432829#gistcomment-4432829
I've never edited MotionEye files "by hand".


Update (You are really lucky, as I'm home now and I could run that old Raspberry installation and as I haven't used ssd drive for other purpose till now)
Motion_Eye_2023-12-05_13-23

Versions
Home Assistant (core) 2023.8.1
Supervisor 2023.11.6
Operating System (HAOS 64bit for RPi4) 10.3
GUI: 20230802.0 - latest (really latest for combination above :P )
motionEye (addon): 0.19.1

I will try to update now

Edit 2
Still works after Update HAOS to 10.5

Edit 3 (some hours later…)
After update all other addons and custom components (not related to camera at all, but I want them to be actual, because this test installation is really complicated and I want to be working as good as possible after next HA and HAOS updates) still works.
Lots of custom components updated, I have to modify configuration.yaml to have "healthy" configuration (disabled 2 custom components, TBD why I had to do it ).

Edit 4
Updating to HAOS 11.2
after OS update Motion Eye does not want to autostart (maybe I'm too quick? TBD), but after manual start addon still works OK

Edit 5 (some hours later…)
Updating to HA core 2023.11.3 … after all updates - everything related to CSI camera and MotionEye addon still works
motion_eye_works_2023-12-05_17-53
motion_eye_works_2_2023-12-05_17-53

Edit 6
Current configurations:
Settings -> System -> Repairs -> "hamburger" menu -> System information -> (popup) System information -> COPY
(and paste clipboard content as is)

System Information

version core-2023.11.3
installation_type Home Assistant OS
dev false
hassio true
docker true
user root
virtualenv false
python_version 3.11.6
os_name Linux
os_version 6.1.58-haos-raspi
arch aarch64
timezone Europe/Warsaw
config_dir /config
Home Assistant Community Store
GitHub API ok
GitHub Content ok
GitHub Web ok
GitHub API Calls Remaining 5000
Installed Version 1.33.0
Stage running
Available Repositories 1418
Downloaded Repositories 59
Home Assistant Cloud
logged_in false
can_reach_cert_server ok
can_reach_cloud_auth ok
can_reach_cloud ok
GIOŚ
can_reach_server ok
Home Assistant Supervisor
host_os Home Assistant OS 11.2
update_channel stable
supervisor_version supervisor-2023.11.6
agent_version 1.6.0
docker_version 24.0.7
disk_total 234.0 GB
disk_used 40.0 GB
healthy true
supported true
board rpi4-64
supervisor_api ok
version_api ok
installed_addons Mosquitto broker (6.4.0), File editor (5.7.0), Samba share (12.2.0), Terminal & SSH (9.8.1), Emulated HUE (0.3.0), ZeroTier One (0.17.3), Z-Wave JS (0.4.1), Studio Code Server (5.14.2), VLC (0.2.0), Glances (0.20.0), Local VLC (18), HDD Tools (1.1.0), Tailscale (0.13.1), Advanced SSH & Web Terminal (16.0.2), Zigbee2MQTT (1.34.0-1), Grafana (9.1.1), eWeLink Smart Home (1.4.3), ESPHome (2023.11.6), Simple Scheduler (2.11), LFTP Mirror (1.0.3), Node-RED (16.0.2), Scrutiny (Full Access) (v0.7.2-3), Zigbee2MQTT (1.34.0-1), Zigbee2MQTT (1.34.0-1), Nextcloud (27.1.4-5), Whoogle Search (0.8.4-3), Run On Startup.d (0.11a), Matter Server (4.10.2), motionEye (0.19.1), Piper (1.4.0)
Dashboards
dashboards 2
resources 33
views 17
mode storage
Recorder
oldest_recorder_run 13 lipca 2023 10:54
current_recorder_run 5 grudnia 2023 16:59
estimated_db_size 469.62 MiB
database_engine sqlite
database_version 3.41.2

my latest config.txt (file on the boot partition), slighly modified because I've used the same ssd with specific board for CM4 (it is installation really for experiments), but I've deleted all unnecessary settings for RPi4B
if your file is somehow different I want see it

# For more options and information see
# http://rpf.io/configtxt
# Some settings may impact device functionality. See link above for details

# HAOS - don't change it!
disable_splash=1
kernel=u-boot.bin

# uncomment for aarch64 bit support
arm_64bit=1

# uncomment to enable primary UART console
#enable_uart=1

# uncomment if you get no picture on HDMI for a default "safe" mode
#hdmi_safe=1

# uncomment this if your display has a black border of unused pixels visible
# and your display can output without overscan
#disable_overscan=1

# uncomment the following to adjust overscan. Use positive numbers if console
# goes off screen, and negative if there is too much border
#overscan_left=16
#overscan_right=16
#overscan_top=16
#overscan_bottom=16

# uncomment to force a console size. By default it will be display's size minus
# overscan.
#framebuffer_width=1280
#framebuffer_height=720

# uncomment if hdmi display is not detected and composite is being output
#hdmi_force_hotplug=1

# uncomment to force a specific HDMI mode (this will force VGA)
#hdmi_group=1
#hdmi_mode=1

# uncomment to force a HDMI mode rather than DVI. This can make audio work in
# DMT (computer monitor) modes
#hdmi_drive=2

# uncomment to increase signal to HDMI, if you have interference, blanking, or
# no display
#config_hdmi_boost=4

# uncomment for composite PAL
#sdtv_mode=2

# Uncomment to disable continous SD-card poll (for USB SSD)
#dtparam=sd_poll_once=on

# Uncomment some or all of these to enable the optional hardware interfaces
#dtparam=i2c_arm=on
#dtparam=i2s=on
#dtparam=spi=on

# Uncomment this to enable the lirc-rpi module
#dtoverlay=lirc-rpi

# Uncomment this to enable GPIO support for RPI-RF-MOD/HM-MOD-RPI-PCB
#enable_uart=1
#dtparam=i2c_arm=on
#dtoverlay=miniuart-bt
#dtoverlay=rpi-rf-mod

# Additional overlays and parameters are documented /boot/overlays/README

# Enable audio (loads snd_bcm2835)
########################################################################
# disable = comment out audio for MirkoPC board only (zakomentowac dla MirkoPC)
dtparam=audio=on

[all]
#dtoverlay=vc4-fkms-v3d
#max_framebuffers=2

gpu_mem=128
gpu_mem_256=64
gpu_mem_512=128
gpu_mem_1024=128

# Setting start_x to 1 does exactly the same
# thing as the following 2 lines that are commented
# out, but with reduced risk for errors due to typos
start_x=1
#start_file=start_x.elf
#fixup_file=fixup_x.dat
# The next line is optional, if you don't want the
# red LED on the camera to light while the camera
# is active
disable_camera_led=1

@nepozs
Copy link

nepozs commented Dec 5, 2023

PS Everything works for me, so I will definitely end supporting this tutorial forever for people writing "help, I have did everything and it do not work" if they do not provide really precise description of steps, configuration and files contents.

Hardware configuration also must be tested before (I use OV5647 camera based, for models with different image sensors configuration in MotionEye may be different)
Suggested environment to test - MotionEyeOS (it is old project, but camera should work - if camera does not work in dedicated OS, it probably won't work using HAOS)
https://github.com/motioneye-project/motioneyeos
but OFC camera could be tested using RPiOS.

PPS Do not try to do it using Cloudflared tunnel, it just do not work (video streaming is forbidden), so if you need remote access use ZeroTier One or Tailscale (both work), but I suggest running locally and try to use remote access only if camera is fully functional.

@Aljumaili85
Copy link

@nepozs , it was really nice of you , Thank you very much.

@Aljumaili85
Copy link

Aljumaili85 commented Dec 7, 2023

Update:
Finally I managed to make it works, I had doubts that there was a camera hardware issue so I recover an old raspbian image where everything was working fine.
anyway I just wanted to show the last lines of the config file, which it might be helpful for someone else.
Last lines of the config.txt (on the boot partition) looks like this :

[pi4]
#Enable DRM VC4 V3D driver on top of the dispmanx display stack
dtoverlay=vc4-fkms-v3d
max_framebuffers=2

[all]
#dtoverlay=vc4-fkms-v3d
start_x=1
gpu_mem=128

@nepozs
Copy link

nepozs commented Dec 7, 2023

In reality only important lines really necessary for working camera

[all]
start_x=1
gpu_mem=128

all others are for different purposes or backward compatibility with old models of RPi
(but there is no sense to run HAOS on models older than RPi4B )

BUT never delete existing lines even if commented out

@jose1711
Copy link

Thank you for this tutorial. Sadly I did not get far trying to make my ov5647 camera work with Raspberry Pi 5. HA OS: 12.1, HA core 2024.4.0. Using Advanced SSH & Web terminal to interact with the HA OS directly over SSH session.

motionEye lists the following devices (multiple instances): pispbe, rp1-cfe, rpivid. None of the entries however seems to work.

Things tried so far

Based on the latest comments I put (appended) the following into config.txt:

[all]
start_x=1
gpu_mem=128

I haven't spotted any change though once booted with these options.

Test in Raspbian (making sure this is not a hw issue)

The camera is properly detected in Raspbian:

root@raspberrypi:/# libcamera-hello --list-cameras
Available cameras
-----------------
0 : ov5647 [2592x1944 10-bit GBRG] (/base/axi/pcie@120000/rp1/i2c@88000/ov5647@36)
    Modes: 'SGBRG10_CSI2P' : 640x480 [58.92 fps - (16, 0)/2560x1920 crop]
                             1296x972 [43.25 fps - (0, 0)/2592x1944 crop]
                             1920x1080 [30.62 fps - (348, 434)/1928x1080 crop]
                             2592x1944 [15.63 fps - (0, 0)/2592x1944 crop]

Attempt to get the same output in HA OS

I am trying to use an equivalent in HA OS, but did not find libcamera-hello, seems like cam (added to HA OS via apk add libcamera-tools) serves as an equivalent. The output is empty.

$ cam -l
[0:11:40.515516942] [485]  INFO Camera camera_manager.cpp:284 libcamera v0.1.0
Available cameras:
$

When switched inside motionEye container I see the following v4l2-ctl devices:

$ v4l2-ctl  --list-devices
pispbe (platform:1000880000.pisp_be):
	/dev/video20
	/dev/video21
	/dev/video22
	/dev/video23
	/dev/video24
	/dev/video25
	/dev/video26
	/dev/video27
	/dev/video28
	/dev/video29
	/dev/video30
	/dev/video31
	/dev/video32
	/dev/video33
	/dev/video34
	/dev/video35
	/dev/video36
	/dev/video37
	/dev/media1
	/dev/media3

rp1-cfe (platform:1f00110000.csi):
	/dev/video0
	/dev/video1
	/dev/video2
	/dev/video3
	/dev/video4
	/dev/video5
	/dev/video6
	/dev/video7
	/dev/media0

rpivid (platform:rpivid):
	/dev/video19
	/dev/media2

Iterating across the whole list and retrieving their controls:

$ for i in /dev/video* /dev/media*; do echo $i; v4l2-ctl -ld $i; done
/dev/video0
/dev/video1
/dev/video19

Stateless Codec Controls

    hevc_sequence_parameter_set 0x00a40a90 (hevc-sps): value=unsupported payload type flags=has-payload
     hevc_picture_parameter_set 0x00a40a91 (hevc-sps): value=unsupported payload type flags=has-payload
              slice_param_array 0x00a40a92 (hevc-slice-params): elems=1 dims=[4096] flags=has-payload, dynamic-array
            hevc_scaling_matrix 0x00a40a93 (hevc-scaling-matrix): value=unsupported payload type flags=has-payload
         hevc_decode_parameters 0x00a40a94 (hevc-decode-params): value=unsupported payload type flags=has-payload
               hevc_decode_mode 0x00a40a95 (menu)   : min=0 max=0 default=0 value=0 (Slice-Based)
                hevc_start_code 0x00a40a96 (menu)   : min=0 max=1 default=0 value=0 (No Start Code)
/dev/video2
/dev/video20
/dev/video21
/dev/video22
/dev/video23
/dev/video24
/dev/video25
/dev/video26
/dev/video27
/dev/video28
/dev/video29
/dev/video3
/dev/video30
/dev/video31
/dev/video32
/dev/video33
/dev/video34
/dev/video35
/dev/video36
/dev/video37
/dev/video4
/dev/video5
/dev/video6
/dev/video7
/dev/media0
Unable to detect what device /dev/media0 is, exiting.
/dev/media1
Unable to detect what device /dev/media1 is, exiting.
/dev/media2
Unable to detect what device /dev/media2 is, exiting.
/dev/media3
Unable to detect what device /dev/media3 is, exiting.

Could someone please confirm that cam ran inside ssh session works for him/her and/or provide any clues (not sure if anyone has tested with Rpi 5 yet). Thanks.

@ctournayre
Copy link

Someone succeeded on a Rpi5 ?

@styoe
Copy link

styoe commented Jun 13, 2024

RPI3B + HaOS 2024 here.

  1. First you need to edit the config.txt via ssh
    https://developers.home-assistant.io/docs/operating-system/debugging/#generating-ssh-keys

  2. Once ssh works, you will find there is no editor on HaOS, so it might be best to copy it with scp
    scp -P 22222 root@home.local:/mnt/boot/config.txt /home/myname/Desktop/
    edit the file and add:
    gpu_mem=128
    gpu_mem_256=64
    gpu_mem_512=128
    gpu_mem_1024=128
    start_x=1
    Now copy it back
    scp -P 22222 /home/myname/Desktop/config.txt root@home.local:/mnt/boot/

  3. Now reboot your RPI

  4. Install motioneye plugin and add your camera with V4L2 Camera type (it wont work yet)

  5. SSH back into your rpi, and run docker ps

  6. Find the motioneye container (something like addon_a0d7b954_motioneye) and exec into it: docker exec -it addon_a0d7b954_motioneye bash

  7. Once in container, cd into /data/motioneye and there should be a camera-1.conf file there

  8. Open it (You should have apk now so you can install apk add nano) and change video_device /dev/video10 to /dev/video0

  9. Save the file, restart the MotionEye plugin and Voila! the video will appear :)

Massive thank you to all of the guys above, would have never figured it out on my own.

p.s.
Make sure you have aded
rpi_camera:
To your HaOS configuration.yaml

@jose1711
Copy link

@styoe Thank you for sharing, sadly your steps does not work on Rpi5 (added and modified camera configuration still results in no image). I am also wondering why rpi_camera integration is required since on its page it says:

This integration is only available on Home Assistant Core installation types. Unfortunately, it cannot be used with Home Assistant OS, Supervised or Container.

@jose1711
Copy link

Someone succeeded on a Rpi5 ?

I haven't (see this)

@TheLazyHatGuy
Copy link

Has anyone got the working on a Pi4 with Home Assistant OS 12.4?
I have motioneye setup targeting /dev/video0 but I just get UNABLE TO OPEN VIDEO DEVICE

@nepozs
Copy link

nepozs commented Jul 24, 2024

@TheLazyHatGuy nothing changed on a RPi4 with HAOS 12.4 and HA core 2024.3.3 (and after update to 2024.7.3 because I took it out of the drawer especially for you, so don't be lazy it still works)
HAOS-12-4-2024-07-23_23-52

@TheLazyHatGuy
Copy link

@nepozs Bruh I'm not being lazy. I was at this for over 4 hours with motionEye not able to access my camera
By all means, maybe you can tell when I missed

# cat /mnt/boot/config.txt 
# For more options and information see
# http://rpf.io/configtxt
# Some settings may impact device functionality. See link above for details

# HAOS - don't change it!
disable_splash=1
kernel=u-boot.bin

# uncomment for aarch64 bit support
arm_64bit=1

# uncomment to enable primary UART console
#enable_uart=1

# uncomment if you get no picture on HDMI for a default "safe" mode
#hdmi_safe=1

# uncomment this if your display has a black border of unused pixels visible
# and your display can output without overscan
#disable_overscan=1

# uncomment the following to adjust overscan. Use positive numbers if console
# goes off screen, and negative if there is too much border
#overscan_left=16
#overscan_right=16
#overscan_top=16
#overscan_bottom=16

# uncomment to force a console size. By default it will be display's size minus
# overscan.
#framebuffer_width=1280
#framebuffer_height=720

# uncomment if hdmi display is not detected and composite is being output
#hdmi_force_hotplug=1

# uncomment to force a specific HDMI mode (this will force VGA)
#hdmi_group=1
#hdmi_mode=1

# uncomment to force a HDMI mode rather than DVI. This can make audio work in
# DMT (computer monitor) modes
#hdmi_drive=2

# uncomment to increase signal to HDMI, if you have interference, blanking, or
# no display
#config_hdmi_boost=4

# uncomment for composite PAL
#sdtv_mode=2

# Uncomment to disable continous SD-card poll (for USB SSD)
#dtparam=sd_poll_once=on

# Uncomment some or all of these to enable the optional hardware interfaces
#dtparam=i2c_arm=on
#dtparam=i2s=on
#dtparam=spi=on

# Uncomment this to enable the lirc-rpi module
#dtoverlay=lirc-rpi

# Uncomment this to enable GPIO support for RPI-RF-MOD/HM-MOD-RPI-PCB
#enable_uart=1
#dtparam=i2c_arm=on
#dtoverlay=miniuart-bt
#dtoverlay=rpi-rf-mod

# Additional overlays and parameters are documented /boot/overlays/README

# Enable audio (loads snd_bcm2835)
dtparam=audio=on

[pi4]
# Enable DRM VC4 V3D driver on top of the dispmanx display stack
dtoverlay=vc4-fkms-v3d
max_framebuffers=2
# Enable boost from 1.5Ghz to 1.8Ghz on compatible models
arm_boost=1

[all]
start_x=1
gpu_mem=128
#dtoverlay=vc4-fkms-v3d
#max_framebuffers=2
# 
# docker exec -it addon_a0d7b954_motioneye bash
root@a0d7b954-motioneye:/$ for i in /dev/video* /dev/media*; do echo ====== $i ======; v4l2-ctl -ld $i; done
====== /dev/video0 ======

User Controls

                     brightness 0x00980900 (int)    : min=0 max=100 step=1 default=50 value=50 flags=slider
                       contrast 0x00980901 (int)    : min=-100 max=100 step=1 default=0 value=0 flags=slider
                     saturation 0x00980902 (int)    : min=-100 max=100 step=1 default=0 value=0 flags=slider
                    red_balance 0x0098090e (int)    : min=1 max=7999 step=1 default=1000 value=1000 flags=slider
                   blue_balance 0x0098090f (int)    : min=1 max=7999 step=1 default=1000 value=1000 flags=slider
                horizontal_flip 0x00980914 (bool)   : default=0 value=0
                  vertical_flip 0x00980915 (bool)   : default=0 value=0
           power_line_frequency 0x00980918 (menu)   : min=0 max=3 default=1 value=1 (50 Hz)
                      sharpness 0x0098091b (int)    : min=-100 max=100 step=1 default=0 value=0 flags=slider
                  color_effects 0x0098091f (menu)   : min=0 max=15 default=0 value=0 (None)
                         rotate 0x00980922 (int)    : min=0 max=360 step=90 default=0 value=0 flags=modify-layout
             color_effects_cbcr 0x0098092a (int)    : min=0 max=65535 step=1 default=32896 value=32896

Codec Controls

             video_bitrate_mode 0x009909ce (menu)   : min=0 max=1 default=0 value=0 (Variable Bitrate) flags=update
                  video_bitrate 0x009909cf (int)    : min=25000 max=25000000 step=25000 default=10000000 value=10000000
         repeat_sequence_header 0x009909e2 (bool)   : default=0 value=0
                force_key_frame 0x009909e5 (button) : value=0 flags=write-only, execute-on-write
          h264_minimum_qp_value 0x00990a61 (int)    : min=0 max=51 step=1 default=0 value=0
          h264_maximum_qp_value 0x00990a62 (int)    : min=0 max=51 step=1 default=0 value=0
            h264_i_frame_period 0x00990a66 (int)    : min=0 max=2147483647 step=1 default=60 value=60
                     h264_level 0x00990a67 (menu)   : min=0 max=13 default=11 value=11 (4)
                   h264_profile 0x00990a6b (menu)   : min=0 max=4 default=4 value=4 (High)

Camera Controls

                  auto_exposure 0x009a0901 (menu)   : min=0 max=3 default=0 value=0 (Auto Mode)
         exposure_time_absolute 0x009a0902 (int)    : min=1 max=10000 step=1 default=1000 value=1000
     exposure_dynamic_framerate 0x009a0903 (bool)   : default=0 value=0
             auto_exposure_bias 0x009a0913 (intmenu): min=0 max=24 default=12 value=12 (0 0x0)
      white_balance_auto_preset 0x009a0914 (menu)   : min=0 max=10 default=1 value=1 (Auto)
            image_stabilization 0x009a0916 (bool)   : default=0 value=0
                iso_sensitivity 0x009a0917 (intmenu): min=0 max=4 default=0 value=0 (0 0x0)
           iso_sensitivity_auto 0x009a0918 (menu)   : min=0 max=1 default=1 value=1 (Auto)
         exposure_metering_mode 0x009a0919 (menu)   : min=0 max=3 default=0 value=0 (Average)
                     scene_mode 0x009a091a (menu)   : min=0 max=13 default=0 value=0 (None)

JPEG Compression Controls

            compression_quality 0x009d0903 (int)    : min=1 max=100 step=1 default=30 value=30

and my camera config

root@a0d7b954-motioneye:/$ cat /data/motioneye/camera-1.conf
# @enabled on
# @id 1
# @storage_device custom-path
# @network_server 
# @network_share_name 
# @network_smb_ver 1.0
# @network_username 
# @network_password 
# @upload_enabled off
# @upload_picture on
# @upload_movie on
# @upload_service ftp
# @upload_server 
# @upload_port 
# @upload_method post
# @upload_location 
# @upload_subfolders on
# @upload_username 
# @upload_password 
# @upload_endpoint_url 
# @upload_access_key 
# @upload_secret_key 
# @upload_bucket 
# @clean_cloud_enabled off
# @webcam_resolution 100
# @webcam_server_resize off
# @motion_detection on
# @preserve_pictures 0
# @manual_snapshots on
# @preserve_movies 0
# @manual_record off
# @working_schedule 
# @working_schedule_type outside
# @lang en


width 320
height 200
camera_name Camera1
auto_brightness off
framerate 2
rotate 0
mask_privacy 
target_dir /share/motioneye/Camera1
stream_localhost off
stream_port 9081
stream_maxrate 5
stream_quality 85
stream_motion off
stream_auth_method 0
text_left Camera1
text_right %Y-%m-%d\n%T
text_scale 1
text_changes off
locate_motion_mode off
locate_motion_style redbox
threshold 2000
threshold_maximum 0
threshold_tune off
noise_tune on
noise_level 31
lightswitch_percent 0
despeckle_filter 
minimum_motion_frames 20
smart_mask_speed 0
mask_file 
movie_output_motion off
picture_output_motion off
pre_capture 1
post_capture 1
picture_output off
picture_filename 
emulate_motion off
event_gap 30
snapshot_interval 0
snapshot_filename 
picture_quality 85
movie_filename %Y-%m-%d/%H-%M-%S
movie_max_time 0
movie_output off
movie_passthrough off
movie_codec mp4:h264_v4l2m2m
movie_quality 75
on_event_start /usr/lib/python3.11/site-packages/motioneye/scripts/relayevent.sh "/data/motioneye/motioneye.conf" start %t
on_event_end /usr/lib/python3.11/site-packages/motioneye/scripts/relayevent.sh "/data/motioneye/motioneye.conf" stop %t
on_movie_end /usr/lib/python3.11/site-packages/motioneye/scripts/relayevent.sh "/data/motioneye/motioneye.conf" movie_end %t %f
on_picture_save /usr/lib/python3.11/site-packages/motioneye/scripts/relayevent.sh "/data/motioneye/motioneye.conf" picture_save %t %f
stream_authentication user:
video_device /dev/video0
video_params auto_exposure=0,auto_exposure_bias=12,blue_balance=1000,brightness=50,color_effects=0,color_effects_cbcr=32896,compression_quality=30,contrast=0,exposure_metering_mode=0,exposure_time_absolute=1000,h264_i_frame_period=60,h264_level=11,h264_maximum_qp_value=0,h264_minimum_qp_value=0,h264_profile=4,iso_sensitivity=0,iso_sensitivity_auto=1,power_line_frequency=1,red_balance=1000,rotate=0,saturation=0,scene_mode=0,sharpness=0,video_bitrate=10000000,video_bitrate_mode=0,white_balance_auto_preset=1

@Aljumaili85
Copy link

I managed to make it working before but after some updates it stopped working again ... @nepozs Man you have the best config that resist all the updates :)

@nepozs
Copy link

nepozs commented Jul 24, 2024

@TheLazyHatGuy
I'm sorry, it was a bad joke…
@Aljumaili85
It isn't best, just working, after last addon update I had to configure it from scratch, but it is still working.

my camera is OV5647 based and standard RPi4B 4GB RAM (some parts of my config.txt are dedicated to mainboard MirkoPC+CM4, but the config below is for common 4B)

just to compare

# For more options and information see
# http://rpf.io/configtxt
# Some settings may impact device functionality. See link above for details

# HAOS - don't change it!
disable_splash=1
kernel=u-boot.bin

# uncomment for aarch64 bit support
arm_64bit=1

# uncomment to enable primary UART console
#enable_uart=1

# uncomment if you get no picture on HDMI for a default "safe" mode
#hdmi_safe=1

# uncomment this if your display has a black border of unused pixels visible
# and your display can output without overscan
#disable_overscan=1

# uncomment the following to adjust overscan. Use positive numbers if console
# goes off screen, and negative if there is too much border
#overscan_left=16
#overscan_right=16
#overscan_top=16
#overscan_bottom=16

# uncomment to force a console size. By default it will be display's size minus
# overscan.
#framebuffer_width=1280
#framebuffer_height=720

# uncomment if hdmi display is not detected and composite is being output
#hdmi_force_hotplug=1

# uncomment to force a specific HDMI mode (this will force VGA)
#hdmi_group=1
#hdmi_mode=1

# uncomment to force a HDMI mode rather than DVI. This can make audio work in
# DMT (computer monitor) modes
#hdmi_drive=2

# uncomment to increase signal to HDMI, if you have interference, blanking, or
# no display
#config_hdmi_boost=4

# uncomment for composite PAL
#sdtv_mode=2

# Uncomment to disable continous SD-card poll (for USB SSD)
#dtparam=sd_poll_once=on

# Uncomment some or all of these to enable the optional hardware interfaces
#dtparam=i2c_arm=on
#dtparam=i2s=on
#dtparam=spi=on

# Uncomment this to enable the lirc-rpi module
#dtoverlay=lirc-rpi

# Uncomment this to enable GPIO support for RPI-RF-MOD/HM-MOD-RPI-PCB
#enable_uart=1
#dtparam=i2c_arm=on
#dtoverlay=miniuart-bt
#dtoverlay=rpi-rf-mod

# Additional overlays and parameters are documented /boot/overlays/README

# Enable audio (loads snd_bcm2835)
########################################################################
# disable-zakomentowac dla MirkoPC
dtparam=audio=on

[all]
#dtoverlay=vc4-fkms-v3d
#max_framebuffers=2

gpu_mem=128
gpu_mem_256=64
gpu_mem_512=128
gpu_mem_1024=128

# Setting start_x to 1 does exactly the same
# thing as the following 2 lines that are commented
# out, but with reduced risk for errors due to typos
start_x=1
#start_file=start_x.elf
#fixup_file=fixup_x.dat
# The next line is optional, if you don't want the
# red LED on the camera to light while the camera
# is active
disable_camera_led=1

###########################################################################
# below only for Mirko PC odkomentować wszystko + wyzej też jedna zmiana - audio zakomentować

# uncomment if hdmi display is not detected and composite is being output
hdmi_force_hotplug=1

#usb
#dtoverlay=dwc2,dr_mode=host

#IR receiver
#dtoverlay=gpio-ir,gpio_pin=17


#I2S DAC
#dtparam=i2s=on
#dtoverlay=hifiberry-dac
#dtdebug=1
for i in /dev/video* /dev/media*; do echo ====== $i ======; v4l2-ctl -ld $i; done
====== /dev/video0 ======                                                                                                                                                      
                                                                                                                                                                               
User Controls                                                                                                                                                                  
                                                                                                                                                                               
                     brightness 0x00980900 (int)    : min=0 max=100 step=1 default=50 value=50 flags=slider                                                                    
                       contrast 0x00980901 (int)    : min=-100 max=100 step=1 default=0 value=0 flags=slider                                                                   
                     saturation 0x00980902 (int)    : min=-100 max=100 step=1 default=0 value=0 flags=slider                                                                   
                    red_balance 0x0098090e (int)    : min=1 max=7999 step=1 default=1000 value=1000 flags=slider                                                               
                   blue_balance 0x0098090f (int)    : min=1 max=7999 step=1 default=1000 value=1000 flags=slider                                                               
                horizontal_flip 0x00980914 (bool)   : default=0 value=0                                                                                                        
                  vertical_flip 0x00980915 (bool)   : default=0 value=0                                                                                                        
           power_line_frequency 0x00980918 (menu)   : min=0 max=3 default=1 value=1 (50 Hz)                                                                                    
                      sharpness 0x0098091b (int)    : min=-100 max=100 step=1 default=0 value=0 flags=slider                                                                   
                  color_effects 0x0098091f (menu)   : min=0 max=15 default=0 value=0 (None)                                                                                    
                         rotate 0x00980922 (int)    : min=0 max=360 step=90 default=0 value=0 flags=modify-layout                                                              
             color_effects_cbcr 0x0098092a (int)    : min=0 max=65535 step=1 default=32896 value=32896                                                                         
                                                                                                                                                                               
Codec Controls

             video_bitrate_mode 0x009909ce (menu)   : min=0 max=1 default=0 value=0 (Variable Bitrate) flags=update
                  video_bitrate 0x009909cf (int)    : min=25000 max=25000000 step=25000 default=10000000 value=10000000
         repeat_sequence_header 0x009909e2 (bool)   : default=0 value=0
                force_key_frame 0x009909e5 (button) : value=0 flags=write-only, execute-on-write
          h264_minimum_qp_value 0x00990a61 (int)    : min=0 max=51 step=1 default=0 value=0
          h264_maximum_qp_value 0x00990a62 (int)    : min=0 max=51 step=1 default=0 value=0
            h264_i_frame_period 0x00990a66 (int)    : min=0 max=2147483647 step=1 default=60 value=60
                     h264_level 0x00990a67 (menu)   : min=0 max=13 default=11 value=11 (4)
                   h264_profile 0x00990a6b (menu)   : min=0 max=4 default=4 value=4 (High)
Camera Controls

                  auto_exposure 0x009a0901 (menu)   : min=0 max=3 default=0 value=0 (Auto Mode)
         exposure_time_absolute 0x009a0902 (int)    : min=1 max=10000 step=1 default=1000 value=1000
     exposure_dynamic_framerate 0x009a0903 (bool)   : default=0 value=0
             auto_exposure_bias 0x009a0913 (intmenu): min=0 max=24 default=12 value=12 (0 0x0)
      white_balance_auto_preset 0x009a0914 (menu)   : min=0 max=10 default=1 value=1 (Auto)
            image_stabilization 0x009a0916 (bool)   : default=0 value=0
                iso_sensitivity 0x009a0917 (intmenu): min=0 max=4 default=0 value=0 (0 0x0)
           iso_sensitivity_auto 0x009a0918 (menu)   : min=0 max=1 default=1 value=1 (Auto)
         exposure_metering_mode 0x009a0919 (menu)   : min=0 max=3 default=0 value=0 (Average)
                     scene_mode 0x009a091a (menu)   : min=0 max=13 default=0 value=0 (None)

JPEG Compression Controls

            compression_quality 0x009d0903 (int)    : min=1 max=100 step=1 default=30 value=30
====== /dev/video10 ======

User Controls

  min_number_of_capture_buffers 0x00980927 (int)    : min=1 max=1 step=1 default=1 value=1 flags=read-only

Codec Controls

                     h264_level 0x00990a67 (menu)   : min=0 max=13 default=11 value=11 (4) flags=read-only
                   h264_profile 0x00990a6b (menu)   : min=0 max=4 default=4 value=4 (High) flags=read-only
====== /dev/video11 ======
Codec Controls

                 video_b_frames 0x009909ca (int)    : min=0 max=0 step=1 default=0 value=0 flags=update
                 video_gop_size 0x009909cb (int)    : min=0 max=2147483647 step=1 default=60 value=60
             video_bitrate_mode 0x009909ce (menu)   : min=0 max=1 default=0 value=0 (Variable Bitrate) flags=update
                  video_bitrate 0x009909cf (int)    : min=25000 max=25000000 step=25000 default=10000000 value=10000000
           sequence_header_mode 0x009909d8 (menu)   : min=0 max=1 default=1 value=1 (Joined With 1st Frame)
         repeat_sequence_header 0x009909e2 (bool)   : default=0 value=0
                force_key_frame 0x009909e5 (button) : value=0 flags=write-only, execute-on-write
          h264_minimum_qp_value 0x00990a61 (int)    : min=0 max=51 step=1 default=20 value=20
          h264_maximum_qp_value 0x00990a62 (int)    : min=0 max=51 step=1 default=51 value=51
            h264_i_frame_period 0x00990a66 (int)    : min=0 max=2147483647 step=1 default=60 value=60
                     h264_level 0x00990a67 (menu)   : min=0 max=15 default=11 value=11 (4)
                   h264_profile 0x00990a6b (menu)   : min=0 max=4 default=4 value=4 (High)
====== /dev/video12 ======

User Controls

                horizontal_flip 0x00980914 (bool)   : default=0 value=0
                  vertical_flip 0x00980915 (bool)   : default=0 value=0
====== /dev/video13 ======

User Controls

                    red_balance 0x0098090e (int)    : min=1 max=65535 step=1 default=1000 value=1000 flags=slider
                   blue_balance 0x0098090f (int)    : min=1 max=65535 step=1 default=1000 value=1000 flags=slider
       colour_correction_matrix 0x009819e1 (u8)     : min=0 max=255 step=1 default=0 dims=[88] flags=has-payload
                   lens_shading 0x009819e2 (u8)     : min=0 max=255 step=1 default=0 dims=[36] flags=has-payload, execute-on-write
                    black_level 0x009819e3 (u8)     : min=0 max=255 step=1 default=0 dims=[12] flags=has-payload
             green_equalisation 0x009819e4 (u8)     : min=0 max=255 step=1 default=0 dims=[16] flags=has-payload
                          gamma 0x009819e5 (u8)     : min=0 max=255 step=1 default=0 dims=[136] flags=has-payload
                        denoise 0x009819e6 (u8)     : min=0 max=255 step=1 default=0 dims=[24] flags=has-payload
                        sharpen 0x009819e7 (u8)     : min=0 max=255 step=1 default=0 dims=[28] flags=has-payload
     defective_pixel_correction 0x009819e8 (u8)     : min=0 max=255 step=1 default=0 dims=[8] flags=has-payload
                 colour_denoise 0x009819e9 (u8)     : min=0 max=255 step=1 default=0 dims=[8] flags=has-payload

Image Processing Controls

                   digital_gain 0x009f0905 (int)    : min=1 max=65535 step=1 default=1000 value=1000
====== /dev/video14 ======
====== /dev/video15 ======                                                                                                                                                     
====== /dev/video16 ======                                                                                                                                                     
====== /dev/video18 ======                                                                                                                                                     
====== /dev/video19 ======                                                                                                                                                     
                                                                                                                                                                               
Stateless Codec Controls                                                                                                                                                       
                                                                                                                                                                               
    hevc_sequence_parameter_set 0x00a40a90 (hevc-sps): value=unsupported payload type flags=has-payload
     hevc_picture_parameter_set 0x00a40a91 (hevc-sps): value=unsupported payload type flags=has-payload
              slice_param_array 0x00a40a92 (hevc-slice-params): elems=1 dims=[4096] flags=has-payload, dynamic-array
            hevc_scaling_matrix 0x00a40a93 (hevc-scaling-matrix): value=unsupported payload type flags=has-payload
         hevc_decode_parameters 0x00a40a94 (hevc-decode-params): value=unsupported payload type flags=has-payload
               hevc_decode_mode 0x00a40a95 (menu)   : min=0 max=0 default=0 value=0 (Slice-Based)
                hevc_start_code 0x00a40a96 (menu)   : min=0 max=1 default=0 value=0 (No Start Code)
====== /dev/video20 ======

User Controls

                    red_balance 0x0098090e (int)    : min=1 max=65535 step=1 default=1000 value=1000 flags=slider
                   blue_balance 0x0098090f (int)    : min=1 max=65535 step=1 default=1000 value=1000 flags=slider
       colour_correction_matrix 0x009819e1 (u8)     : min=0 max=255 step=1 default=0 dims=[88] flags=has-payload
                   lens_shading 0x009819e2 (u8)     : min=0 max=255 step=1 default=0 dims=[36] flags=has-payload, execute-on-write
                    black_level 0x009819e3 (u8)     : min=0 max=255 step=1 default=0 dims=[12] flags=has-payload
             green_equalisation 0x009819e4 (u8)     : min=0 max=255 step=1 default=0 dims=[16] flags=has-payload
                          gamma 0x009819e5 (u8)     : min=0 max=255 step=1 default=0 dims=[136] flags=has-payload
                        denoise 0x009819e6 (u8)     : min=0 max=255 step=1 default=0 dims=[24] flags=has-payload
                        sharpen 0x009819e7 (u8)     : min=0 max=255 step=1 default=0 dims=[28] flags=has-payload
     defective_pixel_correction 0x009819e8 (u8)     : min=0 max=255 step=1 default=0 dims=[8] flags=has-payload
                 colour_denoise 0x009819e9 (u8)     : min=0 max=255 step=1 default=0 dims=[8] flags=has-payload

Image Processing Controls

                   digital_gain 0x009f0905 (int)    : min=1 max=65535 step=1 default=1000 value=1000
====== /dev/video21 ======
====== /dev/video22 ======
====== /dev/video23 ======
====== /dev/video31 ======

JPEG Compression Controls

            compression_quality 0x009d0903 (int)    : min=1 max=100 step=1 default=80 value=80
====== /dev/media0 ======
Unable to detect what device /dev/media0 is, exiting.
====== /dev/media1 ======
Unable to detect what device /dev/media1 is, exiting.
====== /dev/media2 ======
Unable to detect what device /dev/media2 is, exiting.
====== /dev/media3 ======
Unable to detect what device /dev/media3 is, exiting.
root@a0d7b954-motioneye:/$ cat /data/motioneye/camera-1.conf                                                                                                                   
# @enabled on                                                                                                                                                                  
# @id 1                                                                                                                                                                        
# @storage_device custom-path                                                                                                                                                  
# @network_server                                                                                                                                                              
# @network_share_name                                                                                                                                                          
# @network_smb_ver 1.0                                                                                                                                                         
# @network_username                                                                                                                                                            
# @network_password                                                                                                                                                            
# @upload_enabled off                                                                                                                                                          
# @upload_picture on                                                                                                                                                           
# @upload_movie on                                                                                                                                                             
# @upload_service ftp                                                                                                                                                          
# @upload_server                                                                                                                                                               
# @upload_port                                                                                                                                                                 
# @upload_method post                                                                                                                                                          
# @upload_location                                                                                                                                                             
# @upload_subfolders on                                                                                                                                                        
# @upload_username                                                                                                                                                             
# @upload_password                                                                                                                                                             
# @upload_endpoint_url                                                                                                                                                         
# @upload_access_key                                                                                                                                                           
# @upload_secret_key                                                                                                                                                           
# @upload_bucket                                                                                                                                                               
# @clean_cloud_enabled off                                                                                                                                                     
# @webcam_resolution 100                                                                                                                                                       
# @webcam_server_resize off                                                                                                                                                    
# @motion_detection off                                                                                                                                                        
# @preserve_pictures 0
# @manual_snapshots on
# @preserve_movies 1
# @manual_record off
# @working_schedule 
# @working_schedule_type outside
# @lang en

width 800                                                                                                                                                                      
height 480                                                                                                                                                                     
camera_name Camera1                                                                                                                                                            
auto_brightness off                                                                                                                                                            
framerate 5                                                                                                                                                                    
rotate 0                                                                                                                                                                       
mask_privacy                                                                                                                                                                   
target_dir /share/motioneye/Camera1                                                                                                                                            
stream_localhost off                                                                                                                                                           
stream_port 9081                                                                                                                                                               
stream_maxrate 10                                                                                                                                                              
stream_quality 100                                                                                                                                                             
stream_motion on                                                                                                                                                               
stream_auth_method 0                                                                                                                                                           
text_left Camera1                                                                                                                                                              
text_right %Y-%m-%d\n%T                                                                                                                                                        
text_scale 2                                                                                                                                                                   
text_changes off                                                                                                                                                               
locate_motion_mode off                                                                                                                                                         
locate_motion_style redbox                                                                                                                                                     
threshold 12000                                                                                                                                                                
threshold_maximum 0                                                                                                                                                            
threshold_tune off                                                                                                                                                             
noise_tune on
noise_level 31
lightswitch_percent 0
despeckle_filter 
minimum_motion_frames 20
smart_mask_speed 0
mask_file 
movie_output_motion off
picture_output_motion off
pre_capture 1
post_capture 1
picture_output off
picture_filename 
emulate_motion off`
event_gap 30
snapshot_interval 0
snapshot_filename 
picture_quality 85
movie_filename %Y-%m-%d/%H-%M-%S
movie_max_time 60
movie_output off
movie_passthrough off
movie_codec mp4
movie_quality 60
on_event_start /usr/lib/python3.11/site-packages/motioneye/scripts/relayevent.sh "/data/motioneye/motioneye.conf" start %t; /usr/bin/python3 /usr/lib/python3.11/site-packages/motioneye/meyectl.py webhook -c /data/motioneye/motioneye.conf 'POSTj' 'http://192.168.20.54:8123/api/webhook/7735514ef0d6cce4614c4e0a5ee99cdd4f32f73fd8f5869dbc89c0c7e8a0c928?camera_id=%t&changed_pixels=%D&despeckle_labels=%Q&event=%v&fps=%{fps}&frame_number=%q&height=%h&host=%{host}&motion_center_x=%K&motion_center_y=%L&motion_height=%J&motion_version=%{ver}&motion_width=%i&noise_level=%N&threshold=%o&width=%w&src=hass-motioneye&event_type=motion_detected&device_id=5e373125595cf0906b4e77939fcddf7a'
on_event_end /usr/lib/python3.11/site-packages/motioneye/scripts/relayevent.sh "/data/motioneye/motioneye.conf" stop %t
on_movie_end /usr/lib/python3.11/site-packages/motioneye/scripts/relayevent.sh "/data/motioneye/motioneye.conf" movie_end %t %f; /usr/bin/python3 /usr/lib/python3.11/site-packages/motioneye/meyectl.py webhook -c /data/motioneye/motioneye.conf 'POSTj' 'http://192.168.20.54:8123/api/webhook/7735514ef0d6cce4614c4e0a5ee99cdd4f32f73fd8f5869dbc89c0c7e8a0c928?camera_id=%t&event=%v&file_path=%f&file_type=%n&fps=%{fps}&frame_number=%q&height=%h&host=%{host}&motion_version=%{ver}&noise_level=%N&threshold=%o&width=%w&src=hass-motioneye&event_type=file_stored&device_id=5e373125595cf0906b4e77939fcddf7a'
on_picture_save /usr/lib/python3.11/site-packages/motioneye/scripts/relayevent.sh "/data/motioneye/motioneye.conf" picture_save %t %f; /usr/bin/python3 /usr/lib/python3.11/site-packages/motioneye/meyectl.py webhook -c /data/motioneye/motioneye.conf 'POSTj' 'http://192.168.20.54:8123/api/webhook/7735514ef0d6cce4614c4e0a5ee99cdd4f32f73fd8f5869dbc89c0c7e8a0c928?camera_id=%t&event=%v&file_path=%f&file_type=%n&fps=%{fps}&frame_number=%q&height=%h&host=%{host}&motion_version=%{ver}&noise_level=%N&threshold=%o&width=%w&src=hass-motioneye&event_type=file_stored&device_id=5e373125595cf0906b4e77939fcddf7a'
stream_authentication user:xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
video_device /dev/video0
video_params auto_exposure=1,auto_exposure_bias=12,blue_balance=1000,brightness=50,color_effects=0,color_effects_cbcr=32896,compression_quality=80,contrast=0,exposure_metering_mode=0,exposure_time_absolute=1000,h264_i_frame_period=60,h264_level=11,h264_maximum_qp_value=0,h264_minimum_qp_value=0,h264_profile=4,iso_sensitivity=0,iso_sensitivity_auto=1,power_line_frequency=1,red_balance=1000,rotate=0,saturation=0,scene_mode=0,sharpness=0,video_bitrate=6064386,video_bitrate_mode=0,white_balance_auto_preset=1

@TheLazyHatGuy
Copy link

TheLazyHatGuy commented Jul 24, 2024

I'm starting to think it might be a hardware issue. I'm using a Pi 4B+ and Pi Camera 3.
Edit: I know the camera works, I just mean hardware issue in the sense the only specific cameras might work

@TheLazyHatGuy
Copy link

TheLazyHatGuy commented Jul 24, 2024

Some more logs

# docker exec -it addon_a0d7b954_motioneye bash
root@a0d7b954-motioneye:/$ apk add libcamera-tools
(1/7) Installing libcamera-ipa (0.1.0-r1)
(2/7) Installing libunwind (1.7.2-r1)
(3/7) Installing yaml (0.2.5-r2)
(4/7) Installing libcamera (0.1.0-r1)
(5/7) Installing libevent (2.1.12-r7)
(6/7) Installing gtest (1.14.0-r1)
(7/7) Installing libcamera-tools (0.1.0-r1)
Executing busybox-1.36.1-r15.trigger
OK: 207 MiB in 184 packages
root@a0d7b954-motioneye:/$ cam -l
[0:14:00.070772133] [478]  INFO Camera camera_manager.cpp:284 libcamera v0.1.0
Available cameras:
root@a0d7b954-motioneye:/$ exit
# docker exec -it addon_a0d7b954_motioneye bash
root@a0d7b954-motioneye:/$ v4l2-ctl  --list-devices
bcm2835-codec-decode (platform:bcm2835-codec):
	/dev/video10
	/dev/video11
	/dev/video12
	/dev/video18
	/dev/video31
	/dev/media1

bcm2835-isp (platform:bcm2835-isp):
	/dev/video13
	/dev/video14
	/dev/video15
	/dev/video16
	/dev/video20
	/dev/video21
	/dev/video22
	/dev/video23
	/dev/media2
	/dev/media3

mmal service 16.1 (platform:bcm2835_v4l2-0):
	/dev/video0

rpivid (platform:rpivid):
	/dev/video19
	/dev/media0

Using Raspbian

@raspberrypi:~ $ cam -l
[0:05:59.413619094] [2697]  INFO Camera camera_manager.cpp:313 libcamera v0.3.0+65-6ddd79b5
[0:05:59.539846389] [2702]  WARN RPiSdn sdn.cpp:40 Using legacy SDN tuning - please consider moving SDN inside rpi.denoise
[0:05:59.542320415] [2702]  INFO RPI vc4.cpp:446 Registered camera /base/soc/i2c0mux/i2c@1/imx708@1a to Unicam device /dev/media1 and ISP device /dev/media0
Available cameras:
1: 'imx708' (/base/soc/i2c0mux/i2c@1/imx708@1a)
@raspberrypi:~ $ v4l2-ctl  --list-devices
bcm2835-codec-decode (platform:bcm2835-codec):
	/dev/video10
	/dev/video11
	/dev/video12
	/dev/video18
	/dev/video31
	/dev/media4

bcm2835-isp (platform:bcm2835-isp):
	/dev/video13
	/dev/video14
	/dev/video15
	/dev/video16
	/dev/video20
	/dev/video21
	/dev/video22
	/dev/video23
	/dev/media0
	/dev/media2

unicam (platform:fe801000.csi):
	/dev/video0
	/dev/video1
	/dev/media1

rpivid (platform:rpivid):
	/dev/video19
	/dev/media3
@raspberrypi:~ $ for i in /dev/video* /dev/media*; do echo ====== $i ======; v4l2-ctl -ld $i; done
====== /dev/video0 ======
====== /dev/video1 ======
====== /dev/video10 ======

User Controls

  min_number_of_capture_buffers 0x00980927 (int)    : min=1 max=1 step=1 default=1 value=1 flags=read-only

Codec Controls

                     h264_level 0x00990a67 (menu)   : min=0 max=13 default=11 value=11 (4) flags=read-only
                   h264_profile 0x00990a6b (menu)   : min=0 max=4 default=4 value=4 (High) flags=read-only
====== /dev/video11 ======

Codec Controls

                 video_b_frames 0x009909ca (int)    : min=0 max=0 step=1 default=0 value=0 flags=update
                 video_gop_size 0x009909cb (int)    : min=0 max=2147483647 step=1 default=60 value=60
             video_bitrate_mode 0x009909ce (menu)   : min=0 max=1 default=0 value=0 (Variable Bitrate) flags=update
                  video_bitrate 0x009909cf (int)    : min=25000 max=25000000 step=25000 default=10000000 value=10000000
           sequence_header_mode 0x009909d8 (menu)   : min=0 max=1 default=1 value=1 (Joined With 1st Frame)
         repeat_sequence_header 0x009909e2 (bool)   : default=0 value=0
                force_key_frame 0x009909e5 (button) : value=0 flags=write-only, execute-on-write
          h264_minimum_qp_value 0x00990a61 (int)    : min=0 max=51 step=1 default=20 value=20
          h264_maximum_qp_value 0x00990a62 (int)    : min=0 max=51 step=1 default=51 value=51
            h264_i_frame_period 0x00990a66 (int)    : min=0 max=2147483647 step=1 default=60 value=60
                     h264_level 0x00990a67 (menu)   : min=0 max=15 default=11 value=11 (4)
                   h264_profile 0x00990a6b (menu)   : min=0 max=4 default=4 value=4 (High)
====== /dev/video12 ======

User Controls

                horizontal_flip 0x00980914 (bool)   : default=0 value=0
                  vertical_flip 0x00980915 (bool)   : default=0 value=0
====== /dev/video13 ======

User Controls

                    red_balance 0x0098090e (int)    : min=1 max=65535 step=1 default=1000 value=1000 flags=slider
                   blue_balance 0x0098090f (int)    : min=1 max=65535 step=1 default=1000 value=1000 flags=slider
       colour_correction_matrix 0x009819e1 (u8)     : min=0 max=255 step=1 default=0 dims=[88] flags=has-payload
                   lens_shading 0x009819e2 (u8)     : min=0 max=255 step=1 default=0 dims=[36] flags=has-payload, execute-on-write
                    black_level 0x009819e3 (u8)     : min=0 max=255 step=1 default=0 dims=[12] flags=has-payload
             green_equalisation 0x009819e4 (u8)     : min=0 max=255 step=1 default=0 dims=[16] flags=has-payload
                          gamma 0x009819e5 (u8)     : min=0 max=255 step=1 default=0 dims=[136] flags=has-payload
                        denoise 0x009819e6 (u8)     : min=0 max=255 step=1 default=0 dims=[24] flags=has-payload
                        sharpen 0x009819e7 (u8)     : min=0 max=255 step=1 default=0 dims=[28] flags=has-payload
     defective_pixel_correction 0x009819e8 (u8)     : min=0 max=255 step=1 default=0 dims=[8] flags=has-payload
                 colour_denoise 0x009819e9 (u8)     : min=0 max=255 step=1 default=0 dims=[8] flags=has-payload

Image Processing Controls

                   digital_gain 0x009f0905 (int)    : min=1 max=65535 step=1 default=1000 value=1000
====== /dev/video14 ======
====== /dev/video15 ======
====== /dev/video16 ======
====== /dev/video18 ======
====== /dev/video19 ======

Stateless Codec Controls

    hevc_sequence_parameter_set 0x00a40a90 (unknown): type=270 value=unsupported payload type flags=has-payload
     hevc_picture_parameter_set 0x00a40a91 (unknown): type=271 value=unsupported payload type flags=has-payload
              slice_param_array 0x00a40a92 (unknown): type=272 dims=[4096] flags=has-payload, 0x00000800
            hevc_scaling_matrix 0x00a40a93 (unknown): type=273 value=unsupported payload type flags=has-payload
         hevc_decode_parameters 0x00a40a94 (unknown): type=274 value=unsupported payload type flags=has-payload
               hevc_decode_mode 0x00a40a95 (menu)   : min=0 max=0 default=0 value=0 (Slice-Based)
                hevc_start_code 0x00a40a96 (menu)   : min=0 max=1 default=0 value=0 (No Start Code)
====== /dev/video20 ======

User Controls

                    red_balance 0x0098090e (int)    : min=1 max=65535 step=1 default=1000 value=1000 flags=slider
                   blue_balance 0x0098090f (int)    : min=1 max=65535 step=1 default=1000 value=1000 flags=slider
       colour_correction_matrix 0x009819e1 (u8)     : min=0 max=255 step=1 default=0 dims=[88] flags=has-payload
                   lens_shading 0x009819e2 (u8)     : min=0 max=255 step=1 default=0 dims=[36] flags=has-payload, execute-on-write
                    black_level 0x009819e3 (u8)     : min=0 max=255 step=1 default=0 dims=[12] flags=has-payload
             green_equalisation 0x009819e4 (u8)     : min=0 max=255 step=1 default=0 dims=[16] flags=has-payload
                          gamma 0x009819e5 (u8)     : min=0 max=255 step=1 default=0 dims=[136] flags=has-payload
                        denoise 0x009819e6 (u8)     : min=0 max=255 step=1 default=0 dims=[24] flags=has-payload
                        sharpen 0x009819e7 (u8)     : min=0 max=255 step=1 default=0 dims=[28] flags=has-payload
     defective_pixel_correction 0x009819e8 (u8)     : min=0 max=255 step=1 default=0 dims=[8] flags=has-payload
                 colour_denoise 0x009819e9 (u8)     : min=0 max=255 step=1 default=0 dims=[8] flags=has-payload

Image Processing Controls

                   digital_gain 0x009f0905 (int)    : min=1 max=65535 step=1 default=1000 value=1000
====== /dev/video21 ======
====== /dev/video22 ======
====== /dev/video23 ======
====== /dev/video31 ======

JPEG Compression Controls

            compression_quality 0x009d0903 (int)    : min=1 max=100 step=1 default=80 value=80
====== /dev/media0 ======
Unable to detect what device /dev/media0 is, exiting.
====== /dev/media1 ======
Unable to detect what device /dev/media1 is, exiting.
====== /dev/media2 ======
Unable to detect what device /dev/media2 is, exiting.
====== /dev/media3 ======
Unable to detect what device /dev/media3 is, exiting.
====== /dev/media4 ======
Unable to detect what device /dev/media4 is, exiting.

@TheLazyHatGuy
Copy link

TheLazyHatGuy commented Jul 24, 2024

Looks like the issues I am having is a known issue with motionEye motioneye-project/motioneye#2683

Solution for running locally: motioneye-project/motioneye#2812 (comment)

@denics
Copy link

denics commented Jul 24, 2024

Looks like the issues I am having is a known issue with motionEye motioneye-project/motioneye#2683

I confirm. This is why I am trying to install rasbianos buster to be able to use the legacy camera framework

@TheLazyHatGuy
Copy link

Not sure if it is possible to change the entrypoint of the motionEye addon without building a brand new image

@denics
Copy link

denics commented Jul 24, 2024

Not sure if it is possible to change the entrypoint of the motionEye addon without building a brand new image

you could build your own addon, or, as I am trying to do, I use the motionEye addon in HomeAssistant connected with rpi0w running motioneyeOS in mode Fast Network Camera

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment