Hello.
I was looking for a solution, but I did not find it, and I’m not good at these blocks. - I don’t understand everything yet.
I am asking for help in converting the data I receive from the furnace controller via the UART bus
I found something in one of the posts, but it doesn’t fit.
I just want to read the data
I want to extract the data from the data:
Temperature:
- Oven temperature
- boiler temperature
- return temperature, etc.
- Oxygen sensor
Binary sensor:
- lid open sensor
- Carbon feeder sensor
- Oven alarm
esp32 w jaml :
esphome:
includes:
- uart_read_text_sensor.h
name: kotownia-termometry
esp32:
board: esp32dev
framework:
type: arduino
(.....)
uart:
id: uart_bus
tx_pin: 17
rx_pin: 16
baud_rate: 57600
debug:
direction: BOTH
dummy_receiver: false
after:
delimiter: "\n"
sequence:
- lambda: UARTDebug::log_string(direction, bytes);
text_sensor:
- platform: custom
lambda: |-
auto my_custom_sensor = new UartReadLineSensor(id(uart_bus));
App.register_component(my_custom_sensor);
return {my_custom_sensor->playtime, my_custom_sensor->switchhits, my_custom_sensor->switchhits1, my_custom_sensor->switchhits2, my_custom_sensor->switchhits3, my_custom_sensor->score};
text_sensors:
- name: "playtime"
- name: "switchhits"
- name: "switchhits1"
- name: "switchhits2"
- name: "switchhits3"
- name: "score"
a w pliku uart_read_text_sensor.h :
#include "esphome.h"
class UartReadLineSensor : public Component, public UARTDevice, public TextSensor {
public:
TextSensor *playtime = new TextSensor();
TextSensor *switchhits = new TextSensor();
TextSensor *switchhits1 = new TextSensor();
TextSensor *switchhits2 = new TextSensor();
TextSensor *switchhits3 = new TextSensor();
TextSensor *score = new TextSensor();
UartReadLineSensor(UARTComponent *parent) : UARTDevice(parent) {}
void setup() override {
// nothing to do here
}
int readline(int readch, char *buffer, int len)
{
static int pos = 0;
int rpos;
if (readch > 0) {
switch (readch) {
case '\n': // Ignore new-lines
break;
case '\r': // Return on CR
rpos = pos;
pos = 0; // Reset position index ready for next time
return rpos;
default:
if (pos < len-1) {
buffer[pos++] = readch;
buffer[pos] = 0;
}
}
}
// No end of line has been found, so return -1.
return -1;
}
void loop() override {
const int max_line_length = 180;
static char buffer[max_line_length];
while (available()) {
if(readline(read(), buffer, max_line_length) > 0) {
playtime->publish_state(strtok(buffer, ":"));
switchhits->publish_state(strtok(NULL, ":"));
switchhits1->publish_state(strtok(NULL, ":"));
switchhits2->publish_state(strtok(NULL, ":"));
switchhits3->publish_state(strtok(NULL, ":"));
score->publish_state(strtok(NULL, ":"));
}
}
}
};
what esp now displays:
some data for example from uart:
{"DevId":"TASI7 S8","DevPin":"TASI7 OKN","Token":"GZVQDQ","FrameType":"SkzpData","TimeStamp":"20-42-31","BoilerTempAct":"5627","AN01":"1310","CH1ReturnTempAct":"3853","CH1ReturnTe
some data for example from uart: for example:
,“BoilerTempAct”:“5627”, → is the boiler temperature : 56,27 Celsius
,“ExhaustTempAct”:“16222”, → exhaust gas temperature 162,22 celsius
“CH1ReturnProtAct”:“On”, → sensor binary ON
“DHWPriority”:“Off”, → sensor binary Off
I haven’t recognized all the data yet, but if I have the above data, I think I will be able to extend it.
I am asking for help, I need a control to know if everything is working properly or if someone has turned off the stove or changed the settings.
The stove is in a different building.