Navien, ESP32 Navilink interface

I’ve sent you PM

Ok, I had my Navien setup with this previously:

################################################################################
####                            REVISION HISTORY                            ####
################################################################################ 
# 
# 5/28/2024 revision to gas m3, ccf, and therms per discussion on community forum
#
substitutions:
  comment: "(Navien Hot Water Heater) -- Device host: redacted"
  friendly_name: Navien Water Heater
  logger_level: WARN

binary_sensor:
  - platform: status
    name: Status
    internal: True

esphome:
  name: navien
  friendly_name: Navien Water Heater

esp32:
  board: esp32-s3-devkitc-1
  framework:
    type: arduino

# Enable logging
logger:

# Enable Home Assistant API
api:

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

# Allow provisioning Wi-Fi via serial
improv_serial:

wifi:
  ssid: !secret wifi_ssid
  password: !secret wifi_password
  manual_ip:
    # Set this to the IP of the ESP
    static_ip: x.x.x.x
    # Set this to the IP address of the router. Often ends with .1
    gateway: x.x.x.x
    # The subnet of the network. 255.255.255.0 works for most home networks.
    subnet: x.x.x.x


globals:
   - id: init_set_temp
     type: int
     restore_value: yes
     initial_value: '120'


#################################
#### UART SETUP/DECODE BYTES ####
#################################

