MassiPi / DaikinS21

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

A project to control Daikin split through S21 socket.

Daikin Model

I'm controlling three old FTXSxxG splits

Used hardware (under 10$):

  • esp8266mini
  • mini560 step down (5V output version)
  • mini breadboard
  • 4 dupont cables male-female

Used software

this is a platformio project.

Pinout

On my units the S21 port is:
1 - Seems unused
2 - TX (5V)
3 - RX (5V)
4 - VCC (14.5V)
5 - GND
Luckily, RX port accepts 3.3V levels so i did not need a level shifter.
I used D6 and D7 as serial port pins for the ESP8266.

Phisical setup

Well, this also fits inside the units, seems good!

Rationale

i did not want to use already available code since this is not fun enough, so i just wrote my code.

  • I kept a functional bootstrap-based web interface
  • i decided to keep the hardware serial functional for debugging, so i moved the control on a software serial
  • i included remotedebug library https://github.com/JoaoLopesF/RemoteDebug (please check the fixes!) to be able to debug the functioning also remotely
  • ota update available
  • all data exchange is json-ed: via websocket, via http call and via mqtt
  • commands are accepted (and data is published) in the web interface, via http call and via mqtt, same format is used.
  • since the starting point was the home assistant integration, this was achieved with https://www.home-assistant.io/integrations/climate.mqtt/ . For a couple of "limits" of the integration (power and swing management), the code implements a couple of custom calls.
  • wifi manager for wifi config

Home assistant integration

As said, the integration is done through MQTT, so i also added an example of code for integration and with templates. You'll probably need to redefine lists and for sure mqtt topics.

Fixes

Remotedebug library has some flows, please remember to:

  • modify the RemoteDebugCfg.h file, line 104, to disable websockets (or it's gonna conflict with the asyncwebserver websockets server)

#define WEBSOCKET_DISABLED true

  • comment out the part of the WebSocketsClient.cpp file between lines 700 and 710, since you are not using it but it gives exceptions with recent ESP8266 core.

/*#if (WEBSOCKETS_NETWORK_TYPE == NETWORK_ESP8266)
_client.tcp->setNoDelay(true);

if(_client.isSSL && _fingerprint.length()) {
if(!_client.ssl->verify(_fingerprint.c_str(), _host.c_str())) {
DEBUG_WEBSOCKETS("[WS-Client] certificate mismatch\n");
WebSockets::clientDisconnect(&_client, 1000);
return;
}
}
#endif */

Credits

i did not even know about the S21 socket, so i NEED to thank:
https://github.com/joshbenner/esphome-daikin-s21/tree/main
https://github.com/revk/ESP32-Faikin
As you'll see, i also took pieces of code, but i wasn't fully happy about it's structure, so i rewrote it as a states-machine to reduce blocking in code.

Disclaimer

i am NOT a programmer :) but i understand a lot of parts could be better written, and that some things could be done with higher security and bla bla bla.
I would not (and i don't) expose the controller on internet, this should clarify what i mean :)

Why publishing

someone asked, so why not?

Please

Since i'm not a programmer and i'm totally lost in git, please don't hesitate reporting any ANY issue in my code or anything wrong you see :)

About


Languages

Language:C++ 61.9%Language:HTML 23.6%Language:JavaScript 14.5%