Hi everyone,
I’m trying to integrate a WT61PC sensor (from DFrobot: https://wiki.dfrobot.com/Serial_6_Axis_Accelerometer_SKU_SEN0386) into my ESPHome setup. The sensor communicates via serial, and I’m facing some challenges parsing the data to extract the relevant information as decimal values (logging of hex-values already worked).
I’ve tried (unsuccessfully) using the UART component and custom components, but I’m still struggling to get the desired results (guess my experience with ESPhome isn’t enough yet). I’m looking for guidance on how to effectively and reliably parse the serial data and create sensors for the different parameters.
Here’s some information about the sensor and the data format:
Sensor: WT61PC (at DFrobot also called SEN0368)
Required data: acceleration, angular velocity, angle (each on 3 axes)
to be called from a Script Component on the same controller
ideally also callable from another ESPHome controller (via HA?)
Could you post some samples of the logged hex-values?
It looks like processing the data in the UART debug approach will work (link below). The hex values should contain the below “headers” to make sure the input stream is synced up.
Then the bytes[] array returned in the uart debug would need to be processed similar to the library:
so you would have something like this in your lambda: