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

homebridge-evn-smartmeter

v2.0.1

Published

Homebridge plugin for EVN Smartmeter MQTT data integration

Readme

Homebridge EVN Smartmeter

npm version

Homebridge plugin for integrating EVN Smartmeter (Kaifa) data into Apple HomeKit via MQTT.

What's New in v2.0.0

🎉 BREAKING CHANGE - Power now displays in Watts instead of Kilowatts!

  • Full Precision Visible: Power values now show exact Watts in Home app (e.g., -522 W)
  • No more rounding: See -522°C instead of -0.5°C (HomeKit limitation solved!)
  • Display mapping: 1°C = 1 Watt (previously 1°C = 1 kW)
  • Range: ±10,000 W (±10 kW equivalent)
  • Periodic Logging: All 12 parameters logged every 60 seconds
  • Automatic unit conversion: Wh → kWh for energy
  • Extended energy range: Up to 999,999 kWh
  • Improved display order: Energy → Power → Current → Voltage

⚠️ IMPORTANT for existing users:

  • Power values now display in Watts (W) instead of Kilowatts (kW)
  • -522°C = -522 Watt (previously -0.5°C = -0.5 kW)
  • Update your automations: "3000°C" for 3 kW (previously "3°C")
  • Accessories will be automatically recreated on first restart

Why this change? HomeKit's Temperature Sensor rounds to 1 decimal place, which was hiding precision when using kW. By switching to Watts, we completely bypass this limitation and you see the full precision directly in the Home app!

Features

  • Real-time monitoring of 12 smartmeter measurements
  • 4 HomeKit accessories grouped by function (in display order):
    • Energy Meter (Energy Consumed, Energy Fed) - displays in kWh
    • Power Monitor (Total Power, Power Draw, Power Feed-in) - displays in Watts with full precision
    • Current Monitor (Current L1, L2, L3, Power Factor) - displays with 1 decimal precision
    • Voltage Monitor (Voltage L1, L2, L3) - displays with 1 decimal precision
  • Full precision in Home app: Power values show exact Watts (no decimal rounding!)
  • Automatic unit conversion: Wh → kWh for energy (power stays in W for full precision)
  • 1 Watt resolution: See every single Watt change in the Home app
  • Periodic logging: All 12 parameters logged every 60 seconds to Homebridge log
  • Large value support: Energy values up to 999,999 kWh, Power values up to ±10,000 W
  • Auto-reconnect for reliable MQTT connection
  • Easy configuration via Homebridge Config UI
  • HomeKit Automations support (e.g., trigger when power > threshold)
  • Automatic migration from older plugin versions

Periodic Logging Output

Every 60 seconds, all measurements are logged to Homebridge:

[1/25/2026, 12:00:00 PM] [EVN Smartmeter] ========================================
[1/25/2026, 12:00:00 PM] [EVN Smartmeter] ALL MEASUREMENTS (Current Values)
[1/25/2026, 12:00:00 PM] [EVN Smartmeter] ========================================
[1/25/2026, 12:00:00 PM] [EVN Smartmeter]   Energy Consumed      20906 kWh (20906011 Wh) (2s ago)
[1/25/2026, 12:00:00 PM] [EVN Smartmeter]   Energy Fed           2261 kWh (2261314 Wh) (2s ago)
[1/25/2026, 12:00:00 PM] [EVN Smartmeter]   Total Power          -522 W (2s ago)
[1/25/2026, 12:00:00 PM] [EVN Smartmeter]   Power Draw           0 W (2s ago)
[1/25/2026, 12:00:00 PM] [EVN Smartmeter]   Power Feed-in        522 W (2s ago)
[1/25/2026, 12:00:00 PM] [EVN Smartmeter]   Current L1           1.4 A (2s ago)
[1/25/2026, 12:00:00 PM] [EVN Smartmeter]   Current L2           1.4 A (2s ago)
[1/25/2026, 12:00:00 PM] [EVN Smartmeter]   Current L3           1.4 A (2s ago)
[1/25/2026, 12:00:00 PM] [EVN Smartmeter]   Power Factor         89.1% (0.891) (2s ago)
[1/25/2026, 12:00:00 PM] [EVN Smartmeter]   Voltage L1           235.1 V (2s ago)
[1/25/2026, 12:00:00 PM] [EVN Smartmeter]   Voltage L2           236.7 V (2s ago)
[1/25/2026, 12:00:00 PM] [EVN Smartmeter]   Voltage L3           236.3 V (2s ago)
[1/25/2026, 12:00:00 PM] [EVN Smartmeter] ========================================

