Daikin Madoka BRC1H bluetooth custom component

I got it once again to connect by going through the configuration screen, unchecking “Attempt to discover the devices. They must not be connected to a mobile app” with “Force disconnect from BRC1H device before start (recommended)” checked, then I enable bluetooth on the Madoka without removing the existing connection, then click submit in the configuration. It eventually adds the device but I get the error below. I did all of this AFTER the pairing process using bluetoothctl.

Logger: homeassistant.components.climate
Source: helpers/entity_platform.py:253
Integration: Climate (documentation, issues)
First occurred: 10:20:45 AM (1 occurrences)
Last logged: 10:20:45 AM

Setup of platform daikin_madoka is taking longer than 60 seconds. Startup will proceed without waiting any longer.

I am curious, has anyone successfully made this work in the US? I get the feeling there might be differences on the thermostat since the Madoka Assistant app is not available here. I sideloaded that app and was able to discover my Madoka but it never successfully connects to allow me to control settings. The only option available that I can find in the US is to use the Madoka Quick Set. There are very limited controls, mostly administrator type locks, available in that app when connected.

I would say the protocol and the controller should be the same in the US. Actually, if you have been able to sideload and control the thermostat, it should definetely work.

Does the connection remain stable once you connect using bluetoothctl? There should be no espontaneous disconnections. Otherwise, it might be related to the bluetooth adapter. Is it far from the thermostat? Is it external?

The log messages are written by HomeAssustant because the connection takes longer than expected. It is something normal, I get them too.

Hello @mduran80. First thanks for your great work.
I just discovered the bluetooth proxy esphome component. It transmits bluetooth traffic through network to home assistant, hence (in principle) enabling it to reach more distant devices.
I wonder if it could be possible to use this technology in your integration.

1 Like

Hi, 1000 thanks for that ! Finally i can manage my Daikin outside and can make some automation.

I wonder if it’s possible to add more feature like “filter alert” or other “installer setting” that we can manage from Madoka bluetooth app. If yes, do you think it could be included in a futur release ?

Thanks again :slight_smile:

Hey,

Sorry for the late response… I just checked the docs for that component and it says the following:

The Bluetooth proxy of ESPHome currently only provides Home Assistant with passive sensor data that is advertised by certain devices. Not all devices are supported and ESPHome does not decode or keep a list.

The proxy only works as a passive data relay. It means it won’t be able to send any command to the thermostat. The protocol works by sending requests and receiving the reply (that’s why it is implemented as a polling component) so passive BLE will not work.

However, running the pymadoka package with MQTT in the ESP32 (Micropython) could be feasible, although I have never looked into it. Probably a Raspi Zero or similar would be a better option for that.

Hi,

The filter indicator is already supported by the pymadoka library. Status is retrieved from the thermostat every time, but I haven’t set up a sensor yet (should be easy to do so).

I will try to include support for it in the HA addon soon. As for the “installer setting”, what is it supposed to do? I don’t use the app myself, so no clue.

Hi, thanks for your quick answer :).
Nice to hear that should not be so hard !

Installer setting is kind of dev mode of app. You can change setting manage by Dakin Professional who installed the hardware. I think this is needed just by myself or for a few people. In these options we can for example apply a correction to the temperature detected by temp sensor of the daikin controller when it’s wrong, Or you can choose temp sensor to use ( controller, internal unit, both, etc…).

These setting are called “field setting” in app & documentation (or “réglage sur place” in french).

Thanks :slight_smile:
Dorian

Mmmmh while I was double checking, I came across with the project on which pymadoka is based. It seems the author was able to implement the protocol with an ESP32. Maybe it is worth a try

Thank you for the response.
Actually this was until version 2022.10.
In 2022.10 release notes, active connections are introduced.

Hi,

I am currently working on getting the madoka-mqtt bridge working with a number of systems. Will the MQTT implementation work with this custom component or should we use it with generic thermostate in HASS ?

Thank you

Hi,

I don’t think they will work together, you mean co-exist? I wrote the MQTT bridge keeping in mind the generic thermostate, I have no idea if they will work right :sweat:

Okay, then I am not wasting time modding the MQTT broker to get it to align with the generic thermostate.

I am planning on replacing all the daikin control units with the madoka ones in our building ( 6 at least ) and coupling them with a BLE - mqtt bridge based on raspberry pi.

4 Madoka connected and functional - It has been very difficult (More than 5 hours with all type of issues)
I recommend the following
0 - Once Devices are Paired, before Integration with Custom component
1 - All Madoka are using the same alias, hence it is disconnected. It is useful to rename the device via
bluetoothctl , (power off, power on, devices)
connect <mac>
set-alias <alias>

TIPS 1 - Using Putty better than Terminal H ( possible to Copy/paste of MAC address with Putty )
TIPS 2 - Prepare a note with all MAC and Alias + sequence with bluetoothctl, power on, off, scan off, trust, pair

Hi all,
after 2 or 3 hours or good functioning, the Bluetoothctl is no longer responding.
Error Message :
“Waiting to connect to bluetoothd…dbus[207]: arguments to dbus_connection_get_object_path_data() were incorrect, assertion “connection != NULL” failed in file dbus-connection.c line 5921.
This is normally a bug in some application using the D-Bus library.”

Any advice ? Thank you guys

Has anyone successfully used an ESP32, bluetooth proxy and a component to control a Madoka unit?

From BLE Client — ESPHome

This component does not (yet) support devices that require security settings (eg connecting with a PIN).

I suspect this rules out using esphome and bluetooth proxying to pair to and control the Madoka BRC1H. If anyone’s found a workaround, please let me know.

I think the only workaround could be using esp32 as a ble2mqtt bridge, and then manually defining a climate device in home assistant.

Hello everyone.
I finally wrote a madoka component for ESPHome. It’s still in a pre-early stage (code has to be re-styled and organized), but it works. If anybody wants to try it out, here’s a sample ESPHome configuration to make it work.

...

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

esp32_ble_tracker:

ble_client:
  - mac_address: <mac_address>
    id: madoka_climate

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

...

Any feedback and contribution is greatly appreciated.

3 Likes

Hi, just started to use the custom component. But which one is the most updated now, it seems this one, right?

GitHub - mduran80/daikin_madoka: Home Assistant custom component integration for the BRC1H thermostat (madoka)

Now, the component is working and I was able to connect to my thermostat. But after some time, I’m losing connection and then the home-asisstant console is flooded with these messages:

homeassistant | 2023-03-17 15:38:17.653 ERROR (MainThread) [pymadoka.connection] [org.bluez.Error.Failed] br-connection-canceled
homeassistant | 2023-03-17 15:38:19.660 ERROR (MainThread) [pymadoka.connection] [org.bluez.Error.Failed] Operation already in progress

At this point, if I restart home-assistant, connection is restored.

Is this expected or am I hitting a bug due to maybe bluetooth connection instability?