Skip to content

hatch01/izar

Repository files navigation

IZAR Water Meter Reader for ESPHome

ESP-IDF component for reading IZAR water meters (WMBUS-T mode) using CC1101 transceiver on ESP32-C6.

Quick Start

1. Hardware Setup

Required:

  • ESP32-C6 DevKit (or compatible board)
  • CC1101 Transceiver Module (868 MHz for Europe)
  • 868 MHz antenna for CC1101
  • IZAR Water Meter (WMBUS-T compatible)

Wiring:

CC1101 Pin ESP32-C6 Pin Description
GND GND Ground
VCC 3.3V Power
MOSI GPIO 7 SPI MOSI
MISO GPIO 2 SPI MISO
SCK GPIO 15 SPI Clock
CSN GPIO 6 Chip Select
GDO0 GPIO 0 (Optional)

2. ESPHome Configuration

Add this component to your ESPHome YAML configuration:

Method A: Using GitHub directly (recommended)

external_components:
  - source: github://hatch01/izar
    components: [ izar_water_meter ]

# Enable logging to find your meter ID
logger:
  level: INFO

# IZAR Water Meter configuration
izar_water_meter:
  # Optional: specify meter ID to filter (default: 0 = read all meters)
  # meter_id: 559927542

  water_consumption:
    name: "Water Consumption"
    unit_of_measurement: "L"
    device_class: "water"
    state_class: "total_increasing"
    accuracy_decimals: 0

  meter_id:
    name: "Meter ID"
    accuracy_decimals: 0

Method B: Using local copy

  1. Clone this repository into your ESPHome config directory:
cd /config/esphome
git clone https://github.com/hatch01/izar
  1. Reference it in your YAML:
external_components:
  - source: /config/esphome/izar/components
    components: [ izar_water_meter ]

3. Finding Your Meter ID

Step 1: Deploy without a specific meter ID (reads all meters):

izar_water_meter:
  # No meter_id specified = read all meters
  water_consumption:
    name: "Water Consumption"
  meter_id:
    name: "Meter ID"

Step 2: Watch the logs:

esphome logs your-device.yaml

You'll see output like:

[I][izar_water_meter:xxx]: Water meter data: ID=559927542, Usage=158043 L
[I][izar_water_meter:xxx]: Water meter data: ID=559927539, Usage=49405 L
[I][izar_water_meter:xxx]: Water meter data: ID=559927537, Usage=62918 L

Step 3: Find YOUR meter ID:

  • Check which meter ID corresponds to your actual water usage
  • Note: Multiple meters in range will be detected!

Step 4: Filter for your specific meter:

izar_water_meter:
  meter_id: 559927542  # Replace with YOUR meter ID
  water_consumption:
    name: "Water Consumption"
  meter_id:
    name: "Meter ID"

4. Complete Example Configuration

esphome:
  name: water-meter
  friendly_name: Water Meter

esp32:
  board: esp32-c6-devkitc-1
  variant: esp32c6
  framework:
    type: esp-idf

logger:
  level: INFO

api:
  encryption:
    key: !secret api_encryption_key

ota:
  - platform: esphome
    password: !secret ota_password

wifi:
  ssid: !secret wifi_ssid
  password: !secret wifi_password

# Use component from GitHub
external_components:
  - source: github://hatch01/izar
    components: [ izar_water_meter ]

# Configure water meter
izar_water_meter:
  meter_id: 559927542  # Your meter ID (0 = read all)

  water_consumption:
    name: "Water Consumption"
    unit_of_measurement: "L"
    device_class: "water"
    state_class: "total_increasing"
    accuracy_decimals: 0

  meter_id:
    name: "Meter ID"
    accuracy_decimals: 0

Detailed Information

Project Structure

