Edilkamin pellet stove controlled with "the mind"

Recently I bought a Edilkamin Slide 7 up pellet stove. It can be controlled with bluetooth and Wifi. The problem is however that I can’t controle it from the internet. I found this: edilkamin - npm. I don’t have the skills to integrate this in Home assistant. It would be great if “The mind” can be integrated in Home assistant. I looks that it will be the standerd for the Edilkamin stoves.

im also interested!

+1 I’m also interested
I would be nice if we could control it via bluetooth :slight_smile:

Wifi will be the smartest, otherwise your HA computer has to be in the neigborhood

Hey guys,
I’ve started working on this today.
I’ve made the original JS and Python implementation, but I’m seeing more demand for Home Assistant lately so I’m giving it a go.

I can turn on/off the stove from Home Assistant.
It’s a very early implementation.
I’d like to release early/often with a basic pull request to Home Assistant, but first I’d like to get the device discovery right otherwise people would have to enter the MAC address by hand and that’s a bit painful to get right.

Leveraging the bluetooth to do so seems easy enough because the device advertise itself as EDILKAMIN_*, however later the MAC address used to identify the device to control it via the remote mqtt service uses the wifi MAC address.
I’ve identified a possible relation between the two, but I need to verify if it’s indeed the case or not.
Could you share a few info like:

  • the device bluetooth name (for me it’s EDILKAMIN_EP)
  • device bluetooth MAC address (A8:03:2A:FE:D5:0A for me)
  • device wifi MAC address (A8:03:2A:FE:D5:08 for me)

I’ll have more question later, I’ll actually join the Discord server, that would be easier to sync up.