uart:
  id: uart_bus
  tx_pin: 6
  rx_pin: 5
  baud_rate: 19200
  data_bits: 8
  stop_bits: 1
  parity: NONE
  debug:
    direction: BOTH
    dummy_receiver: True
    after:
      delimiter: "\n"
    sequence:
      - lambda: |-
          //
          // SPECIAL THANKS TO @suva on the HomeAssistant forum for Decoding these.
          // https://community.home-assistant.io/t/navien-hot-water-heater-navilink/330044/92
          //  
          UARTDebug::log_hex(direction, bytes, ',');
          UARTDebug::log_int(direction, bytes, ',');
          if (bytes[0] == 247 && bytes[1] == 5 && bytes[2] == 80 && bytes[3] == 80 && bytes[4] == 144 && bytes[5] == 34) {
          // Water information
          id(uart_water_byte0).publish_state(bytes[0]); //Common To all Packets
          id(uart_water_byte1).publish_state(bytes[1]); //Common To all Packets
          id(uart_water_byte2).publish_state(bytes[2]); //Packet id Byte 0
          id(uart_water_byte3).publish_state(bytes[3]); //Packet id Byte 1
          id(uart_water_byte4).publish_state(bytes[4]); //Packet id Byte 2
          id(uart_water_byte5).publish_state(bytes[5]); //Data Length
          id(uart_water_byte6).publish_state(bytes[6]); // Always 66?
          id(uart_water_byte7).publish_state(bytes[7]); // Always 0
          id(uart_water_byte8).publish_state(bytes[8]); // 0, 8, 32 related to recirc running
          id(uart_water_byte9).publish_state(bytes[9]); // System Power: high nibble: Unknown (values 0 and 0x20 observed); low nibble = 0=off 0x5=on
          id(uart_water_byte10).publish_state(bytes[10]);
          id(uart_water_byte11).publish_state((bytes[11]/2.0)); //Set temp - measured in 0.5 degrees C.
          id(uart_water_byte12).publish_state((bytes[12]/2.0));  //Outlet temp - measured in 0.5 degrees C.
          id(uart_water_byte13).publish_state((bytes[13]/2.0)); //Inlet temp - measured in 0.5 degrees C.
          id(uart_water_byte14).publish_state(bytes[14]); // Always 0
          id(uart_water_byte15).publish_state(bytes[15]); // Always 0
          id(uart_water_byte16).publish_state(bytes[16]); // Always 0
          id(uart_water_byte17).publish_state(bytes[17] / 10.0 / 2.0); // Sort of looks like GPM
          id(uart_water_byte18).publish_state(bytes[18] / 10.0); //Flow rate - measured in 0.1 liters per minute (divide by 10 to get LPM)
          id(water_flow_gpm).publish_state(bytes[18] / 10.0 * 0.2642);
          id(uart_water_byte19).publish_state(bytes[19]);
          id(uart_water_byte20).publish_state(bytes[20]);
          id(uart_water_byte21).publish_state(bytes[21]); // 190, 173, 186
          id(uart_water_byte22).publish_state(bytes[22]); // 0, 186, 201, 202
          id(uart_water_byte23).publish_state(bytes[23]); // 32, 63, 186
          id(uart_water_byte24).publish_state(bytes[24]); //System status. Probably a bitwise field. Partially decoded: display units: 0x08 position: 1=metric 0=imperial. 0x02 position: 1=weekly 0=hotbutton
          id(uart_water_byte25).publish_state(bytes[25]); // 0, 117
          id(uart_water_byte26).publish_state(bytes[26]);
          id(uart_water_byte27).publish_state(bytes[27]);
          id(uart_water_byte28).publish_state(bytes[28]); // 106, 52, 76  // could be runtime? 106
          id(uart_water_byte29).publish_state(bytes[29]); // 0, 18, 232
          id(uart_water_byte30).publish_state(bytes[30]); // slowly increases, some outlier values 175-186
          id(uart_water_byte31).publish_state(bytes[31]);
          id(uart_water_byte32).publish_state(bytes[32]);
          id(uart_water_byte33).publish_state(bytes[33]); // If recirculation is on/off 2 or 0
          id(uart_water_byte34).publish_state(bytes[34]);
          id(uart_water_byte35).publish_state(bytes[35]);
          id(uart_water_byte36).publish_state(bytes[36]);
          id(uart_water_byte37).publish_state(bytes[37]);
          id(uart_water_byte38).publish_state(bytes[38]);
          id(uart_water_byte39).publish_state(bytes[39]);
          id(uart_water_byte40).publish_state(bytes[40]); // checksum?
          }
          else if (bytes[0] == 247 && bytes[1] == 5 && bytes[2] == 80 && bytes[3] == 15 && bytes[4] == 144 && bytes[5] == 42) {
          // Gas information
          id(uart_gas_byte0).publish_state(bytes[0]); //Common to All Packets
          id(uart_gas_byte1).publish_state(bytes[1]); //Common to All Packets
          id(uart_gas_byte2).publish_state(bytes[2]); //Packet id Byte 0
          id(uart_gas_byte3).publish_state(bytes[3]); //Packet id Byte 1
          id(uart_gas_byte4).publish_state(bytes[4]); //Packet id Byte 2
          id(uart_gas_byte5).publish_state(bytes[5]); //Data Length
          id(uart_gas_byte6).publish_state(bytes[6]); // Always 69?
          id(uart_gas_byte7).publish_state(bytes[7]); // Always 0
          id(uart_gas_byte8).publish_state(bytes[8]); // Always 11
          id(uart_gas_byte9).publish_state(bytes[9]); // Always 1
          id(uart_gas_byte10).publish_state(bytes[10]); // Always 12
          id(uart_gas_byte11).publish_state(bytes[11]); // Always 0
          id(uart_gas_byte12).publish_state(bytes[12]); // Always 19
          id(uart_gas_byte13).publish_state(bytes[13]); // Always 0
          id(uart_gas_byte14).publish_state(bytes[14] / 2.0); // Set Temp - measured in 0.5 degrees C.
          id(uart_gas_byte15).publish_state(bytes[15] / 2.0); //Outlet temp - measured in 0.5 degrees C.
          id(uart_gas_byte16).publish_state(bytes[16] / 2.0); //Inlet temp - measured in 0.5 degrees C.
          id(uart_gas_byte17).publish_state(bytes[17]); // Always 0
          id(uart_gas_byte18).publish_state(bytes[18]); // Always 0
          id(uart_gas_byte19).publish_state(bytes[19]); // Always 0
          id(uart_gas_byte20).publish_state(bytes[20]); // almost identical to high_byte_kcal
          id(uart_gas_byte21).publish_state(bytes[21]); // Always 1
          id(uart_gas_byte22).publish_state(bytes[22]); //Low byte current gas usage in kcal
          id(uart_gas_byte23).publish_state(bytes[23]); //High byte current gas usage in kcal
          id(total_kcal).publish_state((bytes[23] * 256.0) + (bytes[22]));
          id(instant_btus).publish_state(((bytes[23] * 256.0) + bytes[22]) * 3.965667);
          id(uart_gas_byte24).publish_state(bytes[24] / 10.0); //Total gas usage in 0.1m^3 (divide by 10 to get m^3)
          id(total_gas_use_ccf).publish_state(bytes[24] / 10.0 / 2.832);
          id(total_gas_use_therms).publish_state(bytes[24] / 10.0 / 2.832 * 1.02845);
          id(uart_gas_byte25).publish_state(bytes[25]); // mostly 53, then 173
          id(uart_gas_byte26).publish_state(bytes[26]); // Always 0
          id(uart_gas_byte27).publish_state(bytes[27]); // Always 0
          id(uart_gas_byte28).publish_state(bytes[28]); // Always 0
          id(uart_gas_byte29).publish_state(bytes[29]); // Always 2
          id(uart_gas_byte30).publish_state(bytes[30]); // slowly increasing? 10 - 15
          id(uart_gas_byte31).publish_state(bytes[31]); // Always 6
          id(uart_gas_byte32).publish_state(bytes[32]); // Always 86
          id(uart_gas_byte33).publish_state(bytes[33]); // Always 173
          id(uart_gas_byte34).publish_state(bytes[34]); // Always 186
          id(uart_gas_byte35).publish_state(bytes[35]);
          id(uart_gas_byte36).publish_state(bytes[36]); // could be runtime? 106
          id(uart_gas_byte37).publish_state(bytes[37]);
          id(uart_gas_byte38).publish_state(bytes[38]);
          id(uart_gas_byte39).publish_state(bytes[39]);
          id(uart_gas_byte40).publish_state(bytes[40]);
          id(uart_gas_byte41).publish_state(bytes[41]);
          id(uart_gas_byte42).publish_state(bytes[42]);
          id(uart_gas_byte43).publish_state(bytes[43]);
          id(uart_gas_byte44).publish_state(bytes[44]);
          id(uart_gas_byte45).publish_state(bytes[45]);
          id(uart_gas_byte46).publish_state(bytes[46]);
          id(uart_gas_byte47).publish_state(bytes[47]);
          id(uart_gas_byte48).publish_state(bytes[48]); // checksum?
          } else {
          // Handle other cases
          }
      

