Support for Daikin BRC1H519W BLE controller

I wrote a python library to control the thermostat based on the previous work done for openHAB. I will need some time now to integrate it into HomeAssistant though.


NICE! :slight_smile:
If you need me to test something, just let me know.

Thank you for trying to make this possible :slight_smile:

I think that Lafois was working on integrate it into an esp32

Great! You were faster than me. I was also working on this, based on a eq3bt python library, and had almost everything already sorted out, but never went into the actual implementation phase.

I don’t have any interest in writing a ‘competing’ library, as I don’t really have the time to even support one on my own. I will review your code and see if I can propose enhancements.

Many thanks for the effort.

Awesome, any help will be more than welcome. I have just focused on supporting the basics, as my HVAC doesn’t support many of the features the original APP can offer and, therefore, I can’t try to reverse engineer the messages required to control them.

From what I have seen, the screenshots of the app in the App Store offer a wide variety of features. In the future, I will try to emulate the thermostat and try to enable the app for different models. However, I don’t intend this to become a full controller, just to support what is needed to work with home automations.

In case you are interested, I will add some info to the README about the process in case your HVAC is more complex (bluetooth logs on android/macOS, btmon on Linux and so on) so anybody can contribute to the commands.

My plan was also to start with what was already decoded which is the basic functionality that most will use for home automation.
I have just taken a look at your code and has a somehow different approach as I was using bluepy and your are using bleak.

What I have seen is that you don’t need async. While blafois says that the protocol is async, he also states that no message is sent from the controller if not requested. So the actual protocol is working in a sync way.

There are other things that I see in the app that can make more sense to be used for offices, hotels, and commerce. I wasn’t planning on implementing these at least at the beginning.

It would make sense that any additional information that is discovered is sent back as a PR to blafois so there is one place with the decoded protocol.

I’m just happy you guys are giving it a try :slight_smile:

For me personally for HA integration i only need to set fan speed, temperature and cold/warm setting. I do not need all other stuff from app. With these settings i can automate my Daikin with my floor heating and stuff. :slight_smile:

I started coding with bluepy as the interface was more friendly but I didn’t feel comfortable having to relay on a process spawn whenever I wanted to interact with the adapter so I decided to switch.

Totally agree with the PR. First thing I did was to check on him if he was planning to release his code as a library but he wasn’t interested at the moment.

I have seen that the app and HA support different ventilation settings, I think that is the only basic left behind as I can’t test it.

I finished the Home Assistant integration, you can give it a try if you are interested. It has been an intensive work as I was quite new to many of the integrations details.

You can copy it to your custom_components folder. Make sure to follow all the steps detailed in the “requirements” section or it will not work. The most important part is related to the discovery and pairing.

The thermostat is a bit pesky about bad commands/connections and, although thoroughfuly tested, it might force you to disconnect the p1/p2 cables to reset it sometime.

I will try to elaborate a bit more on the Readme and will submit it as a PR.

I just realized that the integration will fail for HassOS. The tool used to check if the adapter is working is not installed there, I will replace it.

I will be able to install and test the integration all day tomorrow :slight_smile:
I am not using RasberryPi, i am using Intel NUC and proxmox.
I will install a dedicated BT adapter and passthrough to the VM with HA.

If you want me to test other scenarios, i have several Raspberry’s and other HW i can test with :slight_smile:

Thanks a lot for doing this, i have been waiting a long time for this :slight_smile:

Thank you for your help on this, let me know if you get stuck at some point. Last night I tested with the docker and I had to update to latest HassOS version to make it work. It gave me a lot of bluetooth errors related to the DBUS.

However, it started working properly after the update although not as stable as in Linux in the NUC.

I will publish the details in the Share project forum so other people can know of it.

Great, i will try and install it now :slight_smile:
What version did you upgrade to HassOS?

I am running 5.10 and 2021.1.0 at the moment

I upgraded to that same version

IT WORKS! :slight_smile:
So cool.

Bluetooth paired nicely, no problems and everything worked at first try :slight_smile:

I have only tried turn on/off and adjusting temp, but working fine.

Manu,

I have tried now in my Raspberry PI running Homeassistant in docker and I am unable to pass the install screen for the integration.

  • Raspberry Pi 3

  • I have BLE tracking integration enabled and working

  • Madoka controller is paired with this Raspberry (it is where I was making the tests for my own library)

  • I have installed pymadoka using pip in the container. I guess all the dependencies should have been pulled.

  • In the Rapsberry Pi the bluetooth device is /dev/ttyAMA0. As mentioned above is exposed to the docker container and working for BLE discovery/tracking. I have tried to change it in the install screen (to just ttyAMA0 and the full /dev/ttyAMA0) with no luck. One weird thing is that running ‘hcitool dev’ shows hci0 but this device is non-existant in /dev/

  • I have tried to enable logging but I don’t see anything in the logs

logger:
    default: info
    logs:
      custom_components.daikin_madoka: debug

You are right, the device is not listed in /dev because it is apparently managed by Bluez. I suggest you give “hci0” a try as the adapter because if it is listed with hcitool, it should work (the library talks to the Bluez-DBUS).

Regarding the logs, I haven’t tried setting up the logging in Home Assistant. The library is full of logs although the integration does not contain that many. However the library logger name starts with “pymadoka.”, is it possible to add that to the logs section with a “debug” value?

In any case, the integration checks if the adapter is valid before installing and returns a message when it is not.

By the way, pymadoka should install automatically as it is listed in the integragion manifest as a requirement.

Let me know if the hci0 worked. If not, I will try to setup my old raspi3 for testing.

should we continue the discussion in the component topic? It might help other users:

Yes, lets continue in the custom components topic.

I also have time to test with an RP3 later tonight.

Anyone has this problem?

If AC is operated by its Madoka device I did not get the update on home assistant, I mean that if I turn on ac by device I did not get that information in HA, where it’s still showing as off.