Meter Reading Examples
Complete examples for meter reading with the Anyline Web SDK.
| The Web SDK supports auto analog/digital meter, dial meter, and multi-field digital meter scan modes only. |
Supported Scan Modes
The Web SDK supports the following meter scan modes:
-
auto_analog_digital_meter- Automatically detects analog or digital meters, including 7-segment and dot matrix displays -
dial_meter- Scans dial meters with up to 1 decimal place -
multi_field_digital_meter- Scans digital meters that show an OBIS code with the value
Auto Analog/Digital Meter
Automatically detects and scans both analog and digital meters:
import { init } from '@anyline/anyline-js';
const anyline = init({
license: 'YOUR_LICENSE_KEY',
element: document.getElementById('scanner-root'),
preset: 'meter' // Uses auto_analog_digital_meter scan mode
});
anyline.onResult = ({ result }) => {
const meterReading = result.meterResult;
console.log('Meter Result:', meterReading);
};
anyline.startScanning();
Available preset: meter (auto analog/digital)
Dial Meter
Scan dial meters with rotating needle indicators:
import { init } from '@anyline/anyline-js';
const anyline = init({
license: 'YOUR_LICENSE_KEY',
element: document.getElementById('scanner-root'),
preset: 'dialmeter' // Uses dial_meter scan mode
});
anyline.onResult = ({ result }) => {
const dialReading = result.meterResult;
console.log('Dial Meter:', dialReading);
};
anyline.startScanning();
The dial_meter mode:
-
Scans different types of dial meters
-
Supports up to 1 decimal place (red dial)
-
Common for older gas and water meters
Available preset: dialmeter (dial_meter)
Multi-Field Digital Meter (OBIS)
Scan digital meters that show an OBIS code with the value:
import { init } from '@anyline/anyline-js';
const anyline = init({
license: 'YOUR_LICENSE_KEY',
element: document.getElementById('scanner-root'),
preset: 'multi_field_meter' // Uses multi_field_digital_meter scan mode
});
anyline.onResult = ({ result }) => {
const { value, position } = result.meterResult;
console.log('OBIS code:', position, 'Value:', value);
};
anyline.startScanning();
The multi_field_digital_meter mode:
-
Returns the value and its OBIS code
-
Returns the OBIS code as
position, without dots (e.g.180for1.8.0) -
Keeps scanning after each result, because the meter display cycles through its registers. Collect the results by
positionand callstopScanning()when you have all the registers you need -
Uses its own data file. Without the preset, the SDK selects it automatically when
scanModeismulti_field_digital_meter
Available preset: multi_field_meter (multi_field_digital_meter)
Configuration Reference
For detailed information about all configuration parameters including meterConfig, scan modes, and their default values, see Meter Technical Capabilities.
Result Structure
For the complete result structure, see the Plugin Result JSON Schema.
See Also
-
Meter Technical Capabilities - Complete meter configuration
-
General Examples - Common SDK examples
-
API Reference - Complete API documentation
-
Plugin Configuration - Configuration options
-
Getting Started - Getting started guide