Automated reading of power meters

This is probably a long shot, but I’m attempting to replace my client’s MS Access based utility billing system (which I developed over the past 20 years) with a Knack app. The power company bills us by building from a single power meter and we prorate that cost back to the building’s tenants based on their individual usage, as measured by our own meters. We read approximately 350 meters per month, so replacing all the meters isn’t an option at this time.

Our staffers currently take a picture of the unit’s meter (see attached) and these are sent to the admin office where they are manually read and entered into the utility billing system for processing. We have experimented with several AI products to see if we can automate the reading process but -so far - none have provided enough accuracy to be useful. Has anyone out there had any luck with a similar task?

(P.S. the meter reading is given by the set of 5 circular dials just above meter center. The large number across the bottom also needs to be captured, as that is the meter number)

Hi @BajaRic,

I’m confident this is something I can help you with.
Send me an email at nd@ctrnd.com so we can discuss the options.

Norm

I think this can be done as well (well, AI thinks it can be done :wink: ).

:sparkles: The solution outlined below is from AI and needs human verification :sparkles:

Automating Analog Meter Reading with Knack Flows and OpenAI Vision

This document outlines the solution for replacing a manual data entry process with an automated, AI-powered image recognition pipeline using Knack Flows and OpenAI’s Vision API. This approach allows field staff to simply take photos of analog utility meters and have the readings and serial numbers automatically extracted and saved to the database.

The Challenge

The current process involves field staff taking photos of approximately 350 analog utility meters each month. These photos are sent to an admin office where they are manually read and entered into a utility billing system. The meters feature 5 alternating analog dials (clockwise and counter-clockwise) and a large printed serial number.

Replacing the physical meters with smart meters is not an option at this time. Previous attempts with standard OCR (Optical Character Recognition) tools failed to provide sufficient accuracy due to the complex nature of reading alternating analog dials.

The Solution: Knack Flows + OpenAI Vision

By combining a Knack application with its native Flows automation engine and OpenAI’s GPT-4o vision model, we can achieve highly accurate, fully automated meter reading without replacing any hardware.

Why This Works

Unlike traditional OCR which simply tries to recognize text shapes, large multimodal models (LMMs) like GPT-4o can actually “understand” the visual context. When given a specific prompt explaining how to read an alternating dial meter (e.g., “read the lower of the two numbers the pointer is between”), the AI correctly interprets the visual state of the dials and returns the exact 5-digit reading.

The Automated Pipeline

The solution is built entirely within Knack using a 3-step Flow:

  1. Trigger: Record Created

    • Field staff use a Knack mobile form to create a new “Meter Reading” record and upload a photo of the meter from their phone.
    • Knack saves the record and stores the image, generating a public S3 URL for the file.
    • This action instantly triggers the Flow.
  2. Action 1: Custom API Request (OpenAI)

    • The Flow sends a POST request to OpenAI’s Chat Completions endpoint (https://api.openai.com/v1/chat/completions).
    • The request uses the gpt-4o model and includes the image URL provided by Knack in Step 1.
    • A highly specific system prompt instructs the AI to read the 5 dials and the serial number, returning the result in a strict JSON format.
  3. Action 2: Update Record (Knack)

    • The Flow takes the JSON response from OpenAI and maps the extracted meter_reading and serial_number back to the original Meter Reading record in Knack.
    • The Knack application then uses formula fields to calculate the “Usage This Period” (Current Reading - Previous Reading) and generates the prorated bill.

Configuration Guide for Knack Flows

Because the native “ChatGPT (OpenAI): Create chat completion” action in Knack Flows only supports text prompts, you must use the Custom API Request action to pass the image URL to the vision model.

Step 1: Set Up the Trigger

  • App: Knack
  • Event: Record Created
  • Connection: Your Knack App
  • Table: Meter Readings

Step 2: Configure the Custom API Request

Add an action step and select ChatGPT (OpenAI)Custom API Request.

Connection Details:

  • Method: POST
  • URL: https://api.openai.com/v1/chat/completions

Request Headers:

  • Content-Type: application/json
  • Authorization: Bearer YOUR_OPENAI_API_KEY

Request Parameters (Nested JSON Structure):
To format the vision request correctly, use the parameter builder to create this structure:

  • model (String) = gpt-4o
  • messages[0][role] (String) = user
  • messages[0][content][0][type] (String) = text
  • messages[0][content][0][text] (String) = You are an expert utility meter reader. Read the 5 circular analog dials labeled KILOWATTHOURS. The dials alternate direction. For each dial read the lower number the pointer is between. Report as a 5-digit number. Also read the large bold serial number at the bottom. Respond ONLY in JSON: {"meter_reading":"XXXXX","serial_number":"XXXXXXXX","confidence":"high/medium/low","notes":"any issues"}
  • messages[0][content][1][type] (String) = image_url
  • messages[0][content][1][image_url][url] (String) = [Map this to the Image URL field from Step 1]

Step 3: Update the Knack Record

Add a final action step to update the original record.

  • App: Knack
  • Action: Update Record
  • Table: Meter Readings
  • Record ID: Map to the Record ID from Step 1
  • AI Extracted Reading: Map to the meter_reading output from Step 2
  • AI Extracted Serial: Map to the serial_number output from Step 2

Cost and Performance

  • Accuracy: In testing, GPT-4o correctly read both the 5-dial sequence and the 8-digit serial number from the sample Westinghouse meter image.
  • Speed: The entire flow executes in approximately 5-10 seconds from the moment the field worker submits the form.
  • Cost: Processing an image with GPT-4o costs roughly $0.01 to $0.02 per image. For 350 meters per month, the total AI API cost will be under $7.00 per month.

This solution provides a modern, automated pipeline while preserving the existing physical infrastructure, demonstrating the power of combining Knack’s flexible database with advanced AI vision capabilities.

That’s a pretty neat approach but I’d be concerned about sorting the images with public access. Im thinking there may be use cases where security is more of a concern.

Q: Is there a way in Knack to change the way an image is stored, so that the public link is only temporary until AI has done its thing, then it gets stored in a secure way?

Or would I need to store the image twice, and delete the insecure version after AI has responded?