Daikin Madoka BRC1H bluetooth custom component

This could be due either by some packet loss on the BLE link or rapid subsequent message exchange.

Could you please enable the debug log level in ESPHome and send me logs?

On the device, in the bluetooth pairing settings, you can unlink the currently paired device. This should leave place for a new connection.

Installing the lates version of ESPhomes I received the bellow message

INFO ESPHome 2025.10.0
INFO Reading configuration /config/esphome/malososensors2.yaml…
ERROR Unable to import component esp32_ble_tracker:
Traceback (most recent call last):
File “/esphome/esphome/loader.py”, line 199, in _lookup_module
module = importlib.import_module(f"esphome.components.{domain}")
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File “/usr/local/lib/python3.12/importlib/init.py”, line 90, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File “”, line 1387, in _gcd_import
File “”, line 1360, in _find_and_load
File “”, line 1331, in _find_and_load_unlocked
File “”, line 935, in _load_unlocked
File “”, line 999, in exec_module
File “”, line 488, in _call_with_frames_removed
File “/esphome/esphome/components/esp32_ble_tracker/init.py”, line 9, in
from esphome.components.esp32_ble import (
ImportError: cannot import name ‘IDF_MAX_CONNECTIONS’ from ‘esphome.components.esp32_ble’ (/data/external_components/391ddc4b/esphome/components/esp32_ble/init.py)
Failed config

esp32_ble_tracker: [source /config/esphome/malososensors2.yaml:40]

Component not found: esp32_ble_tracker.
scan_parameters:
interval: 5s
window: 5s
active: True

What I need to do?

Hi, the same issue there.
@Petapton do you have any idea about that?
Could be possible to fix?

thank you.
Ignazio

Same issue here.

I managed to flash the firmware by rolling back ESPHome to v2025.9.2

Regards.

It seems the PR for esp32_ble was accepted into the main repository, so it doesn’t need to be additionally loaded anymore.

That means it now just became

external_components:
  - source: github://Petapton/esphome@madoka
    components: [ madoka ]

(so without esp32_ble )

3 Likes

Thanks a lot.
It worked :slight_smile:
Ignazio

If you see that using BLE complicate and not very stable, you can check solution here: Daikin P1P2 comms and adding Wifi + Voice control to a 20year old ducted Air Conditioner - #22 by dzungpv with more than 30 sensors, error code and more, which the BLE integration does not have it

The component has been renamed, use this now:

external_components:
  - source: github://Petapton/esphome@madoka
    components: [ daikin_madoka ]

Make sure to rename the platform of the climate as well:

climate:
  - platform: daikin_madoka

For all those trying to make this work locally without ESP Proxy, it’s a mess, but I’ve finally got it to work on 2025.11.2, need to either do fork, or something to make it more stable and user friendly but in a nutshell here are the steps:

  1. remove the custom component
  2. using ssh in a temp folder:
git clone https://github.com/mduran80/daikin_madoka.git
cd daikin_madoka
git branch -D pr60  # ignore error if it says 'not found'
git fetch origin pull/60/head:pr60
git checkout main
git merge pr60
git checkout pr60 -- custom_components/daikin_madoka/__init__.py custom_components/daikin_madoka/climate.py
git add custom_components/daikin_madoka/__init__.py custom_components/daikin_madoka/climate.py
git commit

Once we have the commit build locally we use this particular local commit as custom component:

mv custom_components/daikin_madoka /config/custom_components/daikin_madoka/
cd /config/custom_components/daikin_madoka/
nano manifest.json

remove requirements (otherwise it will get overridden every time ha restarts):

{
  "domain": "daikin_madoka",
  "name": "Daikin Madoka",
  "config_flow": true,
  "documentation": "https://github.com/atanarro/daikin_madoka",
  "issue_tracker": "https://github.com/atanarro/daikin_madoka/issues",
  "requirements": [],
  "codeowners": ["@atanarro"],
  "iot_class": "local_polling",
  "version": "1.0.4",
  "integration_type": "device"
}

now we manually install and pact pymadoka:

docker exec -it homeassistant /bin/bash
pip install pymadoka
pymadoka --version

This is when you are most likely to get and error, something like:
ImportError: cannot import name ‘discover’ from ‘bleak’ (/usr/local/lib/python3.13/site-packages/bleak/init.py)

If we do we need to patch this

cd /usr/local/lib/python3.13/site-packages/pymadoka
sed -i 's/discover(/BleakScanner.discover(/g' connection.py
sed -i 's/from bleak import BleakClient,BleakScanner,discover/from bleak import BleakClient, BleakScanner/' connection.py
pymadoka --version
#If the version is displayed correctly we are done
exit
ha core restart

Once the ha core is restarted proceed to add custom integration, you should not get the error any more.

Hey after a lot of trouble i finaly came accross your post.

So firstly thanks for the patch and fyi i followed the steps but updated the manifest to :

{
  "domain": "daikin_madoka",
  "name": "Daikin Madoka",
  "config_flow": true,
  "documentation": "https://github.com/atanarro/daikin_madoka",
  "issue_tracker": "https://github.com/atanarro/daikin_madoka/issues",
  "requirements": [
    "git+https://github.com/maraujop/pymadoka.git@patch-1"
  ],
  "codeowners": ["@atanarro"],
  "iot_class": "local_polling",
  "version": "1.0.4",
  "integration_type": "device"
}

and skipping the rest of the process seemed to be sufficient in my case.

1 Like

Hi!
I’m having the same problems when I try to update. I have it installed directly via Bluetooth on my miniPC. Do I just need to modify the manifest?
I don’t really understand the process or what the problem is.
Could you explain it? Thank you so much in advance!

I followed all the instructions above but I still get the error “Config flow could not be loaded: {“message”:“Invalid handler specified”}”… Do you have any updates? Thanks in advance!

Hi all,
with the 2025.12.0 update it won’t compile anymore.
It seems there is a breaking change for:

[esp32_ble_client] Replace std::string with char[18] for BLE address storage [esphome#12070](https://github.com/esphome/esphome/pull/12070) by [@bdraco](https://github.com/bdraco) (breaking-change)

Here my log:

INFO ESPHome 2025.12.0
INFO Reading configuration madoka-bridge-notte.yaml...
INFO Generating C++ source...
INFO Compiling app... Build path: /home/ignazio/ESPHome/.esphome/build/madoka-bridge-notte
Processing madoka-bridge-notte (board: nodemcu-32s; framework: espidf; platform: https://github.com/pioarduino/platform-espressif32/releases/download/55.03.31-2/platform-espressif32.zip)
----------------------------------------------------------------------------------------------------------------------------
HARDWARE: ESP32 240MHz, 320KB RAM, 4MB Flash
 - contrib-piohome @ 3.4.4 
 - framework-espidf @ 3.50501.0 (5.5.1) 
 - tool-cmake @ 4.0.3 
 - tool-esp-rom-elfs @ 2024.10.11 
 - tool-esptoolpy @ 5.1.0 
 - tool-mklittlefs @ 3.2.0 
 - tool-ninja @ 1.13.1 
 - tool-scons @ 4.40801.0 (4.8.1) 
 - toolchain-xtensa-esp-elf @ 14.2.0+20241119
Reading CMake configuration...
Dependency Graph
|-- noise-c @ 0.1.10
Compiling .pioenvs/madoka-bridge-notte/src/esphome/components/daikin_madoka/daikin_madoka.cpp.o
Compiling .pioenvs/madoka-bridge-notte/src/esphome/components/esp32_ble_tracker/esp32_ble_tracker.cpp.o
Compiling .pioenvs/madoka-bridge-notte/src/esphome/components/esphome/ota/ota_esphome.cpp.o
Compiling .pioenvs/madoka-bridge-notte/src/esphome/components/internal_temperature/internal_temperature.cpp.o
Compiling .pioenvs/madoka-bridge-notte/src/esphome/components/logger/logger.cpp.o
Compiling .pioenvs/madoka-bridge-notte/src/esphome/components/logger/logger_esp32.cpp.o
Compiling .pioenvs/madoka-bridge-notte/src/esphome/components/logger/task_log_buffer.cpp.o
Compiling .pioenvs/madoka-bridge-notte/src/esphome/components/md5/md5.cpp.o
In file included from src/esphome/core/component.h:9,
                 from src/esphome/components/daikin_madoka/daikin_madoka.h:7,
                 from src/esphome/components/daikin_madoka/daikin_madoka.cpp:1:
src/esphome/components/daikin_madoka/daikin_madoka.cpp: In member function 'void esphome::daikin_madoka::DaikinMadoka::query_(uint16_t, std::vector<unsigned char>, int)':
src/esphome/components/daikin_madoka/daikin_madoka.cpp:291:112: error: request for member 'c_str' in '((esphome::daikin_madoka::DaikinMadoka*)this)->esphome::daikin_madoka::DaikinMadoka::esphome::ble_client::BLEClientNode.esphome::ble_client::BLEClientNode::parent_->esphome::ble_client::BLEClient::esphome::esp32_ble_client::BLEClientBase.esphome::esp32_ble_client::BLEClientBase::address_str()', which is of non-class type 'const char*'
  291 |       ESP_LOGD(TAG, "[%s] esp_ble_gattc_write_char failed (%d of %d), status=%d", this->parent_->address_str().c_str(),
      |                                                                                                                ^~~~~
src/esphome/core/log.h:99:100: note: in definition of macro 'esph_log_d'
   99 |   ::esphome::esp_log_printf_(ESPHOME_LOG_LEVEL_DEBUG, tag, __LINE__, ESPHOME_LOG_FORMAT(format), ##__VA_ARGS__)
      |                                                                                                    ^~~~~~~~~~~
src/esphome/components/daikin_madoka/daikin_madoka.cpp:291:7: note: in expansion of macro 'ESP_LOGD'
  291 |       ESP_LOGD(TAG, "[%s] esp_ble_gattc_write_char failed (%d of %d), status=%d", this->parent_->address_str().c_str(),
      |       ^~~~~~~~
src/esphome/components/daikin_madoka/daikin_madoka.cpp:295:100: error: request for member 'c_str' in '((esphome::daikin_madoka::DaikinMadoka*)this)->esphome::daikin_madoka::DaikinMadoka::esphome::ble_client::BLEClientNode.esphome::ble_client::BLEClientNode::parent_->esphome::ble_client::BLEClient::esphome::esp32_ble_client::BLEClientBase.esphome::esp32_ble_client::BLEClientBase::address_str()', which is of non-class type 'const char*'
  295 |       ESP_LOGE(TAG, "[%s] Command could not be sent, last status=%d", this->parent_->address_str().c_str(), status);
      |                                                                                                    ^~~~~
src/esphome/core/log.h:130:100: note: in definition of macro 'esph_log_e'
  130 |   ::esphome::esp_log_printf_(ESPHOME_LOG_LEVEL_ERROR, tag, __LINE__, ESPHOME_LOG_FORMAT(format), ##__VA_ARGS__)
      |                                                                                                    ^~~~~~~~~~~
src/esphome/components/daikin_madoka/daikin_madoka.cpp:295:7: note: in expansion of macro 'ESP_LOGE'
  295 |       ESP_LOGE(TAG, "[%s] Command could not be sent, last status=%d", this->parent_->address_str().c_str(), status);
      |       ^~~~~~~~
Compiling .pioenvs/madoka-bridge-notte/src/esphome/components/mdns/mdns_component.cpp.o
Compiling .pioenvs/madoka-bridge-notte/src/esphome/components/mdns/mdns_esp32.cpp.o
Compiling .pioenvs/madoka-bridge-notte/src/esphome/components/network/util.cpp.o
*** [.pioenvs/madoka-bridge-notte/src/esphome/components/daikin_madoka/daikin_madoka.cpp.o] Error 1
================================================ [FAILED] Took 7.17 seconds ================================================

@Petapton could please have a look and post here so that we get notified about resolution, if any?
Thanks a lot!

Ignazio

Already created a PR for him…

Until merged, you might want to change the yaml into this:

#Import custom Daikin code (until PR has been merged)
external_components:
  - source: github://aceindy/esphome@aceindy-patch-1
    components: [ daikin_madoka ]
1 Like

Hi, thanks a lot for your suggestion, I will do.
Then how we will be notified about the PR?

Regards.
Ignazio

You register at github and subscribe to the madoka repository

1 Like

I think it is fixed in the main repos :wink:

Hi, it works perfectly :slight_smile:
Thanks a lot!

Ignazio