SzczepanLeon / esphome-components

116 stars 40 forks source link

qwater not decoding #106

Closed sapientior closed 2 weeks ago

sapientior commented 3 weeks ago

Hello,

I am using an ESP32-WROOM32 with an CC1101 for reading the telegrams from watermeters. Specifically I want to read the total amount from a qwater 5.5 from Qundis. This is the log output on the ESP32:

[07:13:19][V][mbus:017]: Frame: 49449344033842511A06E9E6780DFF5F350082670000800007C113FF3757FF97580100FF2C870501001F355252019A1F004700510037003B005400390044005685760047006A0070005C002F046D0E061B363C51 (84) [with CRC] [07:13:19][V][mbus:095]: Validating CRC for Block1 [07:13:19][V][crc:031]: calculated: 0xE9E6, read: 0xE9E6 [07:13:19][V][mbus:115]: Validating CRC for Block2 [07:13:19][V][crc:031]: calculated: 0x3757, read: 0x3757 [07:13:19][V][mbus:115]: Validating CRC for Block3 [07:13:19][V][crc:031]: calculated: 0x9A1F, read: 0x9A1F [07:13:19][V][mbus:115]: Validating CRC for Block4 [07:13:19][V][crc:031]: calculated: 0x8576, read: 0x8576 [07:13:19][V][mbus:115]: Validating CRC for Block5 [07:13:19][V][crc:031]: calculated: 0x3C51, read: 0x3C51 [07:13:19][V][mbus:062]: Frame: 49449344033842511A06780DFF5F350082670000800007C113FFFF97580100FF2C870501001F35525201004700510037003B00540039004400560047006A0070005C002F046D0E061B36 (74) [without CRC] [07:13:19][D][wmbus:097]: Using driver 'qwater' for ID [0x51423803] RSSI: -50 dBm LQI: 128 Frame: C1 A T: 49449344033842511A06780DFF5F350082670000800007C113FFFF97580100FF2C870501001F35525201004700510037003B00540039004400560047006A0070005C002F046D0E061B36 (74) [07:13:19][D][wmbus:161]: Can't get value(s) from telegram for ID [0x51423803]

When manually checking the telegram, I can read the total amount and it is the same as shown on the display on the meter itself. https://wmbusmeters.org/analyze/49449344033842511A06780DFF5F350082670000800007C113FFFF97580100FF2C870501001F35525201004700510037003B00540039004400560047006A0070005C002F046D0E061B36:qwater

At least the setup should be fine, as I am reading the telegrams successfully...

What do I need to change to get the Values into my sensor? Is there an issue with your code not working properly with qwater telegrams?

My YAML:

substitutions:
  ## logger settings
  log_level: "VERBOSE" 
  log_wmbus: "VERBOSE" 
  log_baudrate: "0" 

esphome:
  name: wassermeter
  comment: "Wasserzähler ESP32, CUL - CC1101, qwater"
  friendly_name: Wassermeter

preferences:
  flash_write_interval: 10min

esp32:
  board: esp32dev
  framework:
    type: arduino

logger:
  id: appslogger
  level: ${log_level}
  baud_rate: ${log_baudrate}
  logs:
    wmbus: ${log_wmbus}
    wMBus-lib: ${log_wmbus}
    sensor: WARN
    sensor.filter: WARN
    text_sensor: WARN
    api.service: ERROR
    json: ERROR
    mqtt: WARN
    scheduler: ERROR
    internal_temperature: ERROR
    wifi: WARN
    component: ERROR
    api: WARN

api:
  id: espapi_wmbus_esp32
  port: 6053
  reboot_timeout: 0s
  encryption:
    key: "****"

ota:
  - platform: esphome
    password: "*****"

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

  ap:
    ssid: "Wassermeter Fallback Hotspot"
    password: "****"

  manual_ip:
    static_ip: 172.30.0.80
    gateway: 172.30.0.254
    subnet: 255.255.255.0

time:
  - platform: sntp
    id: time_sntp
    timezone: Europe/Berlin
    servers:
      - 172.30.0.254

external_components:
  - source: github://SzczepanLeon/esphome-components@main
    refresh: 0s
    components: [wmbus]

captive_portal:

## ------------------------------------------------------------------
##           WMBUS CC1101 --> ESP32-WROOM-32D
## ------------------------------------------------------------------
##                                                                            
##                                                                                                      ANT
##                                                                                                       |
##   ╭――x――x――x――x――x――x――x――x――x――x――x――x――x――x――x――x――x――x――x―╮                         ╭―――――――――――x――o――x――――――――╮
##   |                                                          |                         |         CC1101           |
##   |                      ESP32-WROOM-32D                     |                         |     G  G  M     M        |
## - | USB                                                      | -- ANT                  |  C  D  D  I  C  O  G  V  |
##   |                                                          |                         |  S  O  O  S  L  S  N  C  |
##   |                 16 17 5  18 19                        23 |                         |  N  0  2  O  K  I  D  C  |
##   ╰――o――o――x――x――x――o――o――o――o――o――o――o――o――o――o――o――o――o――o―╯                         ╰――o――o――o――o――o――o――o――o――╯
##      | GND         RX2 |  |  |  |                          |                              1  2  3  4  5  6  7  8
##     3.3V|           | TX2 |  |  |                          |                              |  |  |  |  |  |  |  |
##      |  |           |  |  |  |  |                          |                              |  |  |  |  |  |  |  |   
##      |  |           |  |  |  |  |                          6                              5 RX2 |  19 18 23 | 3.3
##      8  7           2  3  1  5  4                                                              TX2         GND 
##                                    
## ------------------------------------------------------------------
wmbus:
  mosi_pin: GPIO23
  miso_pin: GPIO19
  clk_pin: GPIO18
  cs_pin: GPIO5
  gdo0_pin: GPIO16
  gdo2_pin: GPIO17
  log_unknown: true

sensor:
  - platform: wmbus
    meter_id: 0x51423803
    type: qwater
    mode: C1
    total_water_m3:
      name: "Warmwasser"
      id: warmwasser
      unit_of_measurement: "m³"
      state_class: total_increasing
      device_class: "water"
      accuracy_decimals: 3
      icon: mdi:counter
    lqi:
      name: "Warmwasser lqi"
      entity_category: "diagnostic"
    rssi:
      name: "Warmwasser RSSI"
      entity_category: "diagnostic"
sapientior commented 2 weeks ago

After almost one week without changes in settings the values could be read. The functionality with qwater should be checked though.