Note: Power values show in Watts only (simple and clean). The -522 W is what you see in the Home app as -522°C.

Requirements

  • Homebridge v1.6.0 or later
  • Node.js v18.0.0 or later
  • MQTT Broker (e.g., Mosquitto)
  • EVN_Smartmeter daemon running and publishing to MQTT

Installation

Via Homebridge Config UI X (Recommended)

  1. Search for "EVN Smartmeter" in the Plugins tab
  2. Click Install
  3. Configure the plugin via the UI
  4. Restart Homebridge

Via npm

npm install -g homebridge-evn-smartmeter

Quick Start: Reading Power Values

In v2.0, power values show full precision directly in the Home app!

  • Look at "Total Power" in the Home app
  • You'll see -522°C = -522 Watts = -0.522 kW
  • No rounding, no decimal places needed - full precision visible!

Optional: View Periodic Logs

Every 60 seconds, all measurements are logged to Homebridge:

# View live logs
tail -f ~/.homebridge/homebridge.log | grep "ALL MEASUREMENTS"

# Or for systemd installations
journalctl -u homebridge -f | grep "ALL MEASUREMENTS"

You'll see the values in their native units:

Total Power          -522 W (2s ago)

Configuration

Configure the plugin via Homebridge Config UI X or manually edit your config.json:

{
  "platforms": [
    {
      "platform": "EVNSmartmeter",
      "name": "EVN Smartmeter",
      "mqtt": {
        "broker": "172.16.0.140",
        "port": 1883,
        "username": "",
        "password": "",
        "topic_prefix": "Smartmeter"
      },
      "display": {
        "showPowerMonitor": true,
        "showEnergyMeter": true,
        "showVoltageMonitor": true,
        "showCurrentMonitor": true
      }
    }
  ]
}

Configuration Options

| Option | Required | Default | Description | |--------|----------|---------|-------------| | platform | Yes | EVNSmartmeter | Must be "EVNSmartmeter" | | name | No | EVN Smartmeter | Platform name | | mqtt.broker | Yes | - | MQTT broker IP address or hostname | | mqtt.port | No | 1883 | MQTT broker port | | mqtt.username | No | - | MQTT username (if authentication required) | | mqtt.password | No | - | MQTT password (if authentication required) | | mqtt.topic_prefix | No | Smartmeter | MQTT topic prefix | | display.showPowerMonitor | No | true | Show Power Monitor accessory | | display.showEnergyMeter | No | true | Show Energy Meter accessory | | display.showVoltageMonitor | No | true | Show Voltage Monitor accessory | | display.showCurrentMonitor | No | true | Show Current Monitor accessory |

HomeKit Service Mapping

Since HomeKit doesn't have native "Power" or "Energy" services, this plugin uses available service types with appropriate value mappings:

Energy Meter (Light Sensors)

| Measurement | MQTT Topic | MQTT Value | Displays As | Converted Unit | Range | |-------------|------------|------------|-------------|----------------|-------| | Energy Consumed | Smartmeter/WirkenergieP | Wh | Light Level (Lux) | kWh | 0-999999 kWh | | Energy Fed | Smartmeter/WirkenergieN | Wh | Light Level (Lux) | kWh | 0-999999 kWh |

Conversion: Raw Wh values are divided by 1000 and rounded to whole kWh Example: 20906011 Wh → 20906 kWh (displayed as 20906 Lux)

Power Monitor (Temperature Sensors)

