To możliwe w tych warunkach?
V4 nie działa na ESP8266
external_components:
- source: github://SzczepanLeon/esphome-components@version_3
components: [ wmbus ]
wmbus:
mosi_pin: GPIO13
miso_pin: GPIO12
clk_pin: GPIO14
cs_pin: GPIO15
gdo0_pin: GPIO5
gdo2_pin: GPIO4
sensor:
- platform: wmbus
meter_id: 0x05249317
type: hydrocalm3
add_prefix: false
lqi:
name: "My lqi"
rssi:
name: "My RSSI"
total_heating_kwh:
name: "Heat meter kWh"
force_update: true
total_water_m3:
name: "Heat meter m3"
force_update: true
[13:38:47][V][rxLoop:167]: Have 104 bytes from CC1101 Rx, RSSI: -82 dBm LQI: 129
[13:38:47][D][mbus:034]: Processing T1 A frame
[13:38:47][V][mbus:045]: Frame: 2E671C8DC5A535394B39C5993665B158D58DB345968CE4E6D1C59659659659C6B13933B139A2CB5B45ACB25D195965965965965B434B596596596596B343565AC59659659668D366596B3435634B5965965965965A968B58D5965965965965968CED165A9963B255 (104) [RAW]
[13:38:47][V][mbus:052]: Frame: 3A44B409179324051A0D01018C00B27AC4000000046D272D26330C0889C5000000000C13000000008C1008000000611A008C1013000000000F63010000000000B2C00F9B89 (69) [with CRC]
[13:38:47][V][mbus:095]: Validating CRC for Block1
[13:38:47][V][crc:031]: calculated: 0x0101, read: 0x0101
[13:38:47][V][mbus:115]: Validating CRC for Block2
[13:38:47][V][crc:031]: calculated: 0x89C5, read: 0x89C5
[13:38:47][V][mbus:115]: Validating CRC for Block3
[13:38:47][V][crc:031]: calculated: 0x611A, read: 0x611A
[13:38:47][V][mbus:115]: Validating CRC for Block4
[13:38:47][V][crc:031]: calculated: 0xB2C0, read: 0xB2C0
[13:38:47][V][mbus:115]: Validating CRC for Block5
[13:38:47][V][crc:031]: calculated: 0x9B89, read: 0x9B89
[13:38:47][V][mbus:062]: Frame: 3A44B409179324051A0D8C00B27AC4000000046D272D26330C08000000000C13000000008C1008000000008C1013000000000F630100000000000F (59) [without CRC]
[13:38:47][D][wmbus:090]: Using driver 'hydrocalm3' for ID [0x05249317] RSSI: -82 dBm LQI: 129 Frame: T1 A T: 3A44B409179324051A0D8C00B27AC4000000046D272D26330C08000000000C13000000008C1008000000008C1013000000000F630100000000000F (59)
[13:38:47][V][sensor:043]: 'My lqi': Received new state 129.000000
[13:38:47][D][sensor:093]: 'My lqi': Sending state 129.00000 with 0 decimals of accuracy
[13:38:47][V][json:020]: Attempting to allocate 512 bytes for JSON serialization
[13:38:47][V][json:040]: Size after shrink 68 bytes
[13:38:47][V][sensor:043]: 'My RSSI': Received new state -82.000000
[13:38:47][D][sensor:093]: 'My RSSI': Sending state -82.00000 dBm with 0 decimals of accuracy
[13:38:47][V][json:020]: Attempting to allocate 512 bytes for JSON serialization
[13:38:47][V][json:040]: Size after shrink 72 bytes
[13:38:47][V][wmbus:121]: Publishing 'total_water_m3' = 0.0000
[13:38:47][V][sensor:043]: 'Heat meter m3': Received new state 0.000000
[13:38:47][D][sensor:093]: 'Heat meter m3': Sending state 0.00000 m³ with 3 decimals of accuracy
[13:38:47][V][json:020]: Attempting to allocate 512 bytes for JSON serialization
[13:38:47][V][json:040]: Size after shrink 80 bytes
(0,00 kWh/m3 jest prawidłową wartością)
Tak, wiem sam to napisałem.
Wartość kWh nie działa
Widać w logu, że dekoduje się tylko m3, lqi i RSSI
Nie patrzylem w loga bo jest tak wklejony ze nie dam rady go na komórce przeglądać sensownie.
W v3 nie bedzie nic wiecej (chyba ze ktoś zrobi update drivera) - dlatego pisałem o v4.
Z tego, co widzę, jest zaktualizowany driver:
/*
Based on: https://github.com/wmbusmeters/wmbusmeters/blob/master/src/driver_hydrocalm3.cc
Copyright (C) 2017-2022 Fredrik Öhrström (gpl-3.0-or-later)
*/
#pragma once
#include "driver.h"
#include <vector>
#include <string>
struct Hydrocalm3: Driver
{
Hydrocalm3(std::string key = "") : Driver(std::string("hydrocalm3"), key) {};
virtual esphome::optional<std::map<std::string, double>> get_values(std::vector<unsigned char> &telegram) override {
std::map<std::string, double> ret_val{};
add_to_map(ret_val, "total_heating_kwh", this->get_0C0E(telegram));
add_to_map(ret_val, "total_heating_kwh", this->get_0C03(telegram));
This file has been truncated. show original
add_to_map(ret_val, "total_heating_kwh", this->get_0C09(telegram)); /* Hydrocal M4 kWh metering map value */
Log zastąpiony wersją bardziej przejrzystą.
Wolę użyć, to co mam wolne, niż zamawiać kolejne rzeczy.
Szczególnie, że z tego co widzę na v2.4.8 (czyli z obsługą ESP8266) już działało.
Sprawdziłem jeszcze V2 i jest to samo - działa, ale nie dekoduje kWh.
@_Szczepan
Przyczyna chyba znaleziona. Driver szuka 0C09, a w moim przypadku jest to 0C08.
024 : 0C dif (8 digit BCD Instantaneous value)
025 : 08 vif (Energy J)
026 C!: 00000000 ("total_heating_kwh":0)
_
Podmieniłem 0C09 na 0C08 i wygląda na to, że działa prawidłowo. Nie wiem jeszcze, czy wartości będą prawidłowe, ale to się okaże jak zacznie coś przez licznik przepływać, najwyżej będę modyfikował.
[17:36:47][D][wmbus:090]: Using driver 'hydrocalm3' for ID [0x05249317] RSSI: -84 dBm LQI: 129 Frame: T1 A T: 3A44B409179324051A0D8C00B27AB2000000046D253126330C08000000000C13000000008C1008000000008C1013000000000F630100000000000F (59)
[17:36:47][V][sensor:043]: 'My lqi': Received new state 129.000000
[17:36:47][D][sensor:093]: 'My lqi': Sending state 129.00000 with 0 decimals of accuracy
[17:36:47][V][sensor:043]: 'My RSSI': Received new state -84.000000
[17:36:47][D][sensor:093]: 'My RSSI': Sending state -84.00000 dBm with 0 decimals of accuracy
[17:36:47][V][wmbus:121]: Publishing 'total_heating_kwh' = 0.0000
[17:36:47][V][sensor:043]: 'Heat meter kWh': Received new state 0.000000
[17:36:47][D][sensor:093]: 'Heat meter kWh': Sending state 0.00000 kWh with 3 decimals of accuracy
[17:36:47][V][wmbus:121]: Publishing 'total_water_m3' = 0.0000
[17:36:47][V][sensor:043]: 'Heat meter m3': Received new state 0.000000
[17:36:47][D][sensor:093]: 'Heat meter m3': Sending state 0.00000 m³ with 3 decimals of accuracy