Since the project is a little bit iterative, details are provided in the project logs.
Updates and expands on my earlier project with new hardware at the water heater.
To make the experience fit your profile, pick a username and tell us what interests you.
We found and based on your interests.
Since the project is a little bit iterative, details are provided in the project logs.
Someone in the forum thread who owns a NaviLink unit was able to identify the connector needed for the RS485 interface. It's 5-pin JST-XHB or JST-XH. The "B" stands for buckle and is the little plastic piece that holds the connector firmly in place. For this particular equipment, the XH without a buckle holds pretty firmly. Someone also identified a source for the connectors with long pigtail wires for the 5 pins. They are readily available in lengths up to 30 cm.
That's the good news. I got some of those connectors with pigtails. I got the 30 cm length because I could always trim off some excess wire for tidiness. There are two bits of bad news. First, since I wanted to mount my device on the outside of the cabinet, I'd need to feed the cable through the knock-out grommet in the water heater case. That turns out to be about 40 cm from the socket on the control board where the cable plugs in. Second, the conductors inside the pigtail wires are pretty flimsy. It was really fiddly getting them stripped and then willing to stay in place in the screw-down terminals of the RS485 device.
I was able to get things assembled, which at least let me prove that the 12v power supply and the signals on the RS485 interface were as expected. I had to mount my device on the bottom of the cabinet, with wires hanging out and held in place by the cabinet cover weatherstripping. Yikes, like a barbarian!
Another common use for JST-XH connectors is in battery chargers for remote-controlled cars and other devices. There, the cables are called "balance cables" because of the way they work with mulit-cell lithium ion battery packs. As a trap for the unwary, the nomenclature of those cables uses a number that is one less than the number of conductors. So, for a 5-pin cable, it's called "4S". It's typically a single red wire and all the rest are black.
Balance cables are also readily available, but again in relatively short lengths. I didn't find any longer than the 30 cm cable I already had. But you can also buy cables that act as extensions, with a male connector on one end and a female connector on the other end. I bought a few of those in 20 cm length and strung them together to make an 80 cm cable. (When using these for charging batteries, there would very well be some rules about how long they can be, how many you can string together, etc. I don't think any of that applies for RS485 since it's intended to stretch over distances in noisy environments.) On the end toward the relay device, it was pretty easy to pull the connector off, leaving the metal pins that were already attached to the individual wires. Those made much better connections to the screw-down terminals of the relay, so I dropped my original pigtail cable out of the picture entirely.
Here is the final, mounted device. The Atom Lite on the RS485 base is on the right, and the relay is on the left. They are connected with a Grove connector cable (the shortest I had on hand). The device is mounted with some rare-earth magnets that I glued to the bottom.
For the relay contact wires, I just reached into my junk drawer an pulled out some wires that I thought would be easy to clamp into the screw-down terminal of the relay. They're pretty thick (blue in the photo) even though they need to carry next to no current. That also made them easy to bind to the screw terminals on the control board.
In my original implementation, I also had a simple momentary push-button wired to the control board in addition to the relay device. That was so I could troubleshoot things without going through any of the fancy-schmancy automation logic. After that first day, I never used that button again, so I removed it this time around.
Except for possibly pondering some of the additional information reported over the RS485 interface, this project is done. I don't intend to implement any additional controls from my electronics to the water heater.
My aim has always been to have the remote Atom Lite units blink yellow when the pump is running and stop blinking when the pump stops. Until now, I've been unable to do that, and I've just been using a simple timer that reflects the worst case value. It takes just slightly over 2 minutes for the NaviCirc cross-over valve to close when the water in my pipes starts out cool, so my timer was 2 minutes and 15 seconds. If the water is already hot, the cross-over valve stays closed and the pump hardly runs at all.
With these new RS485 reports, I still have not found a bit that definitively indicates that the pump is running. Some people have seen such a bit flip in one of the bytes, but they have different Navien units than I have (I think). That bit position does not change for me. There is a bit that I am using as a proxy for that. The bit indicates if hot water is flowing, which I call "Consumption active" in my sensors. There is also a report of the water flow rate. The bit for consumption active is set whenever hot water flows, which means it may or may not be due to the recirculation pump. If hot water is not actually flowing out of any faucet, shower, or appliance, then that bit is an accurate proxy for the pump.
I expect that, most of the time when the remote buttons are pressed, other hot water is not being used. Sometimes that expectation will not be met. If the dishwasher is running or if someone is washing their hands while waiting for the hot water, that consumption bit will not reset when the pump stops. For now, I'll just live with that.
My Home Assistant automation for starting the hot button cycle is pretty much as it was before. I merely substituted my new relay device in place of the prior relay device.
Here's the YAML for that:
alias: Tankless hot button
description: Press the button, get hot water
triggers:
- entity_id:
- binary_sensor.hotbuttonkb_button
from: "off"
to: "on"
trigger: state
- entity_id:
- binary_sensor.hotbuttonmb_button
from: "off"
to: "on"
trigger: state
- trigger: state
entity_id:
- binary_sensor.hotbuttonrelay_al_atom_button
from: "off"
to: "on"
conditions: []
actions:
- data: {}
action: script.tankless_button_cycle
mode: parallel
max: 10
The script "tankless_button_cycle", on the other hand, did undergo some changes.
Here is the YAML for that script:
alias: Tankless button cycle
sequence:
- type: turn_on
device_id: 7c8657a0b747b7584ec3775223c14045
entity_id: ea0d9e3eb5631aa2876a1112f6c8c8cc
domain: switch
- parallel:
- data: {}
action: esphome.hotbuttonkb_set_led_hot
continue_on_error:...
Read more »
Things have kind of settled down for me on this effort, so I'm cleaning up and finalizing various sensor activity.
Unless a more comprehensive Navien component for ESPHome arises, I'll stick with the pure YAML approach, which is what I'm doing right now. I started with the approach seen in https://github.com/evanjarrett/ESPHome-Navien/blob/main/navien.yaml, but I made several functional and stylistic changes. That starting YAML is great for the reverse engineering task, but it's a bit cluttered for a more refined interface.
The ESPHome UART bus component is intended to be used as plumbing by other components. In the pure YAML case, there is no other component. The UART bus debug configuration (unrelated to DEBUG logging level in ESPHome) gives direct access to the underlying I/O buffer. That is just right for extracting information and updating template sensors based on that data. Luckily, the RS485 packets for the Navien are newline-delimited, which lines up with how the UART bus debugging wants to see things.
This is the configuration part of the uart block (doesn't include the decoding logic in the lambda, which I'll describe later):
uart:
id: uart_bus
tx_pin: 19
rx_pin: 22
baud_rate: 19200
data_bits: 8
stop_bits: 1
parity: NONE
debug:
direction: BOTH
dummy_receiver: True
after:
delimiter: "\n"
sequence:
- lambda: |-
UARTDebug::log_hex(direction, bytes, ' ');
UARTDebug::log_int(direction, bytes, ' ');
When DEBUG logging is enabled in the overall configuration, all RS485 packet bytes are logged as hex and decimal values. I changed the delimiter to a space because I find that easier to read.
[10:56:54][D][uart_debug:114]: <<< F7 05 50 0F 90 2A 45 00 0B 01 0C 02 17 00 62 5D 28 00 00 00 00 05 00 00 CB 14 00 00 2C 02 E7 08 B1 50 14 00 E0 01 00 00 00 00 AA 48 00 00 00 00 58 F7 05 50 50 90 22 42 00 00 05 49 62 5D 2C 00 00 00 00 00 00 A0 BE 00 20 00 00 00 00 E0 01 01 00 00 02 B9 00 00 00 00 00 5A
[10:56:54][D][uart_debug:176]: <<< 247 5 80 15 144 42 69 0 11 1 12 2 23 0 98 93 40 0 0 0 0 5 0 0 203 20 0 0 44 2 231 8 177 80 20 0 224 1 0 0 0 0 170 72 0 0 0 0 88 247 5 80 80 144 34 66 0 0 5 73 98 93 44 0 0 0 0 0 0 160 190 0 32 0 0 0 0 224 1 1 0 0 2 185 0 0 0 0 0 9
I mainly adopted the decoding techniques and names from https://github.com/dacarson/NavienManager/blob/main/Navien.cpp, though I temporarily gave the sensors IDs and names prefixed with "dc_". For tidiness and performance reasons, I removed things that did not yet have an interpretation. Where things appeared to be booleans, I made them template binary sensors instead of template numeric sensors. For the controller and panel version information, I made them template text sensors (though they don't completely match what I see on the water heater's display). For the sensors I'm currently observing, I took them at face value, though I am pretty sure some of them are either wrongly decoded values or are misinterpreted as the wrong kind of information; that will be sorted out in a later step. For now, I am avoiding doing conversions of things like centigrade to Fahrenheit, though I do the trivial sorts of conversions needed for the Navien-specific conventions.
The structure of the code generated by ESPHome is mostly a large and sophisticated polling loop. Best practice is to avoid any long delays in a synchronously executing component. In fact, if anything takes longer than 30 ms, a warning is written to the console. I'm not sure what happens in practice, but in theory some timing-based operations could be delayed or missed. There are two sources of delay in the UART bus debugging section. First, the very act of using the UART logging methods (with nothing else) is enough to bring the timing to 50-60 ms. That can be easily suppressed by setting the overall logging level to something less verbose than DEBUG. I typically use INFO for otherwise-chatty stable code. Second, the logic for decoding the bytes and publishing updates to the template sensors can add another 100 ms or so if DEBUG logging is enabled,...
Read more »Besides the collaborative reverse-engineering effort documented in the forum thread, there are at least 2 concrete ESPHome interface configurations. They differ a bit in approach. The github repositories for both include documentation of the packet formats. They expect bytes to be read/written over the UART interface, implying a separate component that translates the microcontroller's logic levels to RS485 signals.
The repository https://github.com/evanjarrett/ESPHome-Navien takes the approach of defining everything inside a YAML file. Debug logging within that configuration facilitates the iterative discovery process for reverse engineering. Most of the packet data bytes are made available as simple values, but some well-understood items are given semantically meaningful names. Some ideas for this repository seem to have been taken from or inspired by https://github.com/esphome-econet/esphome-econet.
The repository https://github.com/htumanyan/navien takes the approach isolating the low-level manipulation into an ESPHome custom component. That simplifies the YAML configuration and, in the long term, is more consistent with how other components are usually referenced in ESPHome. However, it comes at the expense of being a bit more cumbersome for iterative discovery. Only a handful of data items are exposed as sensors and switches for use in YAML. Adding more requires manipulating the code for the custom component and making related changes to the YAML.
There is also a non-ESPHome implementation in repository https://github.com/dacarson/NavienManager. It uses Arduino environment but is still useful as an information source.
My short-term aims are these:
Taking those into account and the current state of the two GitHub repositories, I plan to start with the pure YAML implementation. I'll observe for a while and then decide what to do.
In the forum thread I mentioned, other people have already figured out the connectors and wiring arrangement for the Navien board's RS485 interface. For example, in this post, user aruffell provides this clear picture of a custom cable they created:
The connector in the picture is a 5-pin JST-XH, though the slightly preferred connector is JST-XHB (the "B" is for "buckle", the integrated clip that keeps the connector from coming out). Both have been reported to work without issue.
In this post, user tsquared shows the wiring with the connector inserted into the socket on the Navien board:
RS485 uses differential signalling, and there is an A and a B signal line. Only 4 pins of the JST-XHB connector are used. Combining the info from the above pictures, the pin assignments are:
As I mentioned, my first step is to ignore the RS485 stuff and get the hot button mechanism working with this new hardware setup. Because I used ESPHome, things are mostly abstracted. Here are the changes I made based on testing the new assembly:
Here's the YAML so far:
# https://hackaday.io/project/202744-calling-for-hot-water-the-recall
substitutions:
node_name: hotbuttonrelay-al
RELAY: 'GPIO26'
LED: 'GPIO27'
BUTTON: 'GPIO39'
log_level: 'DEBUG'
esphome:
name: ${node_name}
on_boot:
then:
# delay to allow other boot time stuff to settle down
- delay: 5s
- script.execute: set_led_cold
esp32:
board: pico32
wifi:
ssid: !secret wifi_ssid
id: !secret wifi_ssid
password: !secret wifi_password
power_save_mode: high
fast_connect: on
manual_ip:
static_ip: !secret hotbuttonrelay-al_ip
gateway: !secret wifi_gateway
subnet: !secret wifi_subnet
dns1: !secret wifi_dns1
dns2: !secret wifi_dns2
logger:
level: ${log_level}
api:
encryption:
key: !secret hotbuttonrelay-al_apikey
reboot_timeout: 60min
services:
- service: set_led_hot
then:
- logger.log:
tag: 'hotbutton'
level: INFO
format: "service: set_led_hot"
- script.execute: set_led_hot
- service: set_led_cold
then:
- logger.log:
tag: 'hotbutton'
level: INFO
format: "service: set_led_cold"
- script.execute: set_led_cold
- service: set_led_off
then:
- logger.log:
tag: 'hotbutton'
level: INFO
format: "service: set_led_off"
- script.execute: set_led_off
ota:
platform: esphome
password: !secret ota_password
switch:
- platform: restart
name: "${node_name} Reboot"
- platform: gpio
id: i_relay
name: '${node_name} relay'
pin: '${RELAY}'
restore_mode: ALWAYS_OFF
icon: mdi:hot-tub
on_turn_on:
- light.turn_on:
id: bright_light
red: 0%
green: 100%
blue: 0%
- delay: 500ms
- switch.turn_off: i_relay
- light.turn_off:
id: bright_light
# Local test button. This goes through the relay logic,
# so it's not an analog press of the water heater button.
binary_sensor:
- platform: gpio
name: "${node_name} Button"
id: i_button
pin:
number: '${BUTTON}'
inverted: true
mode:
input: true
filters:
- delayed_on: 10ms
- delayed_off: 10ms
light:
- platform: fastled_clockless
id: bright_light
name: ${node_name} LED
chipset: SK6812
pin: '${LED}'
num_leds: 1
rgb_order: GRB # required
default_transition_length: 0s
icon: mdi:led-on
effects:
- pulse:
name: fast_pulse
transition_length: 0.25s
update_interval: 0.25s
min_brightness: 20%
max_brightness: 99%
script:
- id: set_led_hot
then:
- delay: 600ms # give the relay blink a chance to show
- light.turn_on:
id: bright_light
red: 100%
green: 60%
blue: 0%
effect: fast_pulse
- id: set_led_cold
then:
...
Read more »
The RS485 unit and the relay unit both have LEGO-compatible holes in their bodies. I decided to make a 3D-printed slab with a few LEGO studs in the right places to take advantage of that. I started with this nice custom LEGO component generating script: https://github.com/cfinke/LEGO.scad. My requirement was a little unusual, so I made a couple of local modifications to that OpenSCAD script.
The script does include a parametric scaling factor for the diameter size of the studs. Through trial and error, I settled on 1.01 (ie, 101%) to allow for filament shrinkage and still have a snug fit.
Here are the bottom sides of the components along with the 6x6 base I created.
And here is what it looks like when it's press-fit together:
I think it makes a pretty tidy bundle. I haven't yet decided how I will mount this bundle to the water heater, but I'll probably use the refrigerator magnet technology I tried before. This bundle is a bit lighter than the bundle from the earlier project.
At the water heater end, requirements are minimal. Just about any ESP32 variant would fit the bill. I decided to use something from their Atom series since they are cheap and I already have some on hand. Specifically, I'll use an Atom Lite, which has two physical buttons and a single RGB LED.
They have a couple different RS485 interface components that will work with the Atom series. The cheapest option is their RS485 to TTL Converter Unit.
For a tiny amount more, their ATOM Tail485 - RS485 Converter for ATOM makes for a tidier package since it plugs directly into the Atom Lite.
In the end, I didn't choose either of those. I spent a few bucks more and chose the ATOMIC RS485 Base.
The reason for that choice is because it leaves the 4-pin port on the Atom Lite exposed. (It also leaves the USB-C port exposed for power, though once it's wired up to an RS485 circuit, that circuit can power everything.) I'm not sure if the reverse-engineered RS485 conversation will let me remotely "push the button" to call for hot water. For insurance, my first step will be to implement the hot button feature using a relay, as in the previous project. This Mini 3A Relay Unit interfaces to the Atom Lite via that 4-pin port.
The total cost for these three components is under US$20, which is not too bad for a one-off project.
My original project has been operating for a while in a satisfactory way. I do still have one unsolved problem (knowing when the pump stops pumping), though for a while I've had some ideas about how to tackle that. In the meanwhile, some clever and industrious people over in the Home Assistant forums have been making progress on reverse engineering the wire protocol between Navien's NaviLink unit and the tankless water heater. I think that will give me the answer about the pump (not sure). To find out, I'll need an RS485 interface to the water heater control board.
If you look around for an RS485 interface board (as some of the folks in that forum thread have done), you come across some components from M5stack. Their stuff is particularly appealing for one-off projects since it mostly comes in reasonably attractive packages. I already have a little box full of assorted M5stack stuff, so I decided to make use of that and a few things I had to order from them to re-implement the hardware.
Create an account to leave a comment. Already have an account? Log In.
Become a member to follow this project and never miss any updates