Home Assistant License Plate Recognition with LPR Camera API

Home › Forums › Viewtron Security Camera Systems Support › IP Camera API › Home Assistant License Plate Recognition with LPR Camera API

  • Here is how to set up Home Assistant license plate recognition with our Viewtron LPR camera and its API. I see this question a lot on Reddit and Home Assistant forums, and this is how I answer it.

    Home Assistant LPR Camera

    I want Home Assistant license plate recognition (LPR) to open my garage door or driveway gate when my car pulls in, and to send me an alert when a car it does not know shows up. Can I do that with a Viewtron LPR-IP4 camera, without running Frigate, a GPU, or a cloud plate reading service?

    Is there a simple way to get the plate number into my automations?

    This is what I tell them:

    Yes. The Viewtron LPR camera reads the plate itself, on the camera. It sends each plate read to Home Assistant with the camera’s HTTP POST API. A free Home Assistant app (formerly called an add-on) that I published on GitHub, the Viewtron Bridge, turns those posts into Home Assistant entities over MQTT: the plate number, the plate’s list status (allow list, block list, temporary or unknown), a cropped plate image and a full scene image. The allow list lives on the camera. There is no Frigate, no GPU or Coral, no cloud plate reading and no subscription.

    What do you need for license plate recognition in Home Assistant?

    • A Viewtron LPR camera. I use and recommend the LPR-IP4 (4MP, 8-32mm motorized zoom lens, built-in IR). It is the model the Home Assistant integration was tested with.
    • A PoE switch or PoE injector to power the camera. An NVR is optional. The camera can post directly to Home Assistant.
    • Home Assistant OS (or Supervised) so you have the Apps menu, with the Mosquitto broker app and the MQTT integration.
    • The Viewtron Bridge app from my public GitHub repository: github.com/mikehaldas/viewtron-home-assistant. Version 1.1.0 is the current release. It is built on the viewtron Python SDK (pip install viewtron), version 1.3.1.
    • A garage door opener or gate controller that is already in Home Assistant as a cover entity (for example cover.garage_door).

    How does the LPR camera send plates to Home Assistant?

    Viewtron LPR camera -> HTTP POST (XML) -> Viewtron Bridge app -> MQTT -> Home Assistant entities

    The camera does all of the plate recognition on the device. When it reads a plate, it posts the plate number, the plate’s list status from the camera’s own plate database, and two pictures to the bridge. The bridge publishes them to MQTT with Home Assistant auto discovery, so the entities show up on their own. You do not write any YAML to create them. The bridge handles events from a camera directly or forwarded by a Viewtron NVR.

    1. Install the Viewtron Bridge app in Home Assistant

    If you already run the Mosquitto broker app and the MQTT integration, skip to step 4.

    1. Go to Settings > Apps > Install app. Find Mosquitto broker, click Install, then Start.
    2. Go to Settings > Devices & services. Home Assistant discovers MQTT. Click it and submit to set it up.
    3. Create a Home Assistant user for MQTT under Settings > People > Users (turn on Advanced mode in your profile if you do not see the option). Mosquitto lets Home Assistant users log in, and the bridge needs a login.
    4. Go to Settings > Apps > Install app, click the three dot menu at the top right, and choose Repositories. Paste https://github.com/mikehaldas/viewtron-home-assistant and click Add.
    5. Find Viewtron Bridge in the list and click Install.
    6. On the Configuration tab, leave bridge_port at 5002, mqtt_broker at core-mosquitto and mqtt_port at 1883. Enter the MQTT username and password you just created. Save, then click Start.
    7. Open the Log tab. You should see “Starting Viewtron Bridge (Home Assistant add-on mode)” and the MQTT broker it connected to.

    On Home Assistant versions before 2026.2, Apps is called Add-ons, and the store is Settings > Add-ons > Add-on Store. If you run Home Assistant Container or Core, there is no Apps menu. The GitHub page has Docker and manual install steps for the bridge instead.

    2. Turn on license plate detection on the camera

    Log into the camera from a web browser. Go to the Config tab and select License Plate Detection. Check Enable, click Draw Area and draw the detection zone, then click Draw Target Size and enter the minimum and maximum plate size. Set the minimum a little smaller than a real plate looks in the picture and the maximum a little larger. Click Save.

    Viewtron LPR camera License Plate Detection settings with Enable, Draw Area and Draw Target Size

    Mounting matters more than anything else in this project. The LPR-IP4 reads plates from about 21 to 90 feet away when it is installed well. Keep the camera angle to the plate shallow, and zoom in so the plate area covers about one lane. A camera mounted too close, or too steep, will see the car and never read the plate. My LPR camera installation guide covers the height, angle and distance rules.

    3. Point the camera HTTP POST API at Home Assistant

    In the camera’s web interface, go to Network > Advanced > HTTP Notification. Set Push Protocol Version to V1. Add a server entry, edit it, and use these settings:

    • Enable: checked
    • Domain/IP: the IP address of your Home Assistant machine
    • Server Port: 5002 (or the bridge_port you set in the app)
    • Path: /API
    • Connection Type: Persistent connection
    • Send Heartbeat: checked, Heartbeat Interval 30 seconds
    • Smart Alarm Data: Smart event data checked, with Original picture and Target picture both checked. Original picture becomes the Overview image in Home Assistant and Target picture becomes the Plate image.
    • Smart Alarm Type: License Plate Detection

    Click Save and reboot the camera after you set up HTTP POST for the first time. Use V1 for the push protocol. V2 sends the alarm events, but the pictures do not come through reliably. If you want to see the HTTP POST API in more detail, I have an LPR camera API video.

    4. Which Home Assistant entities does the LPR camera create?

    The first plate the camera sends creates a device in Home Assistant under Settings > Devices & services > MQTT, with four entities:

    • sensor.viewtron_<camera>_license_plate: the plate number that was read, for example H07ZIT
    • sensor.viewtron_<camera>_status: the plate’s list status, for example whiteList
    • image.viewtron_<camera>_plate: the cropped plate picture
    • image.viewtron_<camera>_overview: the full scene picture

    The <camera> part comes from the camera name the camera sends with its events. The bridge names the device “Viewtron” plus the camera name. My camera is named Driveway, so the device is Viewtron Driveway and the entities are sensor.viewtron_driveway_license_plate, sensor.viewtron_driveway_status, image.viewtron_driveway_plate and image.viewtron_driveway_overview. If the event has no camera name, the IP address is used instead (192.168.0.50 becomes sensor.viewtron_192_168_0_50_license_plate). Check the device page for the exact IDs on your system.

    Home Assistant MQTT device page for a Viewtron LPR camera showing the License Plate, Status, Overview and Plate entities

    The status sensor also carries the plate number, camera name and a timestamp as attributes, and the timestamp changes with every read. The automations below use that. Every new read also updates the plate and overview images, so a picture card on your dashboard always shows the last plate.

    Home Assistant dashboard with the Viewtron LPR camera plate number, whiteList status, garage door and the plate image entity

    5. Add your plates to the allow list on the camera

    The plate list is stored on the camera, not in Home Assistant. On the License Plate Detection page, open the vehicle database and click Add. Enter the plate number and pick the List Type. You can also give a plate a start and end time, which is handy for guests, contractors and deliveries. Bulk Entry lets you upload a CSV file of plates.

    Viewtron LPR camera Vehicle information screen with plate number, List Type allow list and start and end time

    The status sensor shows exactly what the camera reports. The values are case sensitive, so type them exactly like this in your automations:

    • whiteList: the plate is on the Allow list
    • blackList: the plate is on the Block list
    • temporaryList: the plate is a Temporary vehicle and inside its date range
    • Unknown: the plate is not in the camera’s database, or it is listed but outside its start and end time

    If the plate reads come from a Viewtron NVR instead of straight from the camera, the status is the name of the plate group you created on the NVR (for example Residents), or Unknown. Use your own group names in the automations.

    Update, October 8, 2026: I tested this with a real drive-by past an LPR-IP4 running firmware 5.3.1. The test plate IB36NL was on the camera’s allow list. The camera read it at 99% confidence as the car came toward the camera.

    Viewtron LPR-IP4 overview image of a car with plate IB36NL driving toward the camera

    Here is the plate crop the camera sent with that read:

    License plate crop of IB36NL from the Viewtron LPR camera

    Home Assistant changed the status sensor to whiteList and the license plate sensor to IB36NL:

    Home Assistant logbook showing Viewtron IPC Status changed to whiteList and Viewtron IPC License Plate changed to IB36NL

    Older LPR-IP4 cameras on 5.1.x firmware do not send the list status at all, so on those cameras the status sensor shows Unknown for every plate.

    If you would rather manage plates from a script, the viewtron Python SDK can do it:

    pip install viewtron
    
    from viewtron import ViewtronCamera
    
    camera = ViewtronCamera("192.168.0.20", "admin", "password")
    camera.add_plate("ABC1234")   # adds the plate to the allow list

    6. How do I open the garage door when an allowed plate is read?

    Here is the automation I use. It opens the garage for allow list and temporary plates, and only if the door is closed. Add it to your automations.yaml file, then reload automations under Developer tools > YAML. Change driveway to your camera’s name and cover.garage_door to your own door or gate.

    - id: viewtron_lpr_open_garage
      alias: "LPR: Open garage for allowed plates"
      description: "Opens the garage when the driveway LPR camera reads a plate on the allow list or temporary list."
      triggers:
        - trigger: state
          entity_id: sensor.viewtron_driveway_status
          attribute: timestamp
      conditions:
        - condition: template
          value_template: >-
            {{ trigger.from_state is not none
               and trigger.from_state.state not in ['unknown', 'unavailable']
               and trigger.to_state.state in ['whiteList', 'temporaryList'] }}
        - condition: state
          entity_id: cover.garage_door
          state: "closed"
      actions:
        - action: cover.open_cover
          target:
            entity_id: cover.garage_door
      mode: single

    A few notes on why it is written this way:

    • It triggers on the timestamp attribute, not on the status. A plain to: "whiteList" trigger only fires when the status changes, so it would miss your second car pulling in right after the first one.
    • The from_state check means a Home Assistant restart, or the very first read that creates the entities, never opens the door.
    • If the reads come from an NVR, replace whiteList and temporaryList with your NVR group names.

    Home Assistant automation that opens the garage door when the Viewtron LPR camera reads an allow list plate

    7. How do I get a phone alert for an unknown plate?

    This one sends a notification to the Home Assistant mobile app with the plate number and the plate picture whenever the camera reads a plate that is not in its database. Replace mobile_app_your_phone with your phone’s notify action (you can find it under Developer tools > Actions by typing notify).

    - id: viewtron_lpr_unknown_alert
      alias: "LPR: Alert on unknown plate"
      description: "Sends a phone alert with the plate crop when the driveway camera reads a plate that is not in its database."
      triggers:
        - trigger: state
          entity_id: sensor.viewtron_driveway_status
          attribute: timestamp
      conditions:
        - condition: template
          value_template: >-
            {{ trigger.from_state is not none
               and trigger.from_state.state not in ['unknown', 'unavailable']
               and trigger.to_state.state == 'Unknown' }}
      actions:
        - action: notify.mobile_app_your_phone
          data:
            title: "Unknown vehicle in the driveway"
            message: "Plate {{ trigger.to_state.attributes.plate_number }} was just read by the driveway camera."
            data:
              image: /api/image_proxy/image.viewtron_driveway_plate
      mode: queued

    The plate number comes from the status sensor’s own attributes, so the message always matches the read that triggered it. Your phone has to be able to reach Home Assistant (on your WiFi or through your normal remote access) to load the picture. For a block list alert, copy this automation and change 'Unknown' to 'blackList'.

    Home Assistant automation that sends a phone notification when the Viewtron LPR camera reads an unknown license plate

    Is a license plate a safe way to open a gate or garage?

    It is a convenience key, not strong security. Anyone can copy a plate number. My advice:

    • Keep the “door is closed” condition, and add a time window or a “my phone is home” condition if you want a second check.
    • Be careful about opening a door that leads straight into the house on a plate read alone.
    • Keep a normal way to open and close the door, and a notification when it opens.

    For a gate, the LPR-IP4 also has a built-in alarm relay output that the camera can trigger from its own allow list, and a 26 bit Wiegand port for access control panels. Those work even when Home Assistant is down. I explain the relay and Wiegand options in this LPR camera API gate automation topic.

    Privacy is simple with this setup. The plate reads stay on your camera and your Home Assistant server. Nothing is sent to an outside plate service or shared network. The only thing that leaves your network is the push notification to your phone through the Home Assistant mobile app.

    How is this different from Frigate LPR in Home Assistant?

    Frigate can do license plate recognition too, and a lot of people use it. The difference is where the work happens:

    • Frigate reads plates from the camera’s video stream on your server, so your server does the detection and the text reading. A regular security camera at night often gives it a plate that is blurred by motion or washed out by headlights and IR.
    • A dedicated LPR camera does the read itself, with a zoom lens, exposure settings and IR made for plates. Your Home Assistant server only receives the result, so you do not need a GPU or Coral.

    You can use both. Keep Frigate or Blue Iris for recording video, and use the LPR camera’s plate events for the automations. You can see how the LPR-IP4 does after dark in my night license plate recognition test.

    Related

    Questions about Home Assistant license plate recognition or the LPR camera API? Email info@cctvcamerapros.net or call / text 1-561-433-8488.