| Measurement | MQTT Topic | MQTT Value | Displays As | Display Unit | Range | |-------------|------------|------------|-------------|--------------|-------| | Total Power | Smartmeter/Momentanleistung | W | Temperature (°C) | W (Watts) | -10,000 to +10,000 W | | Power Draw | Smartmeter/MomentanleistungP | W | Temperature (°C) | W (Watts) | 0 to +10,000 W | | Power Feed-in | Smartmeter/MomentanleistungN | W | Temperature (°C) | W (Watts) | 0 to +10,000 W |

NEW in v2.0: Power values are displayed directly in Watts (no conversion to kW) Display Mapping: 1°C = 1 Watt Example: -522 W → -522°C (displayed as -522°C in Home app) Precision: 1 Watt resolution, full precision visible in Home app! Why? By displaying in Watts instead of kW, we bypass HomeKit's 1-decimal-place limitation

Current Monitor (Temperature Sensors)

| Measurement | MQTT Topic | MQTT Value | Displays As | Unit | Range | |-------------|------------|------------|-------------|------|-------| | Current L1 | Smartmeter/StromL1 | A | Temperature (°C) | Ampere | 0-100 A | | Current L2 | Smartmeter/StromL2 | A | Temperature (°C) | Ampere | 0-100 A | | Current L3 | Smartmeter/StromL3 | A | Temperature (°C) | Ampere | 0-100 A | | Power Factor | Smartmeter/Leistungsfaktor | 0-1 | Temperature (°C) | Factor | 0-100 (%) |

Power Factor Conversion: Raw value (0-1) is multiplied by 100 for display Example: 0.888 → 88.8 (displayed as 88.8°C) Precision: 0.1 for current and power factor

Voltage Monitor (Temperature Sensors)

| Measurement | MQTT Topic | MQTT Value | Displays As | Unit | Range | |-------------|------------|------------|-------------|------|-------| | Voltage L1 | Smartmeter/SpannungL1 | V | Temperature (°C) | Volt | 0-300 V | | Voltage L2 | Smartmeter/SpannungL2 | V | Temperature (°C) | Volt | 0-300 V | | Voltage L3 | Smartmeter/SpannungL3 | V | Temperature (°C) | Volt | 0-300 V |

Precision: 0.1 V

Note: While the values display as °C or Lux in HomeKit, they represent the actual physical units (kW, kWh, V, A). This mapping allows the plugin to work with HomeKit's native service types and enables use in automations.

Usage Examples

Reading Power Consumption

In the Home app, the "Total Power" sensor shows your current power consumption (or feed-in if negative/solar):

  • -522°C = -522 Watt = -0.522 kW feed-in (solar)
  • 1500°C = 1500 Watt = 1.5 kW consumption
  • 1°C = 1 Watt minimum resolution

Creating Automations

  1. Open Home app → Automation
  2. Create automation: "When Total Power is above 3000°C" (= 3000 W = 3 kW)
  3. Add action: Send notification "High power consumption!"

Note: When setting thresholds in automations, remember that the displayed °C value equals Watts (e.g., 5000°C = 5000 W = 5 kW).

Monitoring Energy Usage

The Energy Meter accessory shows cumulative values:

  • Energy Consumed: Total kWh consumed (displayed as Lux)
    • Example: 20906 Lux = 20906 kWh
  • Energy Fed: Total kWh fed back to grid (displayed as Lux)
    • Example: 2261 Lux = 2261 kWh

Solar Feed-in Monitoring

For solar installations, use the "Power Feed-in" sensor:

  • Positive values indicate feed-in to grid
  • Total Power shows negative values during feed-in
  • Create automation: "When Power Feed-in is above 2000°C" (= 2000 W = 2 kW solar production)

FAQ

Why do power values show as °C in HomeKit?

HomeKit doesn't have native "Power" or "Energy" service types. The plugin uses Temperature sensors (which support negative values needed for solar feed-in) and maps Watt values to the °C display. Think of the displayed °C value as Watts (W).

What's the difference between "Total Power", "Power Draw", and "Power Feed-in"?

  • Total Power (Momentanleistung): Net power - negative when feeding in, positive when consuming
  • Power Draw (MomentanleistungP): Power consumed from grid (always ≥ 0)
  • Power Feed-in (MomentanleistungN): Power fed back to grid (always ≥ 0)