###############################
#### ENABLE/DISABLE HEATER ####
###############################

switch:
  - platform: template
    name: "HW Heater On/Off"
    id: navien_switch
    restore_mode: ALWAYS_ON
    icon: mdi:water-boiler
    lambda: |-
      if ((id(uart_water_byte9).state) == 5 || (id(uart_water_byte9).state) == 37) {
        return true;
        id(navien_switch).publish_state(true);
      } else {
        return false;
        id(navien_switch).publish_state(false);
      }
    turn_on_action:
      - uart.write: !lambda 
          return {0xf7, 0x05, 0x0f, 0x50, 0x10, 0x0c, 0x4f, 0x00, 0x0a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xce};
          id(navien_switch).publish_state(true);
    turn_off_action:
      - uart.write: !lambda 
          return {0xf7, 0x05, 0x0f, 0x50, 0x10, 0x0c, 0x4f, 0x00, 0x0b, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xa};
          id(navien_switch).publish_state(false);
  
  # - platform: template
  #   name: "Fake Thermostat Switch"
  #   id: fake_switch
  #   restore_mode: ALWAYS_ON
  #   optimistic: True
  #   internal: True


####################################################################
#### SETPOINT ENTRY TEMPLATE  - STILL WORKING ON THIS 4/29/2024 ####
####################################################################

# climate:
#   - platform: thermostat
#     name: "Climate Controller"
#     visual:
#       min_temperature: 120 °F
#       max_temperature: 140 °F
#       temperature_step: 1.0 °F
#     sensor: outlet_temp
#     min_heating_off_time: 300s
#     min_heating_run_time: 300s
#     min_idle_time: 30s
#     heat_action:
#       - switch.turn_on: fake_switch
#     idle_action:
#       - switch.turn_off: fake_switch
    

