Daikin Madoka BRC1H bluetooth custom component

Hello,

I am new to Home Assistant and HACS.

I would like to add this custom component but I don’t at all how to do it on HA/HACS.
Using this repo, I am able to connect to my Madoka device but I don’t know how to add the custom component to HA.

Any help will be much appreciated.

Thanks for sharing this. I’m unfortunately having a bit of trouble with it though - it doesn’t seem to be presenting the confirmation message on the madoka unit before failing authorisation

[22:14:36][I][esp32_ble_client:265]: [0] [94:0D:2D:69:DA:4A] auth complete. remote BD_ADDR: 940d2d69da4a
[22:14:36][E][esp32_ble_client:268]: [0] [94:0D:2D:69:DA:4A] auth fail reason = 0x52
[22:14:36][E][madoka:080]: Authentication failed, status: 0x52

Any ideas?

1 Like

Yes, it is.
Hope I get some spare time to prepare a pull request to the official esphome project.
In the meantime, the updated config snippet is the following:

...

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

esp32_ble_tracker:

esp32_ble:
  io_capability: display_yes_no

ble_client:
  - mac_address: <mac_address>
    id: madoka_climate

climate:
  - platform: madoka
    name: "Madoka Climate"
    ble_client_id: madoka_climate
    update_interval: 15s

...
2 Likes

I think my last post fixes your issue.
You need to tell esphome to behave as an input-output bluetooth device (like your smartphone).

esp32_ble:
  io_capability: display_yes_no

It really does seem like there is something different with the US ones. Same trouble here. Madoka Assistant seems designed for BRC1H5# and 6# controllers (I remember seeing something like that, can’t find it now). So maybe 7# series is different.

The device originally shows up in bluetoothctl as a BRC1H71, but then seems like it can be paired again (second time) as a UE878 RF Module.

My device info:
SW1 21001801
Ver 01.01.00
SW2 70310517
30:F9:4B:DE:94:BE

Hello,

I just add your code adding my Mac_address, but I receive this message:

[16:23:14][D][madoka:147]: Got update request...
[16:23:14][D][madoka:149]: ...but device is disconnected

The Madoka isn’t linked with any device. I can found it in the iOS APP, without linking finally.

Thanks.

Sounds strange. Are you sure it isn’t paired with any device? Try to unpair it also from the physical unit.

I have done, but isn’t paired. It’s ready to pair with mobile. BTW, should I remove the madoka custom component? I have it disabled, so, it shouldn’t be the reason of not working.

Thanks

Hey there. Awesome news re: ESPhome. I just tried to set this up using an M5Stack, but no luck. Few things based on the conversations here:

ble_tracker can’t be used with ble_client, so the yes_no option can’t be configured. But regardless of that! I’ve got a compile error:

In file included from src/esphome/components/madoka/madoka.cpp:1:0:
src/esphome/components/madoka/madoka.h:77:8: error: 'void esphome::madoka::Madoka::gap_event_handler(esp_gap_ble_cb_event_t, esp_ble_gap_cb_param_t*)' marked 'override', but does not override
   void gap_event_handler(esp_gap_ble_cb_event_t event, esp_ble_gap_cb_param_t *param) override;
        ^
