Homebridge plugin for EVN Smartmeter MQTT data integration
npm install homebridge-evn-smartmeter
Homebridge plugin for integrating EVN Smartmeter (Kaifa) data into Apple HomeKit via MQTT.
🎉 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!
- 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
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.
- 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
1. Search for "EVN Smartmeter" in the Plugins tab
2. Click Install
3. Configure the plugin via the UI
4. Restart Homebridge
`bash`
npm install -g homebridge-evn-smartmeter
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!
`bashView live logs
tail -f ~/.homebridge/homebridge.log | 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:`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
}
}
]
}
`$3
| 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:
$3
| 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)
$3
| 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
$3
| 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
$3
| 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
$3
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$3
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).
$3
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$3
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
$3
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).$3
- 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
$3
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)$3
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.$3
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!
$3
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 invisibleSolution 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
$3
1. Check MQTT broker is running:
`bash
sudo systemctl status mosquitto
`2. Test MQTT manually:
`bash
mosquitto_sub -h 172.16.0.140 -t "Smartmeter/#" -v
`3. Check Homebridge logs for connection errors:
`bash
tail -f ~/.homebridge/homebridge.log
`4. Verify broker IP and port in plugin configuration
$3
1. Ensure EVN_Smartmeter daemon is running and publishing
2. Check topic prefix matches between daemon and plugin
3. Test publishing manually:
`bash
mosquitto_pub -h 172.16.0.140 -t "Smartmeter/Momentanleistung" -m "1500"
`
4. Check Homebridge logs for MQTT errors$3
- MQTT connection is lost
- Plugin will automatically attempt to reconnect
- Check MQTT broker status
- Restart Homebridge if issue persists
$3
- Check topic prefix in configuration
- Verify EVN_Smartmeter is publishing numeric values (not JSON)
- Check Homebridge logs for parsing errors
$3
If you see values like -522°C instead of -0.522°C:
1. Check installed plugin version:
`bash
npm list -g homebridge-evn-smartmeter
`
Should be v1.2.0 or higher2. Update to latest version:
`bash
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: ...
`$3
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
$3
`bash
git clone https://github.com/RaithChr/homebridge-evn-smartmeter.git
cd homebridge-evn-smartmeter
npm install
npm run build
`$3
`bash
npm link
`Then restart Homebridge to load the locally installed plugin.
$3
The repository includes test scripts for debugging:
`bash
Test raw MQTT values (no conversion)
node test-mqtt.jsTest plugin logic (with conversions)
node test-plugin-logic.jsRun diagnostics
node diagnose.js
`These scripts connect directly to your MQTT broker and show the raw values and conversions in real-time.
$3
The plugin automatically logs all 12 measurement values every 60 seconds to the Homebridge log. To view these logs:
`bash
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] ========================================
``For issues, feature requests, or questions:
- GitHub Issues: https://github.com/RaithChr/homebridge-evn-smartmeter/issues
- Homebridge Discord: https://discord.gg/homebridge
- Based on EVN_Smartmeter Python daemon
- Compatible with EVN Kaifa smart meters
MIT License - see LICENSE file for details
See CHANGELOG.md for version history and updates.