jayme-github / esphome_vaillant

Control Vaillant heater via esphome
9 stars 3 forks source link

UART response for sensor "Vorlauftemperatur ist" has sometimes wrong values #1

Open HorstBuchholz opened 1 year ago

HorstBuchholz commented 1 year ago

It seems that this happen just to the first request in the line of requests (all other sensors do not have these spikes). Does anybody have the same issue?

Could a clear or flush of the UART before the first request solve this issue. Or does this wrong value happen after the checksum check?

jayme-github commented 1 year ago

I've not seen that tbh and I would assume that should be prevented by the checksum check. You could try to run with debugging enabled and check the logs if anything stands out.

HorstBuchholz commented 1 year ago

Here is the log from the webview. I configured webserver in YAML-file, but nothing else that in my opinion consumes resources from esp32. I also think the checksum should prevent these false values. How does the algorithm or ESPhome handle false or missing values? Is there a need of flush the buffer before each first request to vaillant or to adjust your 50ms delay in the code? Just for info the heater is a VC192-2 Classic.

[D][sensor:094]: 'Heap Free': Sending state 248276.00000 B with 0 decimals of accuracy [D][sensor:094]: 'Heap Max Block': Sending state 110592.00000 B with 0 decimals of accuracy [D][sensor:094]: 'Loop Time': Sending state 1134.00000 ms with 0 decimals of accuracy [D][Vaillantx6:012]: Vorlauf Ist: 0x07 0x00 0x00 0x00 0x18 0x00 0xd0 [D][sensor:094]: 'Vorlauf ist': Sending state 48.31250 °C with 1 decimals of accuracy [D][Vaillantx6:012]: Vorlauf Set: 0x07 0x00 0x00 0x00 0x19 0x00 0xd2 [D][sensor:094]: 'Vorlauf set': Sending state 48.31250 °C with 1 decimals of accuracy [D][Vaillantx6:012]: Vorlauf Soll: 0x07 0x00 0x00 0x00 0x39 0x00 0x92 [D][sensor:094]: 'Vorlauf soll': Sending state 48.31250 °C with 1 decimals of accuracy [D][Vaillantx6:012]: Vorlauf 789 Soll: 0x07 0x00 0x00 0x00 0x25 0x00 0xaa [D][sensor:094]: 'Vorlauf 789 soll': Sending state 61.50000 °C with 1 decimals of accuracy [D][sensor:094]: 'Used as input sensor for the PID component': Sending state 61.50000 °C with 1 decimals of accuracy [D][Vaillantx6:012]: Rücklauf Ist: 0x07 0x00 0x00 0x00 0x98 0x00 0xc9 [D][sensor:094]: 'Rücklauf ist': Sending state 42.56250 °C with 1 decimals of accuracy [D][Vaillantx6:012]: Brauchwasser Ist: 0x07 0x00 0x00 0x00 0x16 0x00 0xcc [D][sensor:094]: 'Brauchwasser ist': Sending state 130.06250 °C with 1 decimals of accuracy [D][Vaillantx6:012]: Brauchwasser Soll: 0x07 0x00 0x00 0x00 0x01 0x00 0xe2 [D][sensor:094]: 'Brauchwasser soll': Sending state 35.00000 °C with 1 decimals of accuracy [D][Vaillantx6:012]: Brenner: 0x07 0x00 0x00 0x00 0x0d 0x00 0xfa [D][Vaillantx6:012]: Winter: 0x07 0x00 0x00 0x00 0x08 0x00 0xf0 [D][Vaillantx6:012]: Pumpe: 0x07 0x00 0x00 0x00 0x44 0x00 0x68 [D][Vaillantx6:012]: Verbliebene Brennsperrzeit: 0x07 0x00 0x00 0x00 0x38 0x00 0x90 [D][sensor:094]: 'Verbleibende Brennsperrzeit': Sending state 0.00000 min with 0 decimals of accuracy [W][component:214]: Component took a long time for an operation (1.12 s). [W][component:215]: Components should block for at most 20-30ms. [D][sensor:094]: 'Vaillant Uptime': Sending state 27755.81055 s with 0 decimals of accuracy [D][sensor:094]: 'Heap Free': Sending state 248276.00000 B with 0 decimals of accuracy [D][sensor:094]: 'Heap Max Block': Sending state 110592.00000 B with 0 decimals of accuracy [D][sensor:094]: 'Loop Time': Sending state 1137.00000 ms with 0 decimals of accuracy [D][Vaillantx6:012]: Vorlauf Ist: 0x07 0x00 0x00 0x00 0x18 0x00 0xd0 [E][Vaillantx6 sendPacket:203]: Timed out waiting for bytes from Vaillant [E][Vaillantx6:252]: sendPacket returned an error: -3 [D][Vaillantx6:012]: Vorlauf Set: 0x07 0x00 0x00 0x00 0x19 0x00 0xd2 [D][sensor:094]: 'Vorlauf set': Sending state 48.31250 °C with 1 decimals of accuracy [D][Vaillantx6:012]: Vorlauf Soll: 0x07 0x00 0x00 0x00 0x39 0x00 0x92 [D][sensor:094]: 'Vorlauf soll': Sending state 48.31250 °C with 1 decimals of accuracy [D][Vaillantx6:012]: Vorlauf 789 Soll: 0x07 0x00 0x00 0x00 0x25 0x00 0xaa [D][sensor:094]: 'Vorlauf 789 soll': Sending state 61.50000 °C with 1 decimals of accuracy [D][sensor:094]: 'Used as input sensor for the PID component': Sending state 61.50000 °C with 1 decimals of accuracy [D][Vaillantx6:012]: Rücklauf Ist: 0x07 0x00 0x00 0x00 0x98 0x00 0xc9 [D][sensor:094]: 'Rücklauf ist': Sending state 42.56250 °C with 1 decimals of accuracy [D][Vaillantx6:012]: Brauchwasser Ist: 0x07 0x00 0x00 0x00 0x16 0x00 0xcc [D][sensor:094]: 'Brauchwasser ist': Sending state 130.06250 °C with 1 decimals of accuracy [D][Vaillantx6:012]: Brauchwasser Soll: 0x07 0x00 0x00 0x00 0x01 0x00 0xe2 [D][sensor:094]: 'Brauchwasser soll': Sending state 35.00000 °C with 1 decimals of accuracy [D][Vaillantx6:012]: Brenner: 0x07 0x00 0x00 0x00 0x0d 0x00 0xfa [D][Vaillantx6:012]: Winter: 0x07 0x00 0x00 0x00 0x08 0x00 0xf0 [D][Vaillantx6:012]: Pumpe: 0x07 0x00 0x00 0x00 0x44 0x00 0x68 [D][Vaillantx6:012]: Verbliebene Brennsperrzeit: 0x07 0x00 0x00 0x00 0x38 0x00 0x90 [D][sensor:094]: 'Verbleibende Brennsperrzeit': Sending state 0.00000 min with 0 decimals of accuracy [W][component:214]: Component took a long time for an operation (1.21 s). [W][component:215]: Components should block for at most 20-30ms.