src/esphome/components/madoka/madoka.cpp: In member function 'void esphome::madoka::Madoka::gap_event_handler(esp_gap_ble_cb_event_t, esp_ble_gap_cb_param_t*)':
src/esphome/components/madoka/madoka.cpp:92:70: error: 'class esphome::ble_client::BLEClient' has no member named 'get_gattc_if'
       auto status = esp_ble_gattc_register_for_notify(this->parent_->get_gattc_if(), this->parent_->get_remote_bda(),
                                                                      ^
src/esphome/components/madoka/madoka.cpp:92:101: error: 'class esphome::ble_client::BLEClient' has no member named 'get_remote_bda'
       auto status = esp_ble_gattc_register_for_notify(this->parent_->get_gattc_if(), this->parent_->get_remote_bda(),
                                                                                                     ^
src/esphome/components/madoka/madoka.cpp: In member function 'virtual void esphome::madoka::Madoka::gattc_event_handler(esp_gattc_cb_event_t, esp_gatt_if_t, esp_ble_gattc_cb_param_t*)':
src/esphome/components/madoka/madoka.cpp:123:45: error: 'class esphome::ble_client::BLEClient' has no member named 'get_remote_bda'
       esp_ble_set_encryption(this->parent_->get_remote_bda(), ESP_BLE_SEC_ENCRYPT_MITM);
                                             ^
src/esphome/components/madoka/madoka.cpp: In member function 'void esphome::madoka::Madoka::query(uint16_t, esphome::madoka::message, int)':
src/esphome/components/madoka/madoka.cpp:222:13: error: 'delay' was not declared in this scope
     delay(10);
             ^
src/esphome/components/madoka/madoka.cpp:233:53: error: 'class esphome::ble_client::BLEClient' has no member named 'get_gattc_if'
             esp_ble_gattc_write_char(this->parent_->get_gattc_if(), this->parent_->get_conn_id(), this->wwr_handle_,
                                                     ^
src/esphome/components/madoka/madoka.cpp:233:84: error: 'class esphome::ble_client::BLEClient' has no member named 'get_conn_id'
             esp_ble_gattc_write_char(this->parent_->get_gattc_if(), this->parent_->get_conn_id(), this->wwr_handle_,
                                                                                    ^
src/esphome/components/madoka/madoka.cpp:247:12: error: 'delay' was not declared in this scope
   delay(t_d);
            ^
*** [.pioenvs/madoka-1f-master/src/esphome/components/madoka/madoka.cpp.o] Error 1
========================== [FAILED] Took 4.34 seconds ==========================

i’ve tried to use this custom component, but I’m unable to configure it.
I’ve a lot of issues with bluetooth on my system, no luck with ESPHome.

I’ll wait for a more stable and standard implementation in the future.

Thank you all for your work.

Are you saying you were able to make yours work? Any pointers?

no, in any way.

so that I will wait for a future implementation that works o that I’m able to make it works in my installation.

in my last tentative I was able to pair bluetooth on termina, but when I try to configure madoka entity, after pressing “submit” i got this error on HA:

This error originated from a custom integration.

Logger: pymadoka.connection
Source: custom_components/daikin_madoka/init.py:72
Integration: Daikin Madoka
First occurred: 10:40:47 PM (57 occurrences)
Last logged: 10:45:47 PM

No backend with an available connection slot that can reach address B8:F2:55:00:92:42 was found
[org.bluez.Error.Failed] br-connection-canceled
[org.bluez.Error.Failed] Operation already in progress

Update:

I was finally able to configure the ESPHome component made by Petapton.
My first try faiiled because of my limited experience with ESPHome.
Now I’m using a D1 Mini NodeMcu con Modulo WiFi ESP8266-12F, that controls two Daikin Madoka devices.

ESPhome is a great platform.

great job, thank you to everybody.

hi, is there any way I can help?

Great to hear!

What is the model number of your Madoka?

I suppose: BRC1H519W7

Thanks, I can confirm I just got it connected to mine now as well… but

My Madoka is actually connected to a VAM (ERV), but seems to connect ok but I cannot control anything…essentially all I should have is:

  • On/Off
  • Fan High/Low
  • Room temp
  • External Temp
  • CO2

Hey Manu, there’s a PR that someone’s posted with a bunch of fixes. It’d be great if that could be merged :slight_smile:.

I’m not sure if anyone’s got the “power on/off” working. Mine doesn’t seem to work at all. :frowning: - i’ve tried with the latest fixes/patch in the issues on Github and without.

Hi Petapton,

The esp madoka works really well. One question. Can you setup and control more than one madoka with one esp32? if yes how the configuration looks like?

I’m able to control 2 daikin Madoka by defining two ble_client in the esphome configuration:

ble_client:
  - mac_address: XX:XX:XX:XX:XX:XX
    id: madoka_climate_giorno

  - mac_address: XX:XX:XX:XX:XX:XX
    id: madoka_climate_notte

climate:
  - platform: madoka
    name: "Condizionatore zona giorno"
    ble_client_id: madoka_climate_giorno
    update_interval: 15s

  - platform: madoka
    name: "Condizionatore zona notte"
    ble_client_id: madoka_climate_notte
    update_interval: 15s