Writing a component for Luxtronik Heatpumps

Thats because I used Python 3.6+ which supports the f"{}" notation for string format

I’m already done with making this a real component and planning to do a pull request soon.
Hopefully HA accepts it!

ok, thanks.
then i just need to figure out how to ‘activate’ python 3.6 for HA…

I’ll push a luxtronik branch to my forked repo soon, if you want to, you can download the files from there and put them into your HA installation manually to test!
I let you know when I’m done
Here we go: https://github.com/Bouni/home-assistant/tree/luxtronik
By copying these three files to your HA installation you should be good to go:

  • homeassistant/components/binary_sensor/luxtronik.py
  • homeassistant/components/luxtronik.py
  • homeassistant/components/sensor/luxtronik.py

For the configuration take a look at this gist:

As the used sensors/binary sensors in the example are just a small subset of all posssible sensors, you can take a look at this list (only in german but google translate ist your friend) for the sensors you need:
https://www.loxwiki.eu/pages/viewpage.action?pageId=18219334

Thanks i Will try tonight.
Does it need python3.6?

@Bouni
I copied the files to the location, made the config and rebooted.
I get this error message:
File “/usr/lib/python3.5/site-packages/homeassistant/components/luxtronik.py”, line 75, in <module> self.data = self._luxtronik.get_data() NameError: name ‘self’ is not defined

As you can see i still use python3.5

I managed to update to python 3.6 (via a venv), but still the same issue:
File “/root/homeassistant/lib64/python3.6/site-packages/homeassistant/components/sensor/luxtronik.py”, line 12, in <module> from homeassistant.components.luxtronik import ( File “/root/homeassistant/lib64/python3.6/site-packages/homeassistant/components/luxtronik.py”, line 75, in <module> self.data = self._luxtronik.get_data() NameError: name ‘self’ is not defined

Hi,

try to start python in your venv from the commandline (just type python and hit Enter)
Then type “from luxtronik import Luxtronik” and hit Enter
Check if the module can be imported.

@bouni This is the result:

[root@localhost bin]# python3.6
Python 3.6.5 (default, Apr 10 2018, 17:08:37)
[GCC 4.8.5 20150623 (Red Hat 4.8.5-16)] on linux
Type “help”, “copyright”, “credits” or “license” for more information.

from luxtronik import Luxtronik
Traceback (most recent call last):
File “”, line 1, in
ModuleNotFoundError: No module named ‘luxtronik’
exit()

I am not sure if this was done in the virt. environment, so i did it again:
(homeassistant) [root@localhost components]# python3.6
Python 3.6.5 (default, Apr 10 2018, 17:08:37)
[GCC 4.8.5 20150623 (Red Hat 4.8.5-16)] on linux
Type “help”, “copyright”, “credits” or “license” for more information.

from luxtronik import Luxtronik
Traceback (most recent call last):
File “”, line 1, in
File “/root/homeassistant/components/luxtronik.py”, line 75, in
self.data = self._luxtronik.get_data()
NameError: name ‘self’ is not defined

I think its becasue you need the this file: https://github.com/Bouni/home-assistant/blob/luxtronik/requirements_all.txt as well.
Without that, HA doesn’t install the dependency.

ok, where does it need to be placed?

@Bouni. I got it to work and it works great, thanks!
something went wrong in copying the files from github… But now it works!

Glad to hear that! Hopefully my schedule allows me to finish this thing soon and submit the PR.

@Bouni Great work!
I just noticed some minor things…
in the logs i get an ERROR entry every minute ‘Luxtronik sensor update’ for every sensor. I guess that should be an info entry?

For ‘luxtronik_ID_WEB_HauptMenuStatus_Zeile1’ I get a value ‘graph’ not a ‘status graph’ as i would expect?

I am trying to set up a group with the error messages and the time, but i cant get this working. any idea why that is?
my group.yaml:

heatpump_errors:
entities:
- sensor.ID_WEB_ERROR_Nr0
- sensor.ID_WEB_ERROR_Time0

Many thanks!

Hi,

the component ist still under development, so it might have some flaws :slight_smile:

I just noticed some minor things…
in the logs i get an ERROR entry every minute ‘Luxtronik sensor update’ for every sensor. I guess that should be an info entry?

I’ve put the logger warnings into the code to see if it updates regularly for dev purposes, you might comment out these lines:
https://github.com/Bouni/home-assistant/blob/luxtronik/homeassistant/components/luxtronik.py#L76
https://github.com/Bouni/home-assistant/blob/luxtronik/homeassistant/components/sensor/luxtronik.py#L99
https://github.com/Bouni/home-assistant/blob/luxtronik/homeassistant/components/binary_sensor/luxtronik.py#L74

For ‘luxtronik_ID_WEB_HauptMenuStatus_Zeile1’ I get a value ‘graph’ not a ‘status graph’ as i would expect?

I now that the display content is put togehter from serveral values. Take a look in here:

https://www.loxwiki.eu/pages/viewpage.action?pageId=18219334

Numbers 117 - 123 are affecting the menu. It’s not entirely clear if there are others that come into action.
Can you post a screenshot/photo of what you expect and what you actually get?

I am trying to set up a group with the error messages and the time, but i cant get this working. any idea why that is?

What do you mean by “cant get this working”? What do you get and what do you expect?

Thanks for pointing these problems out to me!

@Bouni ok great!
concerning the ‘web_hauptmenustatus’ this is what i get:
actual
and would like some state information kind of like this:
expected

I think this worked in the first beta you had put together.

The lookup table I’ve created return a text for the given heatpump state:

https://github.com/Bouni/luxtronik/blob/master/luxtronik/lut.py#L114-L115

I think I need to figure out if I can make a sensor having a text as its state.
Unfortunately I’m short on spare time for the next 1-2 weeks an cannot guarantee that I can take a closer look into the issue.

Hello everybody,

how can i control the heat directly from home assistat?

It looks like the component is broken since the 0.88 release. Got an lots of errors during the HA startup.

"Error loading custom_components.luxtronik.sensor. Make sure all dependencies are installed
Traceback (most recent call last):
  File "/usr/local/lib/python3.7/site-packages/homeassistant/loader.py", line 147, in _load_file
    module = importlib.import_module(path)
  File "/usr/local/lib/python3.7/importlib/__init__.py", line 127, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 1006, in _gcd_import
  File "<frozen importlib._bootstrap>", line 983, in _find_and_load
  File "<frozen importlib._bootstrap>", line 962, in _find_and_load_unlocked
ModuleNotFoundError: No module named 'custom_components.luxtronik.sensor'; 'custom_components.luxtronik' is not a package"

and

Integrations need to be in their own folder. Change sensor/luxtronik.py to luxtronik/sensor.py. This will stop working soon.

See the committed issue at GitHub:

I’ll take a look at it today!