Ah your right, thats another thing i wanted tofind out is how would i change the type?
You will need to create a number i think: Modbus Controller Number — ESPHome
number:
- platform: modbus_controller
modbus_controller_id: reader1
name: "soil_type"
address: 0x0020
value_type: U_WORD
min_value: 0
max_value: 3
I’m used to using the modbus integration since i only use network based controllers and i just use a service call for these kind of settings.
That sorta worked, but the unit starts to reboot itself every time now.
I am trying to get a reading from all of these in order and the #'s dont seem right. I found the correct pdf for my sensor which has way more features.
updated code
uart:
id: mod_bus
tx_pin: 1
rx_pin: 3
baud_rate: 9600
stop_bits: 1
parity: NONE
data_bits: 8
# debug:
# direction: RX
# dummy_receiver: false
# after:
# delimiter: "\n"
# sequence:
# - lambda: UARTDebug::log_string(direction, bytes);
modbus:
id: modbus1
flow_control_pin: 4
modbus_controller:
- id: reader1
address: 0x01
modbus_id: modbus1
setup_priority: -10
update_interval: 2s
sensor:
- platform: modbus_controller
modbus_controller_id: reader1
name: "soil_meter_temp"
# id: flow
register_type: read
# register_count: 2
address: 0x0000
response_size: 2
# accuracy_decimals: 3
value_type: U_WORD
# unit_of_measurement: "°C"
# accuracy_decimals: 1
# filters:
# - multiply: 256
- platform: modbus_controller
modbus_controller_id: reader1
name: "soil_meter_moisture"
# id: flow
register_type: read
# register_count: 2
address: 0x0001
response_size: 2
# accuracy_decimals: 3
value_type: U_WORD
unit_of_measurement: "VWC"
# accuracy_decimals: 1
# filters:
# - multiply: .01
- platform: modbus_controller
modbus_controller_id: reader1
name: "soil_meter_ec"
# id: flow
register_type: read
# register_count: 2
address: 0x0002
response_size: 2
# accuracy_decimals: 3
value_type: U_WORD
unit_of_measurement: "us/cm"
# accuracy_decimals: 1
# filters:
# - multiply: .01
- platform: modbus_controller
modbus_controller_id: reader1
name: "soil_meter_salinity"
# id: flow
register_type: read
address: 0x0003
response_size: 2
# accuracy_decimals: 3
value_type: U_WORD
unit_of_measurement: "mg/L"
# accuracy_decimals: 1
# filters:
# - multiply: .01
- platform: modbus_controller
modbus_controller_id: reader1
name: "soil_meter_tds"
# id: flow
register_type: read
address: 0x0004
response_size: 2
# accuracy_decimals: 3
value_type: U_WORD
unit_of_measurement: "mg/L"
# accuracy_decimals: 1
# filters:
# - multiply: .01
- platform: modbus_controller
modbus_controller_id: reader1
name: "soil_meter_episilon"
# id: flow
register_type: read
address: 0x0005
response_size: 2
# accuracy_decimals: 3
value_type: U_WORD
unit_of_measurement: "mg/L"
# accuracy_decimals: 1
# filters:
# - multiply: .01
- platform: modbus_controller
modbus_controller_id: reader1
name: "soil_meter_soiltype"
# id: flow
register_type: holding
address: 0x0020
# register_count: 2
response_size: 2
# accuracy_decimals: 3
value_type: U_WORD
# unit_of_measurement: "mg/L"
# accuracy_decimals: 1
# filters:
# - multiply: .01
When i start with the 1st sensor reading, temp i get the correct one. but then once i start adding moisture, es, etc everything goes wacky. even temp does not have a reading. soil type keeps changing instead of it being 0,1,2, or 3 and is def not the correct output . not sure how to use register count or size in my case and still havnt figured out how to set the soil type
[11:42:44][D][sensor:127]: 'soil_meter_temp': Sending state 0.00000 with 0 decimals of accuracy
[11:42:44][D][modbus_controller.sensor:025]: Sensor new state: 30806.00
[11:42:44][D][sensor:127]: 'soil_meter_moisture': Sending state 30806.00000 VWC with 0 decimals of accuracy
[11:42:44][D][modbus_controller.sensor:025]: Sensor new state: 44474.00
[11:42:44][D][sensor:127]: 'soil_meter_ec': Sending state 44474.00000 us/cm with 0 decimals of accuracy
[11:42:44][D][modbus_controller.sensor:025]: Sensor new state: 28680.00
[11:42:44][D][sensor:127]: 'soil_meter_salinity': Sending state 28680.00000 mg/L with 0 decimals of accuracy
[11:42:44][D][modbus_controller.sensor:025]: Sensor new state: 30806.00
[11:42:44][D][sensor:127]: 'soil_meter_tds': Sending state 30806.00000 mg/L with 0 decimals of accuracy
[11:42:44][D][modbus_controller.sensor:025]: Sensor new state: 44474.00
[11:42:44][D][sensor:127]: 'soil_meter_episilon': Sending state 44474.00000 mg/L with 0 decimals of accuracy
[11:42:45][D][modbus_controller.sensor:025]: Sensor new state: 2338.00
[11:42:45][D][sensor:127]: 'soil_meter_soiltype': Sending state 2338.00000 with 0 decimals of accuracy
[11:42:46][D][modbus_controller.sensor:025]: Sensor new state: 0.00
[11:42:46][D][sensor:127]: 'soil_meter_temp': Sending state 0.00000 with 0 decimals of accuracy
[11:42:46][D][modbus_controller.sensor:025]: Sensor new state: 30806.00
[11:42:46][D][sensor:127]: 'soil_meter_moisture': Sending state 30806.00000 VWC with 0 decimals of accuracy
[11:42:46][D][modbus_controller.sensor:025]: Sensor new state: 44474.00
[11:42:46][D][sensor:127]: 'soil_meter_ec': Sending state 44474.00000 us/cm with 0 decimals of accuracy
[11:42:46][D][modbus_controller.sensor:025]: Sensor new state: 28680.00
[11:42:46][D][sensor:127]: 'soil_meter_salinity': Sending state 28680.00000 mg/L with 0 decimals of accuracy
[11:42:46][D][modbus_controller.sensor:025]: Sensor new state: 30806.00
[11:42:46][D][sensor:127]: 'soil_meter_tds': Sending state 30806.00000 mg/L with 0 decimals of accuracy
[11:42:46][D][modbus_controller.sensor:025]: Sensor new state: 44474.00
[11:42:46][D][sensor:127]: 'soil_meter_episilon': Sending state 44474.00000 mg/L with 0 decimals of accuracy
[11:42:48][D][modbus_controller.sensor:025]: Sensor new state: 2338.00