Closed Mosibi closed 8 months ago
Tried to use lamba code on register 205 and the more easy multiply
on register 206, both results in the same error
# Register: 205, default: 60, TODO: verify default and min/max value
- platform: modbus_controller
modbus_controller_id: "${devicename}"
name: "${entity_prefix} Temperature Upper Limit Of TS Setting"
id: "${devicename}_temperature_upper_limit_of_ts_setting"
register_type: holding
address: 0xcd
value_type: U_WORD
unit_of_measurement: "°C"
entity_category: config
lambda: |-
int value = x * 0.5;
ESP_LOGI("main", "Sensor value reg 205: %f", x);
ESP_LOGI("main", "Display value reg 205: %d", value);
return value;
write_lambda: |-
int value = x * 2;
ESP_LOGI("main", "Incoming value to write for reg 205: %f", x);
ESP_LOGI("main", "Write value reg 205: %d", value);
esphome::modbus_controller::ModbusCommandItem set_payload_command = esphome::modbus_controller::ModbusCommandItem::create_write_single_command(${devicename}, 0xcd, value);
${devicename}->queue_command(set_payload_command);
return {};
min_value: 0
max_value: 60
# Register: 206, default: 34, TODO: verify default and min/max value
- platform: modbus_controller
modbus_controller_id: "${devicename}"
name: "${entity_prefix} Temperature Lower Limit Of TS Setting"
id: "${devicename}_temperature_lower_limit_of_ts_setting"
register_type: holding
address: 0xce
value_type: U_WORD
unit_of_measurement: "°C"
entity_category: config
multiply: 2
min_value: 0
max_value: 60
Register addresses 200-208 can only use the 03 (register read only) function code. Register addresses 209 and following can use 03H, 06H (single register write) or 10H (multiple register write)
Hmm, then I have all registers in that range to be a sensor. How did you find that info btw, I tried to find it !
Ah now with your text I could find where it came from. In the manual of course 😄. Thanks !!
Setting the value to 16 results in an error. Function 0x06 is "Write Single Holding Register", exception 1 is "Illegal Function, Function code received in the query is not recognized or allowed by server"
And the next read show the original value again