For solar: When generating 2000 W and consuming 500 W:

  • Total Power: -1500 W (net feed-in) → displays as -1500°C
  • Power Draw: 500 W (local consumption) → displays as 500°C
  • Power Feed-in: 2000 W (solar generation) → displays as 2000°C

Can I use these values in HomeKit automations?

Yes! You can create automations based on any sensor value. For example:

  • "When Total Power is above 3000°C" (3000 W = 3 kW consumption)
  • "When Power Feed-in is above 1000°C" (1000 W = 1 kW solar production)
  • "When Energy Consumed is above 20000" (20000 kWh lifetime)

Why does the plugin remove and recreate services on update?

To ensure compatibility and correct display after updates, the plugin performs an "aggressive service cleanup" that removes all old services and creates fresh ones with the correct configuration. This happens automatically on the first restart after an update.

What's the precision of power measurements?

Power values are displayed in whole Watts (W) with 1 Watt resolution:

  • Stored internally: Whole Watts (e.g., -522 W)
  • Displayed in Home app: Whole Watts as °C (e.g., -522°C)
  • Available in automations: Full precision (e.g., trigger at exactly 522 W)
  • Logged to Homebridge: Shown in both W and kW (e.g., "-522 W (-0.522 kW)")

By displaying in Watts instead of kW, you see the full precision directly in the Home app - no need to check logs!

Why did you switch from kW to W in v2.0?

Problem in v1.x: HomeKit's Temperature Sensor rounds to 1 decimal place. When displaying in kW:

  • Actual: -0.522 kW
  • Displayed: -0.5 kW (rounded!)
  • Lost precision: 22 Watts invisible

Solution in v2.0: Display in Watts instead:

  • Actual: -522 W
  • Displayed: -522°C (exact!)
  • Full precision visible!

This completely bypasses HomeKit's decimal rounding limitation.

Troubleshooting

Plugin not connecting to MQTT

  1. Check MQTT broker is running:

    sudo systemctl status mosquitto
  2. Test MQTT manually:

    mosquitto_sub -h 172.16.0.140 -t "Smartmeter/#" -v
  3. Check Homebridge logs for connection errors:

    tail -f ~/.homebridge/homebridge.log
  4. Verify broker IP and port in plugin configuration

Values not updating

  1. Ensure EVN_Smartmeter daemon is running and publishing
  2. Check topic prefix matches between daemon and plugin
  3. Test publishing manually:
    mosquitto_pub -h 172.16.0.140 -t "Smartmeter/Momentanleistung" -m "1500"
  4. Check Homebridge logs for MQTT errors

Accessories show "No Response"

  • MQTT connection is lost
  • Plugin will automatically attempt to reconnect
  • Check MQTT broker status
  • Restart Homebridge if issue persists

Wrong values displayed

  • Check topic prefix in configuration
  • Verify EVN_Smartmeter is publishing numeric values (not JSON)
  • Check Homebridge logs for parsing errors

Values showing in Watts instead of kW

If you see values like -522°C instead of -0.522°C:

  1. Check installed plugin version:

    npm list -g homebridge-evn-smartmeter

    Should be v1.2.0 or higher

  2. Update to latest version:

    npm install -g homebridge-evn-smartmeter@latest
  3. Restart Homebridge - the plugin will automatically migrate old services

  4. Check Homebridge logs for migration messages:

    [PowerMonitor] Performing aggressive service cleanup...
    [PowerMonitor] Removing service: ...

After update, accessories show "No Response"

This is normal during the first restart after an update:

  1. The plugin removes old cached services
  2. Creates new services with correct configuration
  3. HomeKit needs a few seconds to recognize the new services
  4. Wait 30-60 seconds, then the accessories should respond

If issue persists:

  1. Remove the accessories from HomeKit completely
  2. Restart Homebridge
  3. Re-add the accessories to HomeKit

