Looked at the device image and it says its slave address is 0x0200
?
Sorry, not sure what slave means ( still learning this)
I changed sensor address back to 0x0001
but same output
[15:42:54][C][logger:293]: Logger:
[15:42:54][C][logger:294]: Level: DEBUG
[15:42:54][C][logger:295]: Log Baud Rate: 0
[15:42:54][C][logger:296]: Hardware UART: UART0
[15:42:54][C][uart.arduino_esp32:108]: UART Bus 0:
[15:42:54][C][uart.arduino_esp32:109]: TX Pin: GPIO1
[15:42:54][C][uart.arduino_esp32:110]: RX Pin: GPIO3
[15:42:54][C][uart.arduino_esp32:112]: RX Buffer Size: 256
[15:42:54][C][uart.arduino_esp32:114]: Baud Rate: 9600 baud
[15:42:54][C][uart.arduino_esp32:115]: Data Bits: 8
[15:42:54][C][uart.arduino_esp32:116]: Parity: NONE
[15:42:54][C][uart.arduino_esp32:117]: Stop bits: 1
[15:42:55][C][modbus:143]: Modbus:
[15:42:55][C][modbus:144]: Flow Control Pin: GPIO4
[15:42:55][C][modbus:145]: Send Wait Time: 250 ms
[15:42:55][C][modbus:146]: CRC Disabled: NO
[15:42:55][C][modbus_controller.sensor:010]: modbus_controller.sensorModbus Controller Sensor 'soil_meter'
[15:42:55][C][modbus_controller.sensor:010]: modbus_controller.sensor State Class: ''
[15:42:55][C][modbus_controller.sensor:010]: modbus_controller.sensor Unit of Measurement: 'VWC'
[15:42:55][C][modbus_controller.sensor:010]: modbus_controller.sensor Accuracy Decimals: 0
[15:42:55][C][captive_portal:088]: Captive Portal:
[15:42:55][C][mdns:108]: mDNS:
[15:42:55][C][mdns:109]: Hostname: monitor01
[15:42:55][C][ota:093]: Over-The-Air Updates:
[15:42:55][C][ota:094]: Address: monitor01.local:3232
[15:42:55][C][ota:097]: Using Password.
[15:42:55][C][api:138]: API Server:
[15:42:55][C][api:139]: Address: monitor01.local:6053
[15:42:55][C][api:141]: Using noise encryption: YES
[15:42:55][C][modbus_controller:275]: ModbusController:
[15:42:55][C][modbus_controller:276]: Address: 0x01
[15:42:56][D][modbus_controller:032]: Modbus command to device=1 register=0x01 countdown=0 no response received - removed from send queue
[15:42:57][D][api:102]: Accepted ::FFFF:192.168.1.55
[15:42:57][D][api:102]: Accepted ::FFFF:192.168.1.55
[15:42:58][D][api.connection:918]: Home Assistant 2023.3.0 (::FFFF:192.168.1.55): Connected successfully
[15:42:58][D][api.connection:918]: Home Assistant 2023.3.0 (::FFFF:192.168.1.55): Connected successfully
[15:42:59][D][modbus_controller:032]: Modbus command to device=1 register=0x01 countdown=0 no response received - removed from send queue
[15:43:02][D][modbus_controller:032]: Modbus command to device=1 register=0x01 countdown=0 no response received - removed from send queue
[15:43:06][D][modbus_controller:032]: Modbus command to device=1 register=0x01 countdown=0 no response received - removed from send queue
[15:43:08][D][modbus_controller:032]: Modbus command to device=1 register=0x01 countdown=0 no response received - removed from send queue
[15:43:11][D][modbus_controller:032]: Modbus command to device=1 register=0x01 countdown=0 no response received - removed from send queue
And dipswitch where? =|
Still trying to talk to register 0x01
instead of 0x0001
yes thats what i kept noticing, not sure how to fix that
Some devices have those. Yours might not.
Did you change that or the device address?
found the pdf online
i downloaded it awhile back and couldnt find it
yea
- platform: modbus_controller
modbus_controller_id: reader1
name: "soil_meter"
# id: flow
register_type: holding
address: 0x0001
# register_count: 1
# response_size: 2
# accuracy_decimals: 3
value_type: U_WORD
unit_of_measurement: "VWC"
So, taking back a few steps, lets look at the hardware.
Is everything connected correctly? A connected to A? ect?
From sensor:
Yellow to A and White to B, then Red to + Black to - (Not connected to the MAX485 but directly to ESP32 5V and GND)
Green says its “SET” but can be added to + as well so i tried both connected and disconnected from +.
DE+RE on the modbus controller and RE-> GPIO4 (flow control pin), on ESP32
DI modbus to → GPIO01 TX ESP32
RO modbus to → GPIO03 RX ESP32
To TEST i added 5V + GND to the MAX485 board and i see RX lite Yellow and TX random green on the ESP32 board.
But reseting board still no data back from device
I just dont understand why when i change the address HEX to 0x0001 its not taking it. even when i add a diff address of ex: 0x0007 it shows it as 0x07 in the logs. i tried to do a debug but the about is gibberish to me.
Progress! i think i just needed to step away.
[09:52:45][D][modbus_controller.sensor:025]: Sensor new state: 4945.00
[09:52:45][D][sensor:127]: 'soil_meter_moisture': Sending state 49.45000 VWC with 0 decimals of accuracy
[09:52:45][D][uart_debug:158]: <<< "\x01\x04\x02\x13Qu\xFC"
[09:52:47][D][modbus_controller.sensor:025]: Sensor new state: 4945.00
[09:52:47][D][sensor:127]: 'soil_meter_moisture': Sending state 49.45000 VWC with 0 decimals of accuracy
but now i have to figure out what i need to do with the incoming data bc its suppose to be from 0-10000
Data Range 0-10000 For 0-100% Default: N/A
But i am not sure what filter or lambda i need to fill out to get there. right now i have the sensor 100% submerged into water and it SHOULD read 10000 no?
The change i made to make it work was the
update_interval: 2s
on the controller
Any thoughts?
Isnt that dependant on the Soiltype?
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