Making a custom UART component for my heater

I have a vaillant heater which has got a serial interface for communication. By sending serial commands, I can check that values of different sensors. I would like to do that with ESPhome.
I think I have to make a custom component as described in . How often does the loop loop?
How to create 10 sensors with this custom component?

I haven’t tried this, I’m just learning about ESPHome programming myself. But you can make a custom component that talks to the heater based on the UARTDevice (, save the state in some global variables, and then make a custom sensor component ( which publishes the valuaes that the UART component found.

In fact you don’t even need a global variable, you can pass the id(sensor_component) to the constructor of the custom UART device, it can put the sensor values in there and then the sensor can publish the new values when it is polled.

About your other question, loop() seems to run continuously. My esp isn’t doing much yet and I get about 80 times per second.


Oh I see you posted your code on the other thread. Looks good.


Yes I solved it, thank you.

1 Like

@jms3000 would you by any chance share your code. I need to control an old Xantech MRC88 matrix amp and have C# module I wrote about 8 years back for Elve controller that I would refactor for ESP and it’s hard to find any working references for the custom Uart module

Thank you

1 Like



Hi Martin, I’m newbie on ESPhome custom components and not very familiar with C++. I have a dehumidifier with a serial communication interface, want integrate HASSIO by ESPhome. Trying to learn your code, and reference to others on github, after week trying but unfortunately fail until now, came look for your help.

I can get message by Serial Debugger Tools:
send { 0x01, 0x03, 0x00, 0x2A, 0x00, 0x02, 0xE5, 0xC3 }
respond { 01 03 04 00 50 00 3C FA 33}
00, 50, 00, 3C this 4 bytes are factory set value, RH 60% (0x3C) stop, RH 80% (0x50) start.
send { 0x01, 0x03, 0x00, 0x30, 0x00, 0x05, 0x85, 0xC6 }
respond { 01 03 0A 00 15 00 3F 00 15 00 15 00 04 04 E1 }
first 00, 15 will be detected ambient temperature 21°C; 00, 3F will be detected relative humidity 63 RH%; second and third 00, 15, 00, 15 will be the semicon refrigeration board cool side 21°C, hot side 21°C(machine suspend now); 00, 04 is the machine working status, (4 or 0 = suspend, 3 = on)

Want to have these 7 sensors and update every 10 seconds, looking forward your assist or advise.