Known Limitations

  1. Service Type Mapping: HomeKit displays Watts as °C, kWh as Lux, etc. This is a HomeKit limitation, not a bug. Since HomeKit has no native power/energy types, we use Temperature/Light sensors.

  2. Unit Display: Power shows as "°C" in the Home app but represents Watts (W). Think of it as: 1°C = 1 Watt. For convenience, remember: 1000°C = 1 kW.

  3. Energy Counter Range: Light sensors support values up to 999,999 kWh. This should be sufficient for most use cases (equivalent to 999,999,000 Wh).

  4. Negative Values: Only Temperature sensors support negative values (important for solar feed-in). This is why Power Monitor uses Temperature sensors.

  5. Power Range: Power values are limited to ±10,000 W (±10 kW). For installations with higher peak loads, values will be clamped to this range.

  6. Migration from v1.x: When updating from v1.x to v2.0, you'll need to update your automations. What was "3°C" (= 3 kW) is now "3000°C" (= 3000 W). The plugin automatically recreates accessories with the new unit.

Development

Building from Source

git clone https://github.com/RaithChr/homebridge-evn-smartmeter.git
cd homebridge-evn-smartmeter
npm install
npm run build

Local Testing

npm link

Then restart Homebridge to load the locally installed plugin.

Testing MQTT Connection

The repository includes test scripts for debugging:

# Test raw MQTT values (no conversion)
node test-mqtt.js

# Test plugin logic (with conversions)
node test-plugin-logic.js

# Run diagnostics
node diagnose.js

These scripts connect directly to your MQTT broker and show the raw values and conversions in real-time.

Viewing Periodic Logs

The plugin automatically logs all 12 measurement values every 60 seconds to the Homebridge log. To view these logs:

# For systemd-based Homebridge installations
journalctl -u homebridge -f | grep "ALL MEASUREMENTS"

# For standard Homebridge installations
tail -f ~/.homebridge/homebridge.log | grep "ALL MEASUREMENTS"

# For Homebridge Config UI X
# Open the UI and go to Logs tab

Example log output:

[1/25/2026, 12:00:00 PM] [EVN Smartmeter] ========================================
[1/25/2026, 12:00:00 PM] [EVN Smartmeter] ALL MEASUREMENTS (Current Values)
[1/25/2026, 12:00:00 PM] [EVN Smartmeter] ========================================
[1/25/2026, 12:00:00 PM] [EVN Smartmeter]   Energy Consumed      20906 kWh (20906011 Wh) (2s ago)
[1/25/2026, 12:00:00 PM] [EVN Smartmeter]   Energy Fed           2261 kWh (2261314 Wh) (2s ago)
[1/25/2026, 12:00:00 PM] [EVN Smartmeter]   Total Power          -0.522 kW (-522 W) (2s ago)
[1/25/2026, 12:00:00 PM] [EVN Smartmeter]   Power Draw           0.000 kW (0 W) (2s ago)
[1/25/2026, 12:00:00 PM] [EVN Smartmeter]   Power Feed-in        0.522 kW (522 W) (2s ago)
[1/25/2026, 12:00:00 PM] [EVN Smartmeter]   Current L1           1.4 A (2s ago)
[1/25/2026, 12:00:00 PM] [EVN Smartmeter]   Current L2           1.4 A (2s ago)
[1/25/2026, 12:00:00 PM] [EVN Smartmeter]   Current L3           1.4 A (2s ago)
[1/25/2026, 12:00:00 PM] [EVN Smartmeter]   Power Factor         89.1% (0.891) (2s ago)
[1/25/2026, 12:00:00 PM] [EVN Smartmeter]   Voltage L1           235.1 V (2s ago)
[1/25/2026, 12:00:00 PM] [EVN Smartmeter]   Voltage L2           236.7 V (2s ago)
[1/25/2026, 12:00:00 PM] [EVN Smartmeter]   Voltage L3           236.3 V (2s ago)
[1/25/2026, 12:00:00 PM] [EVN Smartmeter] ========================================

Support

For issues, feature requests, or questions:

  • GitHub Issues: https://github.com/RaithChr/homebridge-evn-smartmeter/issues
  • Homebridge Discord: https://discord.gg/homebridge

Credits

  • Based on EVN_Smartmeter Python daemon
  • Compatible with EVN Kaifa smart meters

License

MIT License - see LICENSE file for details

Changelog

See CHANGELOG.md for version history and updates.