Fått till lite avkodning av de viktigaste parametrarna för esphome, får ta och slänga in det i ett gitlab repo snart, men tänkte att jag slänger upp det här sålänge. Dock inte fixat möjlighet att sätta parametrar än:
uart:
- id: uart_display
tx_pin:
number: GPIO19
inverted: true
rx_pin:
number: GPIO18
inverted: true
baud_rate: 2400
parity: EVEN
stop_bits: 1
data_bits: 8
debug:
direction: RX
dummy_receiver: true
after:
delimiter: "\r\n"
sequence:
- uart.write:
id: uart_vp
data: !lambda return bytes ;
#data: [0x41, 0xf7, 0xfe, 0xf7, 0xfa, 0xfe, 0xff, 0xff, 0xc2]
- lambda: |-
ESP_LOGD("custom", "from disp");
UARTDebug::log_int(direction, bytes, ','); // Log the message as int.
UARTDebug::log_hex(direction, bytes, ','); // Log the message in hex.
UARTDebug::log_binary(direction, bytes, ','); // Log the message in hex.
ESP_LOGD("custom", "Bytes size: %d", bytes.size()); // Log how many bytes in the message.
if (direction == UART_DIRECTION_RX) // Check message direction (Change to TX if required)
{
if (bytes.size() == 10) // Check number of bytes
{
id(bin1).publish_state((bytes[1] >> 6) & 1); // Publish results to a sensor.
id(bin2).publish_state((bytes[1] >> 4) & 1); // Publish results to a sensor.
id(bin3).publish_state((bytes[1] >> 7) & 1); // Publish results to a sensor.
id(bin4).publish_state((bytes[5] >> 0) & 1); // Publish results to a sensor.
}
}
- id: uart_vp
tx_pin:
number: GPIO15
inverted: true
rx_pin:
number: GPIO22
inverted: true
baud_rate: 2400
parity: EVEN
stop_bits: 1
data_bits: 8
debug:
direction: RX
dummy_receiver: true
after:
delimiter: "\r\n"
sequence:
- uart.write:
id: uart_display
data: !lambda return bytes ;
- lambda: |-
//ESP_LOGD("custom", "from vp");
//UARTDebug::log_int(direction, bytes, ','); // Log the message as int.
//UARTDebug::log_hex(direction, bytes, ','); // Log the message in hex.
//ESP_LOGD("custom", "Bytes size: %d", bytes.size()); // Log how many bytes in the message.
if (direction == UART_DIRECTION_RX) // Check message direction (Change to TX if required)
{
if (bytes.size() == 22) // Check number of bytes
{
id(sensor1).publish_state(bytes[1]); // Publish results to a sensor.
id(sensor2).publish_state(bytes[2]-40); // Publish results to a sensor.
id(sensor3).publish_state(bytes[3]+(bytes[4]/100)); // Publish results to a sensor.
id(sensor4).publish_state(bytes[5]); // Publish results to a sensor.
//id(sensor5).publish_state(bytes[6]); // Publish results to a sensor.
//id(sensor6).publish_state(bytes[7]); // Publish results to a sensor.
//id(sensor7).publish_state(bytes[8]); // na
//id(sensor8).publish_state(bytes[9]); // na
id(sensor9).publish_state(bytes[10]); // Publish results to a sensor.
//id(sensor10).publish_state(bytes[11]); // na
//id(sensor11).publish_state(bytes[12]); // na
id(sensor12).publish_state(bytes[13]); // strömuttag i A
//id(sensor13).publish_state(bytes[14]); // na
id(sensor14).publish_state(bytes[15]-40); // Publish results to a sensor.
id(sensor15).publish_state(bytes[16]); // Publish results to a sensor.
}
}
sensor:
- platform: template
name: "framlednings temp"
unit_of_measurement: "°C"
id: "sensor1"
- platform: template
name: "ute temp"
unit_of_measurement: "°C"
id: "sensor2"
- platform: template
name: "inne temp"
unit_of_measurement: "°C"
id: "sensor3"
- platform: template
name: "vp retur temp"
unit_of_measurement: "°C"
id: "sensor4"
- platform: template
name: "hetgas temp"
unit_of_measurement: "°C"
id: "sensor9"
- platform: template
name: "strömuttag"
unit_of_measurement: "A"
id: "sensor12"
- platform: template
name: "ute temp i VP"
unit_of_measurement: "°C"
id: "sensor14"
- platform: template
name: "temp VP utgående"
unit_of_measurement: "°C"
id: "sensor15"
- platform: template
name: "fläkt låg"
unit_of_measurement: "on/off"
id: "bin1"
- platform: template
name: "fläkt hög"
unit_of_measurement: "on/off"
id: "bin2"
- platform: template
name: "kompressor"
unit_of_measurement: "on/off"
id: "bin3"
- platform: template
name: "radiotorpump"
unit_of_measurement: "on/off"
id: "bin4"