Jsn-sr04t distance sensor - UART is there but sensor is not reading

I’ve got a jsn-sr04t (silkscreen says aj-sr04m, amazon says jsn…). I’m attempting to get it reading to ESPHome. I’m not having much success. I’ve UART debugging on, and I can see messages being exchanged but the sensor in the webui does not read a distance. The jsn-sr04t is configured for mode 2. The board is a Firebeetle 2 ESP32C6.

Here are the (hopefully) relevant config sections. I’ve tried with and without the uart.id in there.

logger:
  baud_rate: 0
  # level: DEBUG

web_server:
  port: 80
  version: 3
  local: True

uart:
  tx_pin: 16
  rx_pin: 17
  baud_rate: 9600
  id: "UART1"
  debug:
    direction: BOTH
    dummy_receiver: false
    after:
      delimiter: "\n"
    sequence:
      - lambda: UARTDebug::log_string(direction, bytes);

sensor:
  - platform: "jsn_sr04t"
    name: "Distance"
    update_interval: 1s
    model: "aj_sr04m"
    uart_id: "UART1"
    # on_value_range: 
    #   - below: 250
    #     then: 
    #       - switch.turn_on: led_yellow
    #   - above: 300
    #     then: 
    #       - switch.turn_off: led_yellow

As I said, I can see serial going on:

Any guidance on where I’m going wrong here would be appreciated. Thanks!

The whole config (in case it makes any difference:

sump-alarm.yaml
esphome:
  name: "sump-alarm"
  friendly_name: Sump Alarm
  min_version: 2025.5.1
  name_add_mac_suffix: false

esp32:
  board: esp32-c6-devkitc-1
  variant: esp32c6
  framework: 
    type: esp-idf
    

# Enable logging
logger:
  baud_rate: 0
  level: DEBUG

# Enable Home Assistant API
api:

# Allow Over-The-Air updates
ota:
- platform: esphome

wifi:
  ssid: !secret wifi_ssid
  password: !secret wifi_password
  fast_connect: yes

  # Enable fallback hotspot (captive portal) in case wifi connection fails
  ap:
    ssid: "Sump-Alarm"
    password: !secret wifi_fallback_password

web_server:
  port: 80
  version: 3
  local: True

binary_sensor:
  - platform: gpio 
    device_class: moisture
    pin: 
      number: 7 # D11
      mode: 
        input: True
        pullup: True
      inverted: False
    name: "Float"
    id: "float_switch"
    filters:
      - delayed_on_off: 10ms
    on_state:
      then:
        - if:
            condition: 
            - binary_sensor.is_on: float_switch 
            then:
              - switch.turn_on: led_red
              - switch.turn_on: alarm_buzzer
            else: 
              - switch.turn_off: led_red
              - switch.turn_off: alarm_buzzer


switch:
  - platform: gpio
    pin: 8 # D2
    name: "Buzzer"
    id: "alarm_buzzer"
    internal: False
    restore_mode: ALWAYS_OFF
    on_turn_on:
      then:
        - script.execute: status_green
    on_turn_off:
      then:
        - script.execute: status_green
  - platform: gpio
    pin: 14 # D3
    name: "Red"
    id: "led_red"
    internal: False
    restore_mode: ALWAYS_OFF
    on_turn_on:
      then:
        - script.execute: status_green
    on_turn_off: 
      then:
        - script.execute: status_green
  - platform: gpio
    pin: 1 # D6
    name: "Yellow"
    id: "led_yellow"
    internal: False
    restore_mode: ALWAYS_OFF
    on_turn_on:
      then:
        - script.execute: status_green
    on_turn_off: 
      then:
        - script.execute: status_green
  - platform: gpio
    pin: 18 # D7
    name: "Green"
    id: "led_green"
    internal: False
    restore_mode: ALWAYS_ON

script:
  - id: status_green
    then: 
      - if: 
          condition: 
            - switch.is_off: led_yellow
            - binary_sensor.is_off: float_switch
          then:
            - switch.turn_on: led_green
          else: 
            - switch.turn_off: led_green

status_led:
  pin: 15

uart:
  tx_pin: 16
  rx_pin: 17
  baud_rate: 9600
  id: "UART1"
  debug:
    direction: BOTH
    dummy_receiver: false
    after:
      delimiter: "\n"
    sequence:
      - lambda: UARTDebug::log_string(direction, bytes);

sensor:
  - platform: "jsn_sr04t"
    name: "Distance"
    update_interval: 1s
    model: "aj_sr04m"
    uart_id: "UART1"
    # on_value_range: 
    #   - below: 250
    #     then: 
    #       - switch.turn_on: led_yellow
    #   - above: 300
    #     then: 
    #       - switch.turn_off: led_yellow
  - platform: wifi_signal
    name: 'WiFi Signal'
    entity_category: diagnostic
  - platform: uptime
    name: 'Uptime'
    entity_category: diagnostic
    unit_of_measurement: s

text_sensor:
  - platform: version
    name: 'ESPHome Version'
    entity_category: diagnostic
  - platform: wifi_info
    ip_address:
      name: WiFi IP Address
      entity_category: diagnostic
      id: ip_address
    ssid:
      name: WiFi SSID
      entity_category: diagnostic
      id: ssid
    mac_address:
      name: WiFi MAC Address
      entity_category: diagnostic
      id: wifi_mac
    dns_address:
      name: WiFi DNS Address
      entity_category: diagnostic
      id: wifi_dns

button:
  - platform: restart
    name: "Sump Alarm Restart"
    id: "restart_button"

i2c:
  sda: 19
  scl: 20

display:
  - platform: ssd1306_i2c
    model: "SSD1306 128x64"
    address: 0x3C
    lambda: |-
      it.print(0, 0, id(my_font), "IP: ${ip_address}");

font:
  - file: "fonts/BlockMono-Bold.ttf"
    id: my_font
    size: 12
    bpp: 2

It would only let me do one image, so here is my diagram, emphasis top left.

OK, so it was actualy an aj-sr04m, which means that R19 needed a 47k ohm resistor, not a short to be in mode 2. After that I got checksum errors, which looked like this

2:05:09
[D]
[uart_debug:158]
<<< "\xFF\x02rs"
22:05:10
[D]
[uart_debug:158]
>>> "U"
22:05:10
[W]
[jsn_sr04t.sensor:054]
checksum failed: 74 != 73
22:05:10
[D]
[uart_debug:158]
<<< "\xFF\x02rs"
22:05:11
[D]
[uart_debug:158]
>>> "U"
22:05:11
[W]
[jsn_sr04t.sensor:054]
checksum failed: 74 != 73
22:05:11
[D]
[uart_debug:158]
<<< "\xFF\x02rs"
22:05:12
[D]
[uart_debug:158]
>>> "U"

This was resolved by removing the model: "aj_sr04m" line in my sensor config… so it’s all of the above? Hah. Anyway, just glad it’s working now. Leaving this here for any future amazon shoppers that get confused.