################################
#### WATER TEMPLATE SENSORS ####
################################
sensor:
  - platform: template
    name: "WByte_0"
    id: uart_water_byte0
    internal: True
  - platform: template
    name: "WByte_01"
    id: uart_water_byte1
    internal: True
  - platform: template
    name: "WByte_02"
    id: uart_water_byte2
    internal: True
  - platform: template
    name: "WByte_03"
    id: uart_water_byte3
    internal: True
  - platform: template
    name: "WByte_04"
    id: uart_water_byte4
    internal: True
  - platform: template
    name: "WByte_05"
    id: uart_water_byte5
    internal: True
  - platform: template
    name: "WByte_06"
    id: uart_water_byte6
    # internal: True
  - platform: template
    name: "WByte_07"
    id: uart_water_byte7
    internal: True
  - platform: template
    name: "WByte_08"
    id: uart_water_byte8
    # internal: True
    unit_of_measurement: points
  - platform: template
    name: "WByte_09 - Power State"
    id: uart_water_byte9
    internal: true
  - platform: template
    name: "WByte_10"
    id: uart_water_byte10
    unit_of_measurement: points
    # internal: True
  - platform: template
    name: "WByte_10 - Set Temp"
    id: uart_water_byte11
    icon: mdi:thermometer-water
    unit_of_measurement: °C
    accuracy_decimals: 1
    device_class: "temperature"
    state_class: "measurement"
  - platform: template
    name: "Heat Exchange Outlet Temp"
    id: uart_water_byte12
    icon: mdi:thermometer-water
    unit_of_measurement: °C
    accuracy_decimals: 1
    device_class: "temperature"
    state_class: "measurement"
  - platform: template
    name: "Heat Exchange Inlet Temp"
    id: uart_water_byte13
    icon: mdi:thermometer-water
    unit_of_measurement: °C
    accuracy_decimals: 1
    device_class: "temperature"
    state_class: "measurement"
  - platform: template
    name: "WByte_14"
    id: uart_water_byte14
    internal: True
  - platform: template
    name: "WByte_15"
    id: uart_water_byte15
    internal: True
  - platform: template
    name: "WByte_16"
    id: uart_water_byte16
    internal: True
  - platform: template
    name: "WByte_17 - GPM"
    id: uart_water_byte17
    icon: mdi:water-percent
    unit_of_measurement: GPM
    # internal: True
  - platform: template
    name: "Water Flow LPM"
    id: uart_water_byte18 # multiply by 0.2642 to get GPM
    icon: mdi:water-percent
    unit_of_measurement: l/min
  - platform: template
    name: "Water Flow GPM"
    id: water_flow_gpm # this is derived from the Water Flow LPM entity
    icon: mdi:water-percent
    unit_of_measurement: GPM
  - platform: template
    name: "WByte_19 Unknown Flow"
    id: uart_water_byte19
    # internal: True
  - platform: template
    name: "WByte_20"
    id: uart_water_byte20
    unit_of_measurement: points
    # internal: True
  - platform: template
    name: "WByte_21"
    id: uart_water_byte21
    unit_of_measurement: points
    # internal: True
  - platform: template
    name: "WByte_22"
    id: uart_water_byte22
    unit_of_measurement: points
    # internal: True
  - platform: template
    name: "WByte_23"
    id: uart_water_byte23
    unit_of_measurement: points
    # internal: True
  - platform: template
    name: "WByte_24 Sys Status"
    id: uart_water_byte24
    unit_of_measurement: points
    # internal: True
  - platform: template
    name: "WByte_25"
    id: uart_water_byte25
    unit_of_measurement: points
    # internal: True
  - platform: template
    name: "WByte_26"
    id: uart_water_byte26
    unit_of_measurement: points
    # internal: True
  - platform: template
    name: "WByte_27"
    id: uart_water_byte27
    unit_of_measurement: points
    # internal: True
  - platform: template
    name: "WByte_28"
    id: uart_water_byte28
    unit_of_measurement: points
    # internal: True
  - platform: template
    name: "WByte_29"
    id: uart_water_byte29
    unit_of_measurement: points
    # internal: True
  - platform: template
    name: "WByte_30"
    id: uart_water_byte30
    unit_of_measurement: points
    # internal: True
  - platform: template
    name: "WByte_31"
    id: uart_water_byte31
    unit_of_measurement: points
    # internal: True
  - platform: template
    name: "WByte_32"
    id: uart_water_byte32
    unit_of_measurement: points
    # internal: True
  - platform: template
    name: "WByte_33"
    id: uart_water_byte33
    unit_of_measurement: points
    # internal: True
  - platform: template
    name: "WByte_34"
    id: uart_water_byte34
    unit_of_measurement: points
    # internal: True
  - platform: template
    name: "WByte_35"
    id: uart_water_byte35
    unit_of_measurement: points
    # internal: True
  - platform: template
    name: "WByte_36"
    id: uart_water_byte36
    unit_of_measurement: points
    # internal: True
  - platform: template
    name: "WByte_37"
    id: uart_water_byte37
    unit_of_measurement: points
    # internal: True
  - platform: template
    name: "WByte_38"
    id: uart_water_byte38
    unit_of_measurement: points
    # internal: True
  - platform: template
    name: "WByte_39"
    id: uart_water_byte39
    unit_of_measurement: points
    # internal: True
  - platform: template
    name: "WByte_40"
    id: uart_water_byte40
    internal: True