Edit: went through the source code a bit and yeah there’s a relation between the two.

    private final void getFullMac(String str) {
        if (!Intrinsics.areEqual(str, "null")) {
            StringCompanionObject stringCompanionObject = StringCompanionObject.INSTANCE;
            String format = String.format("%02X", Arrays.copyOf(new Object[]{Long.valueOf(Long.parseLong(StringsKt.replace$default(str, ":", "", false, 4, (Object) null), CharsKt.checkRadix(16)) - ((long) 2))}, 1));
            Intrinsics.checkNotNullExpressionValue(format, "java.lang.String.format(format, *args)");
            Locale locale = Locale.ROOT;
            Intrinsics.checkNotNullExpressionValue(locale, "Locale.ROOT");
            if (format != null) {
                String lowerCase = format.toLowerCase(locale);
                Intrinsics.checkNotNullExpressionValue(lowerCase, "(this as java.lang.String).toLowerCase(locale)");
                BluetoothState.INSTANCE.setMqttWifi(StringsKt.padStart(lowerCase, 12, '0'));
            throw new NullPointerException("null cannot be cast to non-null type java.lang.String");

So they simply do -2 from the bluetooth MAC to get the wifi MAC it seems.
I’m going back to the implementation then :slight_smile:

Hi, thnak you very much for your involvement.
If you need some info i’ll be pleased to help you.

In order to confirm, my BT stove name is also EDILKAMIN_EP
Will check later the MAC. But the easy way to grab it, is to download nrf connect (for iphone) for example.

I also sniffed all traffic from my phone to aws server and see how a request was managed, if you want some example let me know.

I was suggesting BT because I have lost some times wifi connection and it is not pleasant.

As Rpi4 has BT you will depend only on local and not on cloud solution .

Thanks @shisva,
Yes I’ll certainly make an alternative implementation that relies solely on bluetooth too.
I made it wifi first because that’s what I was using with their Android app so initially when I wrote to lib I used the same endpoints.
I’ve submitted an early stage pull request.

Home Assistant is a bit new to me so I’m not sure I took the right approach in my proposal.
That said, I can already do the basic things from HA now, like on/off, get/set the temperature and device discovery using bluetooth.
I’ll iterate over it with more sensors and features after it gets approved/merged

Hi, my bad, NRF don’t show the MAC address of the BT card. However the Mac adress of the wifi card is : a8:03:2a:ea:50:80

How could I find the Mac adress of the BT card ?

There’re different ways depending on your operating system.
From Android you can see it in the connected devices settings clicking the gear icon it seems.

If that doesn’t work out try to see how to for your OS

Maybe a stupid question, but how to integrate in HA?

Hi, I was asking myself also how to test it, adding files to custom_componant doesn’t work. What I understand, the only way to use it is to run pytest or wait for a HA release

Yes you can have it working via custom_components indeed, you would need to copy the integration and then edit the integration manifest.json to add a version field (refs Custom integration changes | Home Assistant Developer Docs).
So something like this (adapt to your needs).

# download and extract the onoing changes from my fork
wget https://github.com/AndreMiras/core/archive/refs/heads/feature/edilkamin.zip
unzip edilkamin.zip
# add the required version field in the manifest.json file
sudo sed 's/"domain": "edilkamin",/"domain": "edilkamin",\n  "version": "2022.12.02",/g' -i core-feature-edilkamin/homeassistant/components/edilkamin/manifest.json
# copy the component to your custom_components/ folder (adapt the path to your setup)
cp -r core-feature-edilkamin/homeassistant/components/edilkamin ~/homeassistant/custom_components/

After that simply search for the new integration by clicking “ADD INTEGRATION” within the “Devices & Services” settings

Thank you @AndreMiras taking your time to explain us such thing :slight_smile:

Will try that soon

Hi, may be it’s normal, when credentials are validated, integration shows up but no entities are generated, normal ?

Hi @shisva, sorry for the late reply, I’m not sure how I still don’t receive notification after I enabled them.
No it’s not normal, it’s like the bluetooth device isn’t being detected.
Ping me on Discord (AndreMiras#3439) so we can debug it.
One way to work it around until I provide the option to force the MAC is to hardcode it in the code.
In the custom_components/edilkamin/climate.py file where you have mac_addresses = edilkamin.discover_devices_helper(ble_devices) add the stove wifi MAC address (not the bluetooth one) just after.
So both lines would look like that:

    mac_addresses = edilkamin.discover_devices_helper(ble_devices)
    mac_addresses += ("AA:BB:CC:DD:EE:FF",)

If that doesn’t work check the logs.
Ping me on Discord anyway so we can debug it and see how I can improve the integration

Hi @AndreMiras, integration is working well by adding the MAC addres. I added you in Discord also.
Will be pleased to help you on this project.

Hello @AndreMiras ,

I just received my edilkamin stove with the mind this week, so this integration comes in a perfectly right moment.

The application The mind is set up on my phone. The Stove is connected to wifi. I tried to install the integration as a custom component and I set the bluetooth mac address manualy. The integration starts with an error :

Logger: homeassistant.components.climate
Source: custom_components/edilkamin/entity.py:56
Integration: Thermostat (documentation, issues)
First occurred: 08:41:17 (1 occurrences)
Last logged: 08:41:17
edilkamin: Error on device update!

Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 493, in _async_add_entity
    await entity.async_device_update(warning=False)
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 715, in async_device_update
    await task
  File "/usr/local/lib/python3.10/concurrent/futures/thread.py", line 58, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/config/custom_components/edilkamin/entity.py", line 56, in update
    self._device_info = edilkamin.device_info(token, self._mac_address)
  File "/usr/local/lib/python3.10/site-packages/edilkamin/api.py", line 92, in device_info
  File "/usr/local/lib/python3.10/site-packages/requests/models.py", line 1021, in raise_for_status
    raise HTTPError(http_error_msg, response=self)
requests.exceptions.HTTPError: 401 Client Error: Unauthorized for url: https://fxtj7xkgc6.execute-api.eu-central-1.amazonaws.com/prod/device/244cab1e135e/info

Just to be shure, I downloaded edilkamin.py on a PC and tried it manualy. I have the same result :

>>> token = edilkamin.sign_in(username, password)
>>> mac_address = "24:4C:AB:1E:13:5E"
>>> edilkamin.device_info(token, mac_address)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/u205580/.local/lib/python3.10/site-packages/edilkamin/api.py", line 92, in device_info
  File "/usr/lib/python3/dist-packages/requests/models.py", line 943, in raise_for_status
    raise HTTPError(http_error_msg, response=self)
requests.exceptions.HTTPError: 401 Client Error: Unauthorized for url: https://fxtj7xkgc6.execute-api.eu-central-1.amazonaws.com/prod/device/244cab1e135e/info

So I am able to sign in, this is not password related. But somehow my username doesn’t have access to the api. Any idea ?

Most likely the wrong mac address.
Use the one that appears in the mobile application “The Mind”.
Go to Settings > Software, and take the “MAC MQTT” address.
It’s slightly different from the bluetooth address.
Also come talk to me on Discord so we can improve that integration

Thanks for the quick response !
When I read the posts above I thought that the bluetooth mac address was needed. But no, the mac that appears in the app is the wifi mac address. It works with the correct mac address !

I think it would be nice to have the possibility to (optionnaly) enter the mac address when setting up the integration in Home Assistant. And show in the documentation where to find the mac address in The Mind app. For exemple, my HA server is a VM and I don’t have bluetooth.

I can’t wait to be able to set the fans speed in Home Assistant :blush:. But being able to start/stop the stove is already great (I hate the android app, and the remote is waaaay to slow). Thanks for the integration !