jayme-github commented 11 months ago
[D][Vaillantx6:012]: Vorlauf Ist: 0x07 0x00 0x00 0x00 0x18 0x00 0xd0
[E][Vaillantx6 sendPacket:203]: Timed out waiting for bytes from Vaillant
[E][Vaillantx6:252]: sendPacket returned an error: -3

This means the request packet was sent but the ESP did not receive any data within 4x50ms. But in that case the sensor is not populated with a new value (so I guess HA will show the old one): https://github.com/jayme-github/esphome_vaillant/blob/fa1c2f64633e30af5804b96621a8ac0ba1733fdf/vaillantx6.h#L196-L207

As there is no data on the bus there is nothing to flush either so it continues with the next command (reading "Vorlauf Set") which seems to return a coherent value. You could try to increase the timeout/retries in the code above or try to read from the bus before the first command is executed with while (available()) {read();}

HorstBuchholz commented 11 months ago

I investigated something interesting. My heater is equipped with an VRC410 device. When I connect the ESP after the heater is fully booted I get these errors. In the DIA diagnostics menu of the heater I can read out the same parameters as via UART. Parameter d.90 ("digitaler Regler") shows 1. If I connect the ESP before booting the heater this parameter shows 0 and I have no errors while reading.

My conclusion is, the VRC410 and the ESP using the same communication line (X6 UART) for data exchange with the main board of the heater. If the VRC410 is recognised at boot then it is correctly working and sending and receiving data and interferencing the data exchange with the ESP. If the VRC410 is not recognised at boot, there is no further communication on X6 line and no disturbance of ESPs data exchange.

Besides: I don't use the ESP's pwm and 789-line for set temperature. At the moment I just use the ESP for logging.

jayme-github commented 11 months ago

That sounds comprehensible as two devices on the bus will most likely step on each others toes. You could probably build your ESP like a proxy/MITM device for this use case and just sniff the data the VRC410 requests instead of having the ESP request the data on it's own.