##############################
#### GAS TEMPLATE SENSORS ####
##############################
  - platform: template
    name: "GByte_0"
    id: uart_gas_byte0
    internal: True
  - platform: template
    name: "GByte_01"
    id: uart_gas_byte1
    internal: True
  - platform: template
    name: "GByte_02"
    id: uart_gas_byte2
    internal: True
  - platform: template
    name: "GByte_03"
    id: uart_gas_byte3
    internal: True
  - platform: template
    name: "GByte_04"
    id: uart_gas_byte4
    internal: True
  - platform: template
    name: "GByte_05"
    id: uart_gas_byte5
    internal: True
  - platform: template
    name: "GByte_06"
    id: uart_gas_byte6
    unit_of_measurement: points
    # internal: True
  - platform: template
    name: "GByte_07"
    id: uart_gas_byte7
    unit_of_measurement: points
    # internal: True
  - platform: template
    name: "GByte_08"
    id: uart_gas_byte8
    unit_of_measurement: points
    # internal: True
  - platform: template
    name: "GByte_09"
    id: uart_gas_byte9
    unit_of_measurement: points
    # internal: true
  - platform: template
    name: "GByte_10"
    id: uart_gas_byte10
    unit_of_measurement: points
    # internal: True
  - platform: template
    name: "GByte_11"
    id: uart_gas_byte11
    unit_of_measurement: points
    # internal: True
  - platform: template
    name: "GByte_12"
    id: uart_gas_byte12
    unit_of_measurement: points
    # internal: True
  - platform: template
    name: "GByte_13"
    id: uart_gas_byte13
    unit_of_measurement: points
    # internal: True
  - platform: template
    name: "GByte_14 - Set Temp"
    id: uart_gas_byte14
    icon: mdi:thermometer-water
    unit_of_measurement: °C
    accuracy_decimals: 1
    device_class: "temperature"
    state_class: "measurement"
  - platform: template
    name: "GByte_15 - Outlet Temp"
    id: uart_gas_byte15
    icon: mdi:thermometer-water
    unit_of_measurement: °C
    accuracy_decimals: 1
    device_class: "temperature"
    state_class: "measurement"
  - platform: template
    name: "GByte_16 - Inlet Temp"
    id: uart_gas_byte16
    icon: mdi:thermometer-water
    unit_of_measurement: °C
    accuracy_decimals: 1
    device_class: "temperature"
    state_class: "measurement"
  - platform: template
    name: "GByte_17"
    id: uart_gas_byte17
    unit_of_measurement: points
    # internal: True
  - platform: template
    name: "GByte_18"
    id: uart_gas_byte18
    unit_of_measurement: points
    # internal: True
  - platform: template
    name: "GByte_19"
    id: uart_gas_byte19
    unit_of_measurement: points
    # internal: True
  - platform: template
    name: "GByte_20"
    id: uart_gas_byte20
    unit_of_measurement: points
    # internal: True
  - platform: template
    name: "GByte_21"
    id: uart_gas_byte21
    unit_of_measurement: points
    # internal: True
  - platform: template
    name: "kCal Low Byte"
    id: uart_gas_byte22
    icon: mdi:gas-burner
    unit_of_measurement: kCal
  - platform: template
    name: "kCal High Byte"
    id: uart_gas_byte23
    icon: mdi:gas-burner
    unit_of_measurement: kCal
  - platform: template
    name: "Total Gas Use Cubic Meters"
    id: uart_gas_byte24 # divide by 2.832 to get CCF
    icon: mdi:gas-cylinder
    unit_of_measurement: m³
    accuracy_decimals: 1
  - platform: template
    name: "GByte_25"
    id: uart_gas_byte25
    unit_of_measurement: points
    # internal: True
  - platform: template
    name: "GByte_26"
    id: uart_gas_byte26
    unit_of_measurement: points
    # internal: True
  - platform: template
    name: "GByte_27"
    id: uart_gas_byte27
    unit_of_measurement: points
    # internal: True
  - platform: template
    name: "GByte_28"
    id: uart_gas_byte28
    unit_of_measurement: points
    # internal: True
  - platform: template
    name: "GByte_29"
    id: uart_gas_byte29
    unit_of_measurement: points
    # internal: True
  - platform: template
    name: "GByte_30"
    id: uart_gas_byte30
    unit_of_measurement: points
    # internal: True
  - platform: template
    name: "GByte_31"
    id: uart_gas_byte31
    unit_of_measurement: points
    # internal: True
  - platform: template
    name: "GByte_32"
    id: uart_gas_byte32
    unit_of_measurement: points
    # internal: True
  - platform: template
    name: "GByte_33"
    id: uart_gas_byte33
    unit_of_measurement: points
    # internal: True
  - platform: template
    name: "GByte_34"
    id: uart_gas_byte34
    unit_of_measurement: points
    # internal: True
  - platform: template
    name: "GByte_35"
    id: uart_gas_byte35
    unit_of_measurement: points
    # internal: True
  - platform: template
    name: "GByte_36"
    id: uart_gas_byte36
    unit_of_measurement: points
    # internal: True
  - platform: template
    name: "GByte_37"
    id: uart_gas_byte37
    unit_of_measurement: points
    # internal: True
  - platform: template
    name: "GByte_38"
    id: uart_gas_byte38
    unit_of_measurement: points
    # internal: True
  - platform: template
    name: "GByte_39"
    id: uart_gas_byte39
    unit_of_measurement: points
    # internal: True
  - platform: template
    name: "GByte_40"
    id: uart_gas_byte40
    unit_of_measurement: points
    # internal: True
  - platform: template
    name: "GByte_41"
    id: uart_gas_byte41
    unit_of_measurement: points
    # internal: True
  - platform: template
    name: "GByte_42"
    id: uart_gas_byte42
    unit_of_measurement: points
    # internal: True
  - platform: template
    name: "GByte_43"
    id: uart_gas_byte43
    unit_of_measurement: points
    # internal: True
  - platform: template
    name: "GByte_44"
    id: uart_gas_byte44
    unit_of_measurement: points
    # internal: True
  - platform: template
    name: "GByte_45"
    id: uart_gas_byte45
    unit_of_measurement: points
    # internal: True
  - platform: template
    name: "GByte_46"
    id: uart_gas_byte46
    unit_of_measurement: points
    # internal: True
  - platform: template
    name: "GByte_47"
    id: uart_gas_byte47
    unit_of_measurement: points
    # internal: True
  - platform: template
    name: "GByte_48"
    id: uart_gas_byte48
    internal: True
  # calculated as shown here https://www.plctalk.net/threads/low-byte-high-byte.78315/
  - platform: template
    name: "Total kCal"
    id: total_kcal
    icon: mdi:gas-burner
    unit_of_measurement: kcal
    accuracy_decimals: 2
    state_class: "measurement"
    device_class: "energy"
  - platform: template
    name: "Instant BTUs"
    id: instant_btus
    icon: mdi:gas-burner
    unit_of_measurement: "btu/hr"
    accuracy_decimals: 1
    state_class: "measurement"
  - platform: template
    name: "Total Gas Use CCF"
    id: total_gas_use_ccf # this is derived from the entity Total Gas Use Cubic Meters and converts to CCF for comparison to US energy bills.
    icon: mdi:gas-cylinder
    unit_of_measurement: CCF
    accuracy_decimals: 1
    state_class: "measurement"
  - platform: template
    name: "Total Gas Use Therms"
    id: total_gas_use_therms # this is derived from the entity Total Gas Use CCF and one of the typical measurements for the utility company to bill against in the US.
    icon: mdi:gas-cylinder   # this multiplier 1.02845 was obtained from my energy bill - it is known as "Therm Factor" on my bill
    unit_of_measurement: therms
    accuracy_decimals: 1


