OpenALPR Local - has anyone managed to get this working?

I’ll happily give $10 to anyone that can help me getting it working on my side.

$20? Any takers?

somehow I also cant get this working.

I installed OpenALPR.

The command line in the HA documents that needs to be ran via cmake wont work for me.
However if I run the wget command it does recognize the pictures.
So the install is ok

Installing the cloud version works like a charm, but does quickly run out of free credits, so thats not an option.

FYI:

anyone else getting error like this?

2019-07-17 21:39:40 ERROR (MainThread) [homeassistant.helpers.entity] Update for image_processing.openalpr_side fails
Traceback (most recent call last):
  File "/usr/src/app/homeassistant/helpers/entity.py", line 220, in async_update_ha_state
    await self.async_device_update()
  File "/usr/src/app/homeassistant/helpers/entity.py", line 375, in async_device_update
    await self.async_update()
  File "/usr/src/app/homeassistant/components/image_processing/__init__.py", line 132, in async_update
    await self.async_process_image(image.content)
  File "/usr/src/app/homeassistant/components/openalpr_local/image_processing.py", line 187, in async_process_image
    stdout, _ = await alpr.communicate(input=image)
  File "/usr/local/lib/python3.7/asyncio/subprocess.py", line 187, in communicate
    loop=self._loop)
  File "/usr/local/lib/python3.7/asyncio/subprocess.py", line 138, in _feed_stdin
    self.stdin.write(input)
  File "/usr/local/lib/python3.7/asyncio/streams.py", line 305, in write
    self._transport.write(data)
  File "uvloop/handles/stream.pyx", line 671, in uvloop.loop.UVStream.write
  File "uvloop/handles/handle.pyx", line 159, in uvloop.loop.UVHandle._ensure_alive
RuntimeError: unable to perform operation on <WriteUnixTransport closed=True reading=False 0x7f3274682ba8>; the handler is closed

Sorry for going back a month, but I’ve just started investigating OpenALPR and I’m puzzled by your “quickly run out of free credits” comment. I see the free tier gives you 1000 “recognitions” a month. I can’t imagine ever needing more than this for my driveway use case, as I can’t believe familiy + visitors + deliveries is ever going to approach that 32 a day. Have I misunderstood how this works?

Richard,

From what I understand in the documentation and also from testign experience.
If you keep the configuration as per default it will do api call every 12 seconds.

There is a possibility to only do a api-call depending on e.g. a motion sensor.
I haven’t tried this yet, since I don’t have a motion sensor installed.

Ah, OK. Thanks for that. It seems like they are using rather misleading language if by “recognitions” they really mean “API calls”! My plan was to try having calls as a result of movement alerts from my Blue Iris camera monitoring software, so this might still work for me.

Having said that, I’d prefer to run it locally, but I don’t currently have the processing power. Might need to get a Pi 4 earlier rather than later!

Thanks for your response.

I set this up last night. Had a look today have gone through all my 1000 free calls. Still don’t have any detections listed as it used them all last night when no one was driving around.

I’m not sure how this works. Does it send every frame? If so, that’s annoying.

What is the status now, how it would be possible to use local (free) option in HA?
I have seen https://www.home-assistant.io/integrations/openalpr_local/ but I have no idea how to even “get alpr commadline tool”

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