npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@ya-modbus/driver-ex9em

v0.5.0

Published

NOARK Ex9EM Energy Meter driver for ya-modbus

Readme

@ya-modbus/driver-ex9em

NOARK Ex9EM Energy Meter driver for ya-modbus

Features

  • Read voltage, current, and grid frequency
  • Read active, reactive, and apparent power
  • Read power factor
  • Read total active and reactive energy consumption
  • Single-transaction batch reading for optimal performance
  • Full TypeScript support with comprehensive type definitions

Installation

npm install @ya-modbus/driver-ex9em

Usage

import { createDriver, DEFAULT_CONFIG } from '@ya-modbus/driver-ex9em'
import { createRTUTransport } from '@ya-modbus/transport-rtu'

// Create transport with factory default settings
const transport = await createRTUTransport({
  port: '/dev/ttyUSB0',
  baudRate: DEFAULT_CONFIG.baudRate,
  parity: DEFAULT_CONFIG.parity,
  dataBits: DEFAULT_CONFIG.dataBits,
  stopBits: DEFAULT_CONFIG.stopBits,
  slaveId: DEFAULT_CONFIG.defaultAddress,
})

// Create driver
const driver = await createDriver({ transport })

// Read single data point
const voltage = await driver.readDataPoint('voltage')
console.log(`Voltage: ${voltage}V`)

// Read multiple data points (single transaction)
const values = await driver.readDataPoints([
  'voltage',
  'current',
  'active_power',
  'total_active_energy',
])
console.log(values)

Available Data Points

| ID | Name | Type | Unit | Access | Description | | ----------------------- | --------------------- | ------- | ----- | ------ | ----------------------------------------------------- | | voltage | Voltage | float | V | r | Line voltage in volts | | current | Current | float | A | r | Line current in amperes | | frequency | Grid Frequency | float | Hz | r | Grid frequency in hertz | | active_power | Active Power | integer | W | r | Active power in watts | | reactive_power | Reactive Power | integer | VAr | r | Reactive power in volt-amperes reactive | | apparent_power | Apparent Power | integer | VA | r | Apparent power in volt-amperes | | power_factor | Power Factor | float | | r | Power factor (0.000-1.000, dimensionless) | | total_active_energy | Total Active Energy | float | kWh | r | Total active energy consumption | | total_reactive_energy | Total Reactive Energy | float | kVArh | r | Total reactive energy | | device_address | Device Address | integer | | rw | Modbus address (1-247), changes after device restart | | baud_rate | Baud Rate | enum | | rw | Communication baud rate, changes after device restart |

Factory Default Configuration

{
  baudRate: 9600,
  parity: 'even',
  dataBits: 8,
  stopBits: 1,
  defaultAddress: 1
}

Supported Configuration

  • Baud rates: 1200, 2400, 4800, 9600 bps
  • Parity: even, none
  • Data bits: 8
  • Stop bits: 1
  • Slave address: 1-247 (standard Modbus range)

Configuration Changes

// Change device address
await driver.writeDataPoint('device_address', 5)

// Change baud rate
await driver.writeDataPoint('baud_rate', 4800)

// Note: Restart the device for changes to take effect

Important: According to the device documentation, configuration changes may require a password unlock mechanism using vendor-specific Modbus function code 0x28. This mechanism is not implemented in the driver. Configuration changes may work without it on some firmware versions, but YMMV. Consult the official register map PDF in docs/ for details.

Device Information

  • Manufacturer: NOARK Electric
  • Model: Ex9EM
  • Type: Single-phase energy meter
  • Protocol: Modbus RTU

Documentation

Official register map is available in docs/ex9em-1p-1m-80a-mo-mt-register-map.pdf.

Note: This implementation is based on verified working code with actual devices. Some registers (frequency at 0x0002 and power_factor at 0x0006) are not documented in the official PDF but are confirmed to work on physical devices.

License

GPL-3.0-or-later