Getting Pellet Stove display messages to home assistant via UART decoding #1
Replies: 6 comments 4 replies
-
So, all my initial findings about the data in the posts above were basically all crap. But it got me started. After staring at HEX all day, I've discovered that the display unit controls everything. The MCU brain controller just does what the display unit tells it, sending and ACK msg after each relevant command along with sending update on the 3 temp sensors once per second. Here's the spreadsheet w/ all the final data points that matter: I now need help getting this info into home assistant. I'm not a programmer (hack at best), so unsure of where to start. I think I need a table or array of hex values and how they map to display messages. Once the lookup finds a match, a text sensor could be defined that exposes its value to home assistant. Easier said than done! This looks promising as it processes HEX data (the only one I've found to date) and that's what I'm doing @mulcmu Im just loathe to start as these rabbit holes consume multiple days and hours upon hours of troubleshooting. And lots of stupid questions posed by yours truely on Discord. |
Beta Was this translation helpful? Give feedback.
-
So after a quick review the goal is to create sensors for the UART data sent between the display unit and MCU brain. This data isn't exposed on the serial connection used by the ESPHome Tuya MCU component. The ESP8266 will tap into the UART data sent from the display to the MCU. The UART data will populate one text_sensor with the data highlighted in yellow above. Am I following along okay so far? |
Beta Was this translation helpful? Give feedback.
-
I would recommend the uart-debug-hack approach summarized here. The logic would look something along these lines. I didn't test this but gives example of how to evaluate the hex data with a bit of error checking to arrive at which value to set the text_sensor to.
|
Beta Was this translation helpful? Give feedback.
-
Ok, I added a text sensor to hold rawString. I hope that was correct... and just to test the heart beat I added:
and the output changed to string.
|
Beta Was this translation helpful? Give feedback.
-
Try removing the delimiter. Looks like that strips off two bytes from the packet that would make the packet size ==5 or ==6 logic fail.
Can change the debug output back to UARTDebug::log_hex(direction, bytes, ' ') instead of log string too. |
Beta Was this translation helpful? Give feedback.
-
If the current code works reliably then I don't see a lot of benefit to convert it. The UART traffic isn't high speed and all the packets end with the 0xCC 0x33 sequence so the uart |
Beta Was this translation helpful? Give feedback.
-
First I put an old NodeMCU ESP8266 in action and hooked up GPIO16 to the RX line of the displays UART wire coming from the MCU. I also hooked up my oscilloscope to this line in the hopes it would show me the waveform and give me a clue as to what the baud rate is.
here's the trace
2400 baud looks plausible. The smallest wave form (a bit) I measured looks to me to be about 400us in length which is really close to the 2400 value in this table:
Now you stare at data streams and try and figure out what it all means.
I started with the data line going from the display to the MCU. This seemed easier as the data from the MCU was a jumble of info. Basically 3 temp sensors sending continuous updates, and all the various status messages.
pressing the power level buttons on the display cycle P1,P2,P3,P4,P1,P2,P3,P4,etc and watching the data stream gave me repeatable results which translated into this:
That was enough of a clue to decipher all the main functions the display could send.
Now I turned my attention to the data stream from the MCU to the display. That gave me this
The rest of the messages are the 3 temp sensor updates which I don't care about since the TuyaMCU gives us those in all the datapoints.
The next step is to take each state change and put it into a table in home assistant that can be matched on lookup and then used in Lovelace to show what the stove is doing in real time.
Why? Why not! The engineer in me likes to see what the equipment is doing before or during a failure. And this pellet stove fails a lot.
For example, the random dreaded "Goodbye!" Message can now be immediately recognized in the UART data stream and fixed (turn the stove back on right away) inside an ESPHome routine instead of waiting for the room to cool and comparing temps and then fixing it in an automation in home assistant which may or may not be reachable or functional.
Beta Was this translation helpful? Give feedback.
All reactions