OpenALPR Local - has anyone managed to get this working?

I could never get local working.

OpenALPR have changed their licencing model so it may not even be possible anymore, regardless or the ā€œtechnical glitchesā€ that weā€™ve experiencedā€¦
At least not for freeā€¦

Have it working in docker that has alpine as base image.

#Adding of dependencies
echo ā€œhttp://nl.alpinelinux.org/alpine/edge/testingā€ >>/etc/apk/repositories && echo -e ā€œhttp://dl-cdn.alpinelinux.org/alpine/edge/community\nhttp://dl-cdn.alpinelinux.org/alpine/edge/mainā€ >> /etc/apk/repositoriesapk --no-cache add --virtual .build-deps ca-certificates wget git gcc g++ cmake make curl-dev leptonica-dev log4cplus-dev opencv-dev tesseract-ocr-dev libexecinfo-dev
#Cloning and making of directories
cd /srv && git clone https://github.com/openalpr/openalpr.git && cd openalpr/src && mkdir build && cd build && sed -i.bak ā€˜s/backtrace/0;///ā€™ ā€¦/daemon.cpp
#building
cmake -DCMAKE_INSTALL_PREFIX:PATH=/usr -DCMAKE_INSTALL_SYSCONFDIR:PATH=/etc ā€¦ && make -j8 && make install

as for using it, openalpr config does not work but a workaround from gavinwoolley here makes it usable. OpenALPR local not working

If you need help editing config etc just reach out.

Hi. I was excited to get local ALPR working after installing a driveway camera (5MP Reolink), but no go.

I followed a bunch of Linux installation guides (for my Raspberry Pi 4 HA installed via venv) but couldnā€™t get the command line working until I found and did: https://github.com/openalpr/openalpr/issues/641 which solved the tesseract language error.
Now I can identify number plates from image files via the command line, but itā€™s not great. I have a nice clear photo of my car with the number plate about as obvious as you can imagine, andā€¦ it misses a letter. I donā€™t hold out much hope that my driveway video camera will produce clear enough images!

But, Iā€™d at least like to get something in HA other than ā€œunknownā€.
(Itā€™s a shame that stale issues get closed on GitHub without resolutionā€¦)
So, I guess Iā€™m just adding my ā€œanyone got this working?ā€ to the mix.

Installed it, after cp the tessdata/ to other location worked fine on the command line, but not in HA who shows just ā€˜unknownā€™. There is also something strange in my logs i canā€™t understand:

2020-09-22 10:57:31 ERROR (MainThread) [homeassistant.helpers.entity] Update for image_processing.alpr fails


Traceback (most recent call last):


  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 278, in async_update_ha_state


    await self.async_device_update()


  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 469, in async_device_update


    await self.async_update()  # type: ignore


  File "/usr/src/homeassistant/homeassistant/components/image_processing/__init__.py", line 132, in async_update


    await self.async_process_image(image.content)


  File "/usr/src/homeassistant/homeassistant/components/openalpr_local/image_processing.py", line 189, in async_process_image


    alpr = await asyncio.create_subprocess_exec(


  File "/usr/local/lib/python3.8/asyncio/subprocess.py", line 236, in create_subprocess_exec


    transport, protocol = await loop.subprocess_exec(


  File "/usr/local/lib/python3.8/asyncio/base_events.py", line 1630, in subprocess_exec


    transport = await self._make_subprocess_transport(


  File "/usr/local/lib/python3.8/asyncio/unix_events.py", line 197, in _make_subprocess_transport


    transp = _UnixSubprocessTransport(self, protocol, args, shell,


  File "/usr/local/lib/python3.8/asyncio/base_subprocess.py", line 36, in __init__


    self._start(args=args, shell=shell, stdin=stdin, stdout=stdout,


  File "/usr/local/lib/python3.8/asyncio/unix_events.py", line 789, in _start


    self._proc = subprocess.Popen(


  File "/usr/local/lib/python3.8/subprocess.py", line 854, in __init__


    self._execute_child(args, executable, preexec_fn, close_fds,


  File "/usr/local/lib/python3.8/subprocess.py", line 1702, in _execute_child


    raise child_exception_type(errno_num, err_msg, err_filename)


FileNotFoundError: [Errno 2] No such file or directory: 'alpr'


Im running HA in Docker. May this could be the reason, and if how can i fix it?

So now after 2 years this still doesnā€™t work?

For one who ares interested, thereā€™s a openalpr addon for HAOS.
Originally from

But this one doesnā€™t install, so iā€™ve modified it a bit, and make api compatible with openalpr cloud integration.

You can find the modified version here :

And you have to change the API_URL in openalpr cloud integration to your addon web server (default port is 5001).

Itā€™s technicaly working, but accurancy is really not good, even test image from openalpr is recognised with mistake in plate. So not really usable.

@lasewun when i try
sed -i.bak ā€˜s/backtrace/0;///ā€™ ā€¦/daemon.cpp
nothing happens can you help me?
#building
cmake -DCMAKE_INSTALL_PREFIX:PATH=/usr -DCMAKE_INSTALL_SYSCONFDIR:PATH=/etc ā€¦ && make -j8 && make install
Same for this part(no cmake installed)
Thank you in advance

cd /srv && git clone https://github.com/openalpr/openalpr.git && cd openalpr/src && mkdir build
apk add util-linux pciutils usbutils coreutils binutils findutils grep iproute2
apk add build-base gcc abuild binutils binutils-doc gcc-doc
apk add cmake cmake-doc extra-cmake-modules extra-cmake-modules-doc
apk add tesseract-ocr-dev
apk add opencv-dev
apk add curl-dev
apk add log4cplus-dev
#building
vi daemon.cpp and add // to line with backtrace

cmake -DCMAKE_INSTALL_PREFIX:PATH=/usr -DCMAKE_INSTALL_SYSCONFDIR:PATH=/etc && make -j8 && make install

shell_command:
garage_number_plate: ssh -i /config/ssh/id_rsa -o StrictHostKeyChecking=no [email protected] alpr -c eu /config/test.jpg -j > /config/garage_outdoor_plates.json

sensor 4 -
-platform: file
name: Tablica
file_path: /config/garage_outdoor_plates.json
value_template: ā€˜{{value_json[ā€œresultsā€][0][ā€œplateā€]}}ā€™

This works for me :slight_smile:

For SSH you have to do the key etc.

ssh-keygen -t rsa
cp /root/.ssh/id* /config/ssh/
ssh-copy-id [email protected]

Hello I did make a simple script to run in terminal with everything done in above post.
Edited the two lines in daemon.cpp

1 Like