mitsubishi2MQTT icon indicating copy to clipboard operation
mitsubishi2MQTT copied to clipboard

Add support for ESP32_S2_MINI, improve device support flexibility, improve debug logging and fix web control interface.

Open andrewleech opened this issue 1 year ago • 5 comments

This MR contains a whole bunch of changes in separate commits, let me know if you'd prefer them split out into separate MR's.

  • Allow specifying the UART number to use (ie different uart for debug and hvac connectsion).
  • Allow specifying the particular uart TX and RX pins for hvac
  • Enable debug logging if hvac uart doesn't conflict.
  • Send debug logging over mqtt as well (can be viewed in HA mqtt inspector)
  • Add support for ESP32-S2-MINI
  • Specify firmware binary name and display it on web upgrade page.
  • Fix a couple of issues with the web control page.

This all started when I wanted to upgrade an older unit I had running and it took me a while to remember what hardware I used. I thought it'd be handy to show the correct / expected build on the firmware upgrade page, eg. image

I then wanted to test my changes on a separate esp32 module rather than the one tucked up in my aircon, but the only one I had handy was a newer esp32-s2, so I added support for that.

The default Serial object on the S3 is the internal USB port, not a uart. So I added support for specifying the desired UART via: build_flags = -DHVAC_UART=0

Finally I was having some more issues so wanted serial logging; now that hvac can be configured to run on a separate uart, I decided to make debug logging automatically enabled if HVAC is on a different uart to the default Serial output.

andrewleech avatar Dec 13 '23 09:12 andrewleech

I've spent some time today fixing the web control interface, I had found on an older unit as well as this S2 based one that many commands from the web control page just didn't seem to stick, or ended up selecting the wrong thing.

settings updates in change_states() were failing as the String.c_str() values go out of scope too quickly. The scope of changes is now more tightly controlled.

The control web page now auto-refreshes when settings changes are received from the hvac unit, either from external changes, mqtt changes or just delayed responses to web changes.

This should also fix https://github.com/gysmo38/mitsubishi2MQTT/issues/182

andrewleech avatar Feb 09 '24 03:02 andrewleech

ps. For anyone who wants to build this project without needing to install / configure PlatformIO I've got it building and flashing my esp32 board in docker with this little bash script:

IMAGE=shaguarger/platformio:6.1.9

if [ -z "$(docker ps -f "name=mitsubishi2mqtt" -f "status=running" -q )" ]; then

docker run --rm -d --name mitsubishi2mqtt -ti --privileged --net=host -v /dev:/dev \
  -v `pwd`:/workspace -w /workspace \
  $IMAGE sleep infinity

fi

docker exec -ti mitsubishi2mqtt pio run -e ESP32-S2-MINI -t upload

andrewleech avatar Feb 09 '24 03:02 andrewleech

My S2 MINI build is bow installed in a HVAC unit and needed a couple of extra fixes, these are now included in this branch.

andrewleech avatar Feb 09 '24 03:02 andrewleech

... But looking at the CI here, it appears some of my debug logging changes don't work on 8266, I'll have to look into that.

andrewleech avatar Feb 09 '24 03:02 andrewleech

Ok all the compatibility issues have been resolved, this change set should now work well on all platforms. It's been tested and is in active use on two HVAC units, running the esp32 and esp32s2 builds. Web UI control works great now. I was previously also getting glitches with vane control from mqtt/ha on a previous release on esp32 which is also resolved with this build. The debug messages over mqtt also help quite a lot at times. The UART pins can also now be chosen for any platforms, but the default remains the same as official release / arduino default pins.

andrewleech avatar May 01 '24 04:05 andrewleech