izar/
├── components/
│   ├── cc1101/                    # CC1101 driver (nopnop2002/esp-idf-cc1101)
│   │   ├── cc1101.c
│   │   ├── cc1101.h
│   │   └── CMakeLists.txt
│   └── izar_water_meter/          # Main ESPHome component
│       ├── izar_water_meter.cpp   # ESPHome component implementation
│       ├── izar_water_meter.h
│       ├── izar_wmbus.cpp         # WMBUS-T protocol handler
│       ├── izar_wmbus.h
│       ├── izar_utils.cpp         # Decoding utilities (3-of-6, CRC, decrypt)
│       ├── izar_utils.h
│       ├── wmbus_t_cc1101_config.h # CC1101 register configuration for WMBUS-T
│       ├── __init__.py            # ESPHome component registration
│       ├── sensor.py              # ESPHome sensor configuration
│       └── CMakeLists.txt
└── watersensor.yaml               # ESPHome configuration file

Features

  • Automatic water meter reading via WMBUS-T protocol (868.95 MHz)
  • Multiple meter support - reads all nearby IZAR meters or filter by ID
  • Home Assistant integration via ESPHome API
  • Robust overflow handling - manages CC1101 RX FIFO without data loss
  • 3-of-6 decoding - proper WMBUS-T packet decoding
  • CRC validation - ensures data integrity
  • Decryption support - handles encrypted meter data
  • Easy meter ID discovery - just watch the logs!

Technical Details

WMBUS-T Configuration

  • Frequency: 868.95 MHz
  • Modulation: FSK
  • Sync Word: 0x543D
  • Baud Rate: ~38.4 kbps

CC1101 Registers

The WMBUS-T mode uses a specific set of 47 CC1101 registers defined in wmbus_t_cc1101_config.h. These settings configure:

  • Frequency (868.95 MHz)
  • Modulation and deviation
  • Data rate and channel bandwidth
  • Packet format and sync word
  • FIFO thresholds

Data Flow

  1. Setup: CC1101 is initialized and configured for WMBUS-T mode
  2. RX Mode: CC1101 continuously listens for meter transmissions
  3. Packet Reception: Data is read from CC1101 FIFO (polled every 100ms)
  4. Decoding: 3-of-6 encoding is decoded to bytes
  5. Validation: CRC is checked for data integrity
  6. Decryption: Encrypted data is decrypted
  7. Publishing: Water consumption is published to Home Assistant

Troubleshooting

No data received

Check hardware:

  • ✓ CC1101 antenna is connected and tuned for 868 MHz
  • ✓ Water meter is nearby (within a few meters for testing)
  • ✓ All SPI wiring is correct (see pinout above)
  • ✓ CC1101 VERSION register returns 0x14 (check logs)

Check meter compatibility:

  • Water meter must transmit in WMBUS-T mode (not WMBUS-S or WMBUS-C)
  • IZAR/Diehl/Hydrometer meters typically use WMBUS-T
  • Meters usually transmit every 8-16 seconds

RX Overflow warnings in logs

This is normal! The code automatically handles overflows:

  1. Detects overflow (MARCSTATE=0x11)
  2. Reads data from FIFO before flushing
  3. Recovers to RX mode automatically
  4. No data loss occurs

If you see frequent overflows, the polling is working correctly.

Invalid CC1101 version

  • Check SPI wiring (MOSI, MISO, SCK, CS)
  • Verify 3.3V power supply is stable
  • Ensure CC1101 module is genuine (not a clone with issues)

Compilation errors

  • Ensure ESP-IDF 5.x is installed
  • Clean build: esphome clean watersensor.yaml
  • Check CMakeLists.txt includes the cc1101 component

Credits

License

This project is provided as-is for educational and personal use.

Additional Notes

  • Transmission interval: Water meters typically transmit every 8-16 seconds
  • Multiple meters: All meters in range are detected. Use meter_id to filter.
  • Sensible threshold: Prevents huge jumps in readings (default: 300,000L)
  • Range: Start with CC1101 very close to meter (< 1m), then test range
  • Antenna: A proper 868 MHz antenna is critical for reliable reception

Version History

  • 2025-01: Initial ESP-IDF migration from Arduino
  • 2025-01: Fixed RX overflow handling for reliable operation
  • 2025-01: Added configurable meter ID filtering
  • 2025-01: Production-ready release

Support