I know it’s been a while since you posted, but I managed to connect using an ESP32 with an RS485 module and set up the following configuration in case someone else needs it.
uart:
tx_pin: GPIO1
rx_pin: GPIO3
baud_rate: 9600
parity: EVEN
stop_bits: 1
data_bits: 8
modbus:
id: modbus1
modbus_controller:
- id: heat_pump_modbus
address: 0x01 ## address of the ModBUS slave device on the bus
modbus_id: modbus1
setup_priority: -10
update_interval: 10s
command_throttle: 2ms
thanks for the reply, I only saw it now, I’ll try over the weekend, I wanted to ask you again, I have to replace this part of the code you sent with my parameters, in the sense: I have to leave (sensor:) etc. ?
sensors:
### ALARMS
- platform: modbus_controller
modbus_controller_id: heat_pump_modbus
name: "HP Status"
address: 0x00C8
value_type: U_WORD
register_type: holding
id: alarm1_raw
on_value:
then:
- lambda: |-
std::string state;
switch ((int)id(alarm1_raw).state) { // Cast to integer
case 0:
state = "High pressure - E001";
break;
case 1:
state = "Low pressure - E002";
break;
case 2:
state = "Compressor thermal protection - E003";
break;
case 3:
state = "Fan theral protection - E004";
break;
case 4:
state = "Frost - E005";
break;
case 5:
state = "Lack of flow - E006";
break;
case 6:
state = "ACC prepare low temperature - E007";
break;
case 7:
state = "Lack of librication - E008";
break;
case 8:
state = "High discharge temeperature of Cp 1 - E009";
break;
case 9:
state = "Solar collector at high temperature - E010";
break;
case 12:
state = "Compressor 2 thermal protection - E013";
break;
case 13:
state = "Fan 2 thermal protection - E014";
break;
case 15:
state = "Pump thermal protection - E016";
break;
default:
state = "Unknown";
}
id(alarm1).publish_state(state);