ljmerza / frigate_plate_recognizer

Identify license plates via Plate Recognizer and add them as sublabels to Frigate
127 stars 17 forks source link

Is there a way to use this in automations in Home Assistant? #4

Closed heisenberg2980 closed 1 year ago

heisenberg2980 commented 1 year ago

Is there a way for Home Assistant to know this process has been executed and what plates have been detected to use this information in automations? (i.e. notify you when a known/unkown car has been detected)

ljmerza commented 1 year ago

in v1.3.0 I added a return topic config return_topic: plate_recognizer that returns a mqtt message with plate data

heisenberg2980 commented 1 year ago

@ljmerza you are a star! testing it now

heisenberg2980 commented 1 year ago

The process generates this error and restarts when trying to write a message to the return topic:

TypeError: payload must be a string, bytearray, int, float or None.

heisenberg2980 commented 1 year ago

Error has been fixed in 1.3.2, thanks @ljmerza

Note: For anyone coming here with a similar question, Plate Recognizer also has a Webhooks option (included in the free account) that can be setup to call Home Assistant every time a call to the recognition API is made, but that requires Home Assistant to be accessible from the internet.

BliXem1 commented 9 months ago

Alright, this is the first time for me, I set this ip, did the config and MQTT within Frigate and the frigate_plate_rec.

2024-02-09 00:00:12,316 - __main__ - INFO - Frigate Plate Recognizer Version: 1.8.8
2024-02-09 00:00:12,316 - __main__ - INFO - Using CodeProject.AI API
2024-02-09 00:00:12,316 - __main__ - INFO - Starting MQTT client. Connecting to: 192.168.0.125
2024-02-09 00:00:12,317 - __main__ - INFO - MQTT Connected

MQTT has been setup within Home Assistant, it's connected with Frigate and the plate_rec. But where can I find this? The notification for when a known/unkown car has been detected. This is for my garage, when it reconize the license plate the garagedoor opens. Where can I add the license plate btw so it knows the car is on the driveway?

ljmerza commented 9 months ago

The docs mention an mqtt event that will be sent when a license plate is detected. You can use that to create an entity from the mqtt sensor entity

BliXem1 commented 9 months ago

I'm sorry, how do we create the entity? Hope you can help me.

2024-02-09 16:09:16,785 - main - INFO - Storing plate number in database: licenseplate with score: 0.9962902069091797 2024-02-09 16:09:16,823 - main - INFO - Sublabel set successfully to: licenseplate with 99.6% confidence

It does work by checking the license.

BliXem1 commented 9 months ago

Maybe @heisenberg2980 want to share his MQTT configuration? It's important for me that if it detects my license plate the garagedoor opens.

heisenberg2980 commented 9 months ago

@BliXem1 I am using the webhook option I mentioned here: https://github.com/ljmerza/frigate_plate_recognizer/issues/4#issuecomment-1714566767 which is a bit more complex, but getting the value from MQTT shouldn´t be difficult. If this is the first time you are working with MQTT, I would recommend you to install the Windows app "MQTT Explorer" as a first step, so you can see if the messages from plate recognizer are reaching your MQTT broker