Hi @Petapton , @blafois , just to give an update. I tried today blafois component instead of Petapton’s and interestingly enough, it started working. Maybe this Cooling only AC’s have a different response and I understand Blafois one was also similar to mine (cool only).
Of course Blafois one is missing the 5 fan modes (only shows 3) and auto fan, but rest seems to work. Also for fan, when I changed mode to Fan or even Cool, fan started in Auto mode which is fine.
But in longer run, I would greatly appreciate if we could hunt down what the code differences could be so that other people with Cool only systems could also benefit…
Here’s what I put in the yaml file and this was the only change I made:
Hi @fastguy ,
thanks for your informations.
I have a fresh esp32 mcu, this is blank and what i have to flash on it, so that i find this in home assistant to flash it with the right configuration?
Install eshome on your system. Find out how to do it in your linux, for example in Arch linux, it’s available in the AUR repository so I could use yay to install it (yay -S esphome)
Then, create a folder in your home directory, create a yaml file like lendrod.yaml and then put the configuration inside. You can check my previous post as an example. In this configuration file, there’s a section where you define your board type (mine is esp32dev, probably yours too), your Wifi, include Petapton’s module snippet, and your thermostat configs like in the example.
then you do
esphome run ./lendrod.yaml and it will compile and flash it into your esp32. Make sure you have the esp32 connected to your computer with a usb cable and your user has access to its serial port (check your distro help for it if it’s not the case).
Then in a minute it will boot and in same command window show you the logs, it will attempt to connect to your Thermostat you defined in the yaml file, you need to go to the thermostat and accept the pairing request.
Then you add esphome integration to your home-assistant, give hte address of the esp32 (the name you’ve given in the config file dot local, ie myesp32.local for example), it will detect and add your thermostat to Home Assistant.
Thank you for your feedback. Gonna check it out when I have time. Actually adding support for different sets of functionalities was (kinda) on the roadmap.
Has anyone been able to make this work in the US? I have tried a couple times before with no success so just checking here before I try again. According to their site and the play store, the Madoka Assistant is not an option in the US. Does this mean my Madoka cannot be controlled via Bluetooth?
My logs from esphome device below. It does seem that the US devices may not be controllable via Bluetooth. Maybe bluetooth is only for installer configuration?
[17:44:35][D][esp32_ble_tracker:266]: Starting scan...
[17:44:36][D][esp32_ble_client:110]: [0] [68:88:A1:39:A0:F5] Found device
[17:44:36][D][esp32_ble_tracker:661]: Found device 68:88:A1:39:A0:F5 RSSI=-69
[17:44:36][D][esp32_ble_tracker:682]: Address Type: PUBLIC
[17:44:36][D][esp32_ble_tracker:684]: Name: 'BRC1H71 39:A0:F5'
[17:44:36][D][esp32_ble_tracker:215]: Pausing scan to make connection...
[17:44:36][I][esp32_ble_client:067]: [0] [68:88:A1:39:A0:F5] 0x00 Attempting BLE connection
[17:44:36][D][esp32_ble_client:110]: [0] [68:88:A1:39:A0:F5] ESP_GATTC_CONNECT_EVT
[17:44:36][D][esp32_ble_client:110]: [0] [68:88:A1:39:A0:F5] ESP_GATTC_OPEN_EVT
[17:44:36][D][esp32_ble_tracker:266]: Starting scan...
[17:44:38][D][esp32_ble_client:306]: [0] [68:88:A1:39:A0:F5] Event 46
[17:44:38][D][esp32_ble_client:110]: [0] [68:88:A1:39:A0:F5] ESP_GATTC_SEARCH_CMPL_EVT
[17:44:38][I][esp32_ble_client:227]: [0] [68:88:A1:39:A0:F5] Connected
[17:44:38][D][esp32_ble_client:188]: [0] [68:88:A1:39:A0:F5] cfg_mtu status 0, mtu 23
[17:44:38][I][esp32_ble_client:333]: [0] [68:88:A1:39:A0:F5] auth complete. remote BD_ADDR: 6888a139a0f5
[17:44:38][D][esp32_ble_client:341]: [0] [68:88:A1:39:A0:F5] auth success. address type = 0 auth mode = 13
[17:44:38][D][esp32_ble_client:110]: [0] [68:88:A1:39:A0:F5] ESP_GATTC_REG_FOR_NOTIFY_EVT
[17:44:38][D][esp32_ble_client:296]: Wrote notify descriptor 1, properties=16
[17:44:38][D][ble_client:058]: All clients established, services released
[17:44:38][D][esp32_ble_client:110]: [0] [68:88:A1:39:A0:F5] ESP_GATTC_WRITE_DESCR_EVT
[17:44:43][D][madoka:189]: Got update request...
[17:44:43][W][component:232]: Component madoka.climate took a long time for an operation (260 ms).
[17:44:43][W][component:233]: Components should block for at most 30 ms.
[17:44:43][D][esp32_ble_client:110]: [0] [68:88:A1:39:A0:F5] ESP_GATTC_WRITE_CHAR_EVT
[17:44:43][D][esp32_ble_client:110]: [0] [68:88:A1:39:A0:F5] ESP_GATTC_WRITE_CHAR_EVT
[17:44:43][D][esp32_ble_client:110]: [0] [68:88:A1:39:A0:F5] ESP_GATTC_WRITE_CHAR_EVT
[17:44:43][D][esp32_ble_client:110]: [0] [68:88:A1:39:A0:F5] ESP_GATTC_WRITE_CHAR_EVT
[17:44:43][D][esp32_ble_client:110]: [0] [68:88:A1:39:A0:F5] ESP_GATTC_WRITE_CHAR_EVT
[17:44:58][D][madoka:189]: Got update request...
[17:44:58][W][component:232]: Component madoka.climate took a long time for an operation (259 ms).
[17:44:58][W][component:233]: Components should block for at most 30 ms.
[17:44:58][D][esp32_ble_client:110]: [0] [68:88:A1:39:A0:F5] ESP_GATTC_WRITE_CHAR_EVT
[17:44:58][D][esp32_ble_client:110]: [0] [68:88:A1:39:A0:F5] ESP_GATTC_WRITE_CHAR_EVT
[17:44:58][D][esp32_ble_client:110]: [0] [68:88:A1:39:A0:F5] ESP_GATTC_WRITE_CHAR_EVT
[17:44:58][D][esp32_ble_client:110]: [0] [68:88:A1:39:A0:F5] ESP_GATTC_WRITE_CHAR_EVT
[17:44:58][D][esp32_ble_client:110]: [0] [68:88:A1:39:A0:F5] ESP_GATTC_WRITE_CHAR_EVT
[17:45:13][D][madoka:189]: Got update request...
[17:45:13][W][component:232]: Component madoka.climate took a long time for an operation (261 ms).
[17:45:13][W][component:233]: Components should block for at most 30 ms.
[17:45:13][D][esp32_ble_client:110]: [0] [68:88:A1:39:A0:F5] ESP_GATTC_WRITE_CHAR_EVT
[17:45:13][D][esp32_ble_client:110]: [0] [68:88:A1:39:A0:F5] ESP_GATTC_WRITE_CHAR_EVT
[17:45:13][D][esp32_ble_client:110]: [0] [68:88:A1:39:A0:F5] ESP_GATTC_WRITE_CHAR_EVT
[17:45:13][D][esp32_ble_client:110]: [0] [68:88:A1:39:A0:F5] ESP_GATTC_WRITE_CHAR_EVT
[17:45:13][D][esp32_ble_client:110]: [0] [68:88:A1:39:A0:F5] ESP_GATTC_WRITE_CHAR_EVT
[17:45:28][D][madoka:189]: Got update request...
[17:45:28][W][component:232]: Component madoka.climate took a long time for an operation (259 ms).
[17:45:28][W][component:233]: Components should block for at most 30 ms.
[17:45:28][D][esp32_ble_client:110]: [0] [68:88:A1:39:A0:F5] ESP_GATTC_WRITE_CHAR_EVT
[17:45:28][D][esp32_ble_client:110]: [0] [68:88:A1:39:A0:F5] ESP_GATTC_WRITE_CHAR_EVT
[17:45:28][D][esp32_ble_client:110]: [0] [68:88:A1:39:A0:F5] ESP_GATTC_WRITE_CHAR_EVT
[17:45:28][D][esp32_ble_client:110]: [0] [68:88:A1:39:A0:F5] ESP_GATTC_WRITE_CHAR_EVT
[17:45:28][D][esp32_ble_client:110]: [0] [68:88:A1:39:A0:F5] ESP_GATTC_WRITE_CHAR_EVT
[17:45:43][D][madoka:189]: Got update request...
[17:45:43][W][component:232]: Component madoka.climate took a long time for an operation (260 ms).
[17:45:43][W][component:233]: Components should block for at most 30 ms.
[17:45:43][D][esp32_ble_client:110]: [0] [68:88:A1:39:A0:F5] ESP_GATTC_WRITE_CHAR_EVT
[17:45:43][D][esp32_ble_client:110]: [0] [68:88:A1:39:A0:F5] ESP_GATTC_WRITE_CHAR_EVT
[17:45:43][D][esp32_ble_client:110]: [0] [68:88:A1:39:A0:F5] ESP_GATTC_WRITE_CHAR_EVT
[17:45:43][D][esp32_ble_client:110]: [0] [68:88:A1:39:A0:F5] ESP_GATTC_WRITE_CHAR_EVT
[17:45:43][D][esp32_ble_client:110]: [0] [68:88:A1:39:A0:F5] ESP_GATTC_WRITE_CHAR_EVT
[17:45:58][D][madoka:189]: Got update request...
[17:45:58][W][component:232]: Component madoka.climate took a long time for an operation (258 ms).
[17:45:58][W][component:233]: Components should block for at most 30 ms.
[17:45:58][D][esp32_ble_client:110]: [0] [68:88:A1:39:A0:F5] ESP_GATTC_WRITE_CHAR_EVT
[17:45:58][D][esp32_ble_client:110]: [0] [68:88:A1:39:A0:F5] ESP_GATTC_WRITE_CHAR_EVT
[17:45:58][D][esp32_ble_client:110]: [0] [68:88:A1:39:A0:F5] ESP_GATTC_WRITE_CHAR_EVT
[17:45:58][D][esp32_ble_client:110]: [0] [68:88:A1:39:A0:F5] ESP_GATTC_WRITE_CHAR_EVT
[17:45:58][D][esp32_ble_client:110]: [0] [68:88:A1:39:A0:F5] ESP_GATTC_WRITE_CHAR_EVT
[17:46:13][D][madoka:189]: Got update request...
[17:46:13][W][component:232]: Component madoka.climate took a long time for an operation (261 ms).
[17:46:13][W][component:233]: Components should block for at most 30 ms.
[17:46:13][D][esp32_ble_client:110]: [0] [68:88:A1:39:A0:F5] ESP_GATTC_WRITE_CHAR_EVT
[17:46:13][D][esp32_ble_client:110]: [0] [68:88:A1:39:A0:F5] ESP_GATTC_WRITE_CHAR_EVT
[17:46:13][D][esp32_ble_client:110]: [0] [68:88:A1:39:A0:F5] ESP_GATTC_WRITE_CHAR_EVT
[17:46:13][D][esp32_ble_client:110]: [0] [68:88:A1:39:A0:F5] ESP_GATTC_WRITE_CHAR_EVT
[17:46:13][D][esp32_ble_client:110]: [0] [68:88:A1:39:A0:F5] ESP_GATTC_WRITE_CHAR_EVT
[17:46:28][D][madoka:189]: Got update request...
[17:46:28][W][component:232]: Component madoka.climate took a long time for an operation (259 ms).
[17:46:28][W][component:233]: Components should block for at most 30 ms.
[17:46:28][D][esp32_ble_client:110]: [0] [68:88:A1:39:A0:F5] ESP_GATTC_WRITE_CHAR_EVT
[17:46:28][D][esp32_ble_client:110]: [0] [68:88:A1:39:A0:F5] ESP_GATTC_WRITE_CHAR_EVT
[17:46:28][D][esp32_ble_client:110]: [0] [68:88:A1:39:A0:F5] ESP_GATTC_WRITE_CHAR_EVT
[17:46:28][D][esp32_ble_client:110]: [0] [68:88:A1:39:A0:F5] ESP_GATTC_WRITE_CHAR_EVT
[17:46:28][D][esp32_ble_client:110]: [0] [68:88:A1:39:A0:F5] ESP_GATTC_WRITE_CHAR_EVT
[17:46:43][D][madoka:189]: Got update request...
[17:46:43][W][component:232]: Component madoka.climate took a long time for an operation (261 ms).
[17:46:43][W][component:233]: Components should block for at most 30 ms.
[17:46:43][D][esp32_ble_client:110]: [0] [68:88:A1:39:A0:F5] ESP_GATTC_WRITE_CHAR_EVT
[17:46:43][D][esp32_ble_client:110]: [0] [68:88:A1:39:A0:F5] ESP_GATTC_WRITE_CHAR_EVT
[17:46:43][D][esp32_ble_client:110]: [0] [68:88:A1:39:A0:F5] ESP_GATTC_WRITE_CHAR_EVT
[17:46:43][D][esp32_ble_client:110]: [0] [68:88:A1:39:A0:F5] ESP_GATTC_WRITE_CHAR_EVT
[17:46:43][D][esp32_ble_client:110]: [0] [68:88:A1:39:A0:F5] ESP_GATTC_WRITE_CHAR_EVT
Thank you @blafois for paving the way with the reverse engineering!!
Thank you @Petapton for this awesome work!!
For years I have been using the mduran80 HA implementation but it was almost never stable and needed constant reboots (Pi3b internal BT). I had hoped for a standalone esp solution to avoid this and for that I am grateful @Petapton !!!
Like Blafois I use the BRC1H Madoka units and would love to see you give us the yaml option to not have the dual set point as he describes. It would be ultimate if we could select only the features our units have so that there are no fake options . ie i only have two fan modes and no dry mode.
(If want to increase temperature without using the fork I need to first increase the setpoint and then the temperature to match. Decreasing is simpler because the setpoint follows the decrease. This also caused issues with temperature control via esphome webserver component).
@blafois - I am using you fork for now and it is working great but the webserver does not show fan control, is that something you can add? (our units only have high and low).
Lastly to help others, when I first tried this out the Madoka bt menu froze and displayed - - - - instead of mac address. To resolve I turned off the esp and after some minutes control came back allowing bt on/off/unpairing. I found this was because the firmware needed updating via the app (which now includes better bt support). Those who were worried like me not to upgrade firmware need not be, the bt commands haven’t changed or been locked.
Also, not using yes/no authentication did not seem to work for new controllers using @blafois fork, so I went back to @Petapton version to hope it saves on cache, and then went back to the fork. Initially the new devices showed nan so I figured it didn’t work but then when I tried turning them on via wifi they came to life. So it could then be that they would have worked without the back and forth to cache but I cannot revert now to be sure). Lastly, using the non fork, if you have multiple devices and cannot see the yes no on one its because its in sequence and another device needs authenticating first)
THANK YOU AGAIN TO @blafois and @Petapton !!! - I now have reliable voice control back
Has anyone tried using more than 3 BLE connections with esp-idf? What was your result? I want to have 4. It it blocked by default as part of the setup pre check. How can i bypass this to test 4 units?
I read that some people in other types of sensors are using many more bt connections without issue (without compiling nimble bt or other).
I’m using madoka and BLE proxy on two ESP32 boards. Based on my experience, it can actually manage up to 3 devices. If a new device happens to be available, it is not seen in HA.
Note I have not tried (or do not remember) establishing connection to a fourth device, other than with BLE proxy.
Have you already tried just configuring four units on the same ESP? (I guess yes)
What happened?
Those people could be speaking of passive connections, of which you can have a virtually unlimited number on the same ESP, since they do not require to establish any connection, but only to passively listen for BLE advertisements.
Thanks for the reply. Yes, the examples where there were more than 3 BLE connections were generally for sensors, but there are some projects where people have amended the framework to remove the 3 unit limitation and it works for them (especially when going the extra step and using Nimble BT which uses less resources). The apparent reason 3 was the esp-idf limit was because of memory and in part i think hardware sharing with wifi. Whilst the limitation is in place when I try to connect 4 units the compile fails while passing the yaml with an error saying the number of connections cannot be more than 3.
First of all, thank you for the integration! I can finally control my AC through home assistant and I could not be happier!
I must say, that information regarding this is a bit all over the place, so adding this to HACS would improve the process a lot.
I am using “Home Assistant Operating System” on a Raspberry Pi 5 and encountered a few issues, which I am not sure what was causing them, but still managed to complete the config.
When entering bluetoothctl I couldn’t turn off scanning (I think). Every time that I tried to turn it off it would give me a Failed to stop discovery: org.bluez.Error.Failed. But I still continued with finding the MAC address and other commands were working, so I was able to pair at the end.
When configuring the integration it gave me a Unknown error the first time, but then I tried to configure it again and it worked immediately.
Anyhow, it is now working, but if anyone faces the issues above, just keep going!
I finally managed to get this working(!) - turned out that using an older version of ESPhome, and some stuck caches were casuing me a world of problems.
Anyway… I’m having a couple of issues:
repeatedly i’m getting the “accept this code” thing on my Madokas, even though that’s been done already. Logs are suggesting the authentication is incorrect, triggering a retry. It sounds like this might not be required though?
could be related to one… Almost all of my ESP32s go into a stage where they just say: [15:14:23][D][madoka:189]: Got update request…
[15:14:23][D][madoka:191]: …but device is disconnected
3 works fine for me. only one esp restart needed in over a week. (using the fork)
if needed you could add some yaml to periodically restart the esp at night or every x hours.
an issue is that when a madoka is in off mode for a long time like 12 hours, then the states read as ‘nan’ , i.e current temp, mode etc. It will then resolve once the unit is activated again (i dont mean via the physical madoka unit but via the esp). I wonder why is doesn’t continue polling or retain the last know values considering it remains connected enough to send and receive a command for control. any ideas how to fix this for better reliability?