Can I convert to the:
:point_right: Project repo: GitHub - htumanyan/navien: Navien water heater wire protocol for communication with NaviLink and other attached devices

I try, but the new yaml I try to create and use is not working…any help would be appreciated!

I’d be glad to help if you could share more on what have you tried? in simplest form, if you are compiling from the command line, you can take one of the prebuilt yaml files - navien/esphome/navien-d1-mini.yml at 928d3609a9ce06afcff02706d1a8fcff81a1ba86 · htumanyan/navien · GitHub or navien/esphome/navien-esphome-atom-lite-esp32.yml at 928d3609a9ce06afcff02706d1a8fcff81a1ba86 · htumanyan/navien · GitHub and run esphome run not forgetting to copy secrets.yaml into the esphome folder so that it has your wifi credentials.

Feel free to reach out in PM if needed…

I think I got it in ESPHOME in homeassistant

yaml contents:

esphome:
  name: navien
  friendly_name: Navien Water Heater

esp32:
  board: esp32-s3-devkitc-1
  variant: esp32s3
  framework:
    type: arduino

logger:
  level: WARN

api:

ota:
  - platform: esphome

wifi:
  ssid: !secret wifi_ssid
  password: !secret wifi_password
  manual_ip:
    static_ip: x.x.x.x
    gateway: x.x.x.x
    subnet: x.x.x.x

external_components:
  - source: github://htumanyan/navien
    components: [navien]
    refresh: 0s

uart:
  id: uart_bus
  tx_pin: 6
  rx_pin: 5
  baud_rate: 19200
  data_bits: 8
  stop_bits: 1
  parity: NONE

I guess now I wonder about all the sensors I had before?

You are almost there. Here are a few hints and suggestions:

a. Look at navien/esphome/navien.example.yml at 928d3609a9ce06afcff02706d1a8fcff81a1ba86 · htumanyan/navien · GitHub for an example of how to configure the espbuilder - can copy it from there to your espbuilder and customize.

