Adding levelling control to my Home Assistant in RV

For the past years I have been using Truma app on iPhone to level my RV which looks like this:

This has been great tool so far, but it has required that I put my iPhone on the table behind me when driving so using it has been a nightmare.

For a while back I started looking for alternatives and found some similar ones with external displays, but I did not want this, I was still wanting to use my iPhone for this purpose.

Then I found some components made for this purpose and decided to order ICM-20948 and especially this one:

After some soldering I made it to a coding phase which I just started simply with ChatGPT simply asking “how to integrate ICM-20948 into esphome and use it to level caravan?”.

This gave me excellent starting point and after some trial & error and fine tuning, I now have a working version which I just need to install into my caravan.

Here it is still sitting on my desk and wired to my test/dev ESP32 board, but eventually I will install this to my RV to see some real results.

This ICM-20948 is not natively supported by ESPHome, but with little help from https://github.com/sparkfun/SparkFun_ICM-20948_ArduinoLibrary.git#v1.3.2 and some .cpp code it is now fully working and gives me readings which corner is high/low and how much in centimeters.