b. Sensor definitions are moved to separate yaml file (navien-sensors.yml) that are included from platform-specific ones. For example, the navien-esphome-atom-lite-esp32.yml includes it (as well as others).

The sensors.yml is an exhaustive collection of all known and supported sensors.

Does this make sense? Happy to help if not or if anything does not work.

Ahhh…I think I am on the right track…

I’m trying to do the same. It’s been a bit since I’ve been deep in the esphome config world so I’m a bit rusty. However, it looks like the problem is that if we try and include anything that includes navien_base.yml it will complain as that file is referring to local components.

I.e. if I include the contents you referenced for the atom-lite board, when ESPHome Builder compiles it gives this error:

Failed config

external_components: [source /data/packages/4e65cc63/esphome/navien-base.yml:25]
  - source: 
      type: local
      
      Could not find directory '/config/esphome/components'. Please make sure it exists (full path: /config/esphome/components).
      path: components
    components: 
      - navien
  - source: github://htumanyan/navien
    refresh: 0s

On the docs on the repo, it indicates that the top pin is 14V, but your description shows pin 1 as GND. Are the docs wrong?

I ask as I have my 240A2 hooked up according to the docs but I’m not getting any signal, despite having enabled NaviLink.

My apologies - apparently I’ve missed a contribution that broke remote build. I just put in a fix in the repository that leads to successful compilation in my environment using navien.example.yml - can you try copying that into your esphome builder and running? It expects you to have local secrets.yml

Also in the files section right now it is pointing to d1-mini build. Swap that with atom-lite line if you run atom-lite.

One important step with setting it up is to enable NaviLink in the system menu on Navien device - it won’t produce any activity on the port if not enabled. Have you enabled it?

Here is the link to the cabling details for 240A/240A2 - navien/doc/240.md at 83231cc07c1bf41171e7a732407e6a53d8c77b5d · htumanyan/navien · GitHub

Ya, I did note that I have NaviLink enabled. I setup mine using the link you provided, but looking at back at previous post/pics I think the doc have the pins reversed. I.e. the docs show that pin 5 (GND) is at the bottom, but it seems the rest of the posts and pics on this thread are using the top pin as GND. Some references:

@htumanyan just following up. I swapped the order of my connector to the reverse and that fixed it. So you may want to update the docs to reflect that. It may be helpful to include a pic for others…I know I found those to be super helpful.

The hot-button doesn’t seem to work atm so I’ll need to figure that out. I have an A2 so it should just work and I checked the dip-switches on the board as well. I “press” it (in Home Assistant) and nothing happens :man_shrugging:

The hot-button doesn’t seem to work atm so I’ll need to figure that out. I have an A2 so it should just work and I checked the dip-switches on the board as well. I “press” it (in Home Assistant) and nothing happens :man_shrugging:

For the soft hot button to work, the re-circulation mode needs to be set to “Manual Hot Button” (ie not “always on”, “intelligent” or “weekly”).

I find I don’t need the hot button with this automation blueprint:

The approach temporarily enables recirculation for a button press and otherwise just follows a schedule.

I was just about to reply saying I figured that out as well (needing to set it to that). I also just read about the blueprint and thinking that it’s exactly what I need. Now I just need som time to sit down and play with it.

@htumanyan have a question around this. I setup the blueprint up with the various entities. If I press the “NavienHotButton” I can see that it toggles off/on the “Allow Recirculation” toggle as expected, but it doesn’t seem to kick off a recirculation cycle as I’d expect.

I currently have it set to “Intelligent” for the recirculation mode, and the manual button did work when I set it to manual mode. I’m wondering if there’s something I’m missing.

I’ll try and get to this in the next couple of days. I worked around it for the time being, though I am using the branch you set up for the newer ESPHome versions (so I can confirm that branch solves the issue where the entities weren’t updating).

Was able to setup the device from @htumanyan without any issues, thanks!

I noticed the hot button wasn’t working with an A2, when the water heater was setup correctly as well. I realized the enable/disable recirculation functionality it offers provided better behavior for what I was looking for so it ended up working out.

I’m trying to get this working on my Navien NPE-240A2 using an M5Stack Atom S3 Lite (ESP32-S3) and the Atomic RS485 Base, but I am unable to get any communication going.

I am a factory NaviLink module with this ESPHome node. I have verified that NaviLink is enabled in the service menu, and the factory module was working perfectly on this exact port immediately before I swapped it for the ESP32.

I am using the latest version of the component from GitHub, which is supposed to include the fixes for ESPHome 2026.1 compatibility.

Hardware & Wiring

  • MCU: M5Stack Atom S3 Lite (ESP32-S3)
  • Adapter: M5Stack Atomic RS485 Base
  • Power: Powered directly from the Navien 12v port.

I verified the pins with a multimeter (confirmed Ground and +12V). The connector cable I made skips the same pin (pin 2) as the stock cable from Navien.

My Pinout (Top to Bottom on the Navien board):

  • Pin 1 (Top): → Adapter G (Ground)
  • Pin 2: [Empty / Skipped]
  • Pin 3: → Adapter A (Data+)
  • Pin 4:B (Data-)
  • Pin 5 (Bottom): → Adapter DC 12V

I see zero incoming data in the logs. I have added a UARTDebug lambda to the config to try and catch anything on the wire, but it returns nothing.

Troubleshooting So Far

  1. Pin Swapping: Tried Standard (TX=G6, RX=G5) and Swapped (TX=G5, RX=G6) in YAML.
  2. Physical Wiring: Swapped the Data lines on the screw terminal. (I tried swapping Pin 3 and Pin 4 physically, but neither orientation produced data).
  3. Baud Rates: Tested 9600, 19200, and 38400.
  4. Frameworks: Tested both arduino and esp-idf.

YAML config:

substitutions:
  sensor_suffix: ''
  name: navien
  friendly_name: Navien
  project_version: 1.0.0
  rx_pin: GPIO5
  tx_pin: GPIO6

esphome:
  name: navien
  friendly_name: navien
  min_version: 2026.1.4
  build_path: build/navien
  platformio_options: {}

esp32:
  board: esp32-s3-devkitc-1
  variant: ESP32S3
  framework:
    type: esp-idf
    version: 5.5.2
  flash_size: 4MB
  cpu_frequency: 160MHZ

logger:
  level: VERBOSE
  baud_rate: 115200
  hardware_uart: USB_SERIAL_JTAG

api:
  reboot_timeout: 15min

ota:
  - platform: esphome

mqtt:
  broker: ''
  username: <REDACTED>
  password: <REDACTED>
  topic_prefix: esphome/navien
  enable_on_boot: true

text_sensor:
  - platform: wifi_info
    ip_address:
      name: IP
    ssid:
      name: SSID
  - platform: navien
    navien: navien_main
    name: Navien Heating Mode
    id: heating_mode
    heating_mode: true
  - platform: navien
    navien: navien_main
    name: Navien Device Type
    id: device_type
    device_type: true
  - platform: navien
    navien: navien_main
    name: Navien Operating State
    id: operating_state
    operating_state: true

sensor:
  - platform: wifi_signal
    name: Signal dB
    id: wifi_signal_db
  - platform: navien
    id: navien_main
    src: 0
    name: Navien Metrics
    uart_id: main_hw_uart
    target_temperature:
      name: Navien Target Temp
      filters:
        - lambda: !lambda |-
            return x * (9.0/5.0) + 32.0;
      unit_of_measurement: °F
    inlet_temperature:
      name: Navien Inlet Temp
      filters:
        - lambda: !lambda |-
            return x * (9.0/5.0) + 32.0;
      unit_of_measurement: °F
    outlet_temperature:
      name: Navien Outlet Temp
      filters:
        - lambda: !lambda |-
            return x * (9.0/5.0) + 32.0;
      unit_of_measurement: °F
    water_flow:
      name: Navien Water Flow
      filters:
        - lambda: !lambda |-
            return x / 3.785;
      unit_of_measurement: GPM
    gas_current:
      name: Navien Current Gas Usage
      filters:
        - lambda: !lambda |-
            return x * 3.9680;
      unit_of_measurement: BTU

wifi:
  domain: <REDACTED>
  manual_ip:
    static_ip: <REDACTED>
    gateway: <REDACTED>
    subnet: 255.255.255.0
  networks:
    - ssid: <REDACTED>
      password: <REDACTED>

external_components:
  - source:
      url: https://github.com/htumanyan/navien
      path: esphome/components
      type: git
    components:
      - navien

uart:
  - tx_pin:
      number: 6
      mode:
        output: true
    rx_pin:
      number: 5
      mode:
        input: true
    baud_rate: 19200
    stop_bits: 1
    parity: NONE
    rx_buffer_size: 8192
    id: main_hw_uart
    debug:
      direction: BOTH
      dummy_receiver: false
      sequence:
        - then:
            - lambda: !lambda |-
                UARTDebug::log_hex(direction, bytes, ' ');
      after:
        bytes: 150
        timeout: 100ms

Has anyone successfully used the Atom S3 Lite + Atomic RS485 Base combination?

Any ideas would be appreciated!

I am interested in buying. How much are you selling it for?