Converting a MAX! Cube to CUL/CUN to use with Home Assistant

Cool, looks promising :slight_smile:
I can see that in config.json the devices are hardwired. I think there is the possibility to detect the devices automatically via the auto_uart config to integrate them into Docker. So you wouldnā€™t be limited to the two variants.

You can use somehting like this https://gist.github.com/vladbabii/cc1bbcd6b61485caefece5f04370eb7e to set it it to a fixed /dev/something location. Just list your usb devices and find the correct vendor id and device id and replace them. Also if you set SYMLINK+=ā€œculā€ then the device will be /dev/cul .
The RUN+="/bin/x-hass-restart-zwave-replug" can be removed or can be set to a script that does something is the usb hickups or you remove/replace the script (for zwave i restart the home assistant after 10 seconds, for other sticks / adapter i use service restart and so onā€¦) This was added because usb can hickup and remove/re-add the usb connections randomly without physically removing themā€¦

Success! I have thermostat+ 1 to 3 radiators in various rooms. When i change a thermostat the radiators get updated instantly!

And you donā€™t actually need the homematic binding, just use mqtt!

You can edit /etc/homegear/mqtt.conf and set your broker, then, in home assistant add to the climate component at least the thermostats (in my case changing thermostat values also triggers the radiators)

# modes:
# 0 - auto
# 1 - manual
# 2 - party
# 3 - boost

 - platform: mqtt
   name: Office Thermostat
   retain: false
   send_it_off: true
   current_temperature_topic: service/homegear/8347/plain/1/1/ACTUAL_TEMPERATURE
   temperature_state_topic: service/homegear/8347/plain/1/1/SET_TEMPERATURE
   temperature_command_topic: service/homegear/8347/set/1/1/SET_TEMPERATURE
   min_temp: 10
   max_temp: 30
   temp_step: 0.5
   modes: ["auto","manual","party","boost"]
   mode_state_topic: service/homegear/8347/plain/1/1/CONTROL_MODE
   mode_state_template:  >-
      {% set values = { '0':'auto', '1':'manual', '3':'boost'} %}
      {{ values[value] if value in values.keys() else 'off' }}

I donā€™t use party mode so i hide itā€¦

Works very well. Also I disabled node-blue since it was causing very high cpu usage on idle in homegear.

Now I only need to make mode_command_template to work with

#   mode_command_topic: service/homegear/8347/set/3/1/CONTROL_MODE
#   mode_command_template: >-
#      {% set values = { 'auto':'0', 'manual':'1',  'boost':'3'} %}
#      {{ values[value] if value in values.keys() else '0' }}

details in this thread - Need help with value_template for MQTT HVAC

Mqtt binary sensor template for battery level

  - platform: mqtt
    unique_id: heating_battlow_office_thermostat
    name: Office Thermostat Low Battery
    state_topic: service/homegear/8347/plain/1/0/LOWBAT
    payload_on: true
    payload_off: false
    device_class: battery

What is the advantage of using MQTT instead of the Homematic Binding when connecting Homegear to HomeAssistant?

One less binding to worry about/upgrade/testā€¦ decoupling components since mqtt is an easy standardā€¦ I can update only parts of the home automation systemā€¦ For example, I had a (old version of) home assistant + cube plugin in a container that handled heating and pushed everything to mqtt, now i replaced that container with a home gear oneā€¦ When something breaks or needs upgrade itā€™s usually a ā€œslaveā€ that needs working on so I can turn off a part of the home automation and everything else worksā€¦ And if something breaks i can just turn off a part of the system, not everythingā€¦

I run everything in my home on mqtt, so itā€™s easier for meā€¦

Thanks for the feedback, Iā€™d heard of MQTT support in homegear, but not investigated it at all.

Might switch my setup to this, since Iā€™m using MQTT for most other things - as you say, one less thing to test at update time :slight_smile:

Iā€™m interested to know if anyone found a good (efficient) way to send automatic schedules to the thermostats via homegear?

Iā€™d like some ā€˜day temperaturesā€™ for some of my thermostats for rooms that are unoccupied during the day, but also to revert to the previous manual temperature at night.
One way I thought of was to store the manual temperature in a number entity then use that to revert back at nightā€¦ but it feels messyā€¦

I wondered if I could make use of the auto mode during the day and then switch to manual mode at night - but Iā€™ve not yet tested if the previous manual temperature is remembered when you switch from autoā€¦

If you use MAX! Thermostats, I would recommend to use HomeMatic Manager so store the time tables of temperatures directly on the thermostats, as this is way more robust than using Homegear / HomeAssistant for those schedules.

Indeed, thats what I was thinking, but it seems setting these values for each thermostat is very clunky in homematic manager (unless iā€™ve missed something).

After issuing many commands via alexa / web interface / physical devices, i got this in the homegear logs

... Module MAX: CUNX "Max-CUNX": Warning: Too short packet received: ...

When you get a lot of these messages, the integration will stop working. I restarted homegear to fix everythingā€¦

I will monitor things for the next couple of days to see if it happens againā€¦

Does that message end with ā€˜LOVFā€™ ? - If so, you have run out of airtime credits.
(Though that shouldnā€™t happen if you use the no credits firmware)

I havenā€™t spotted that issue before, but I havenā€™t inspected the logs recently since everything seems to be working.

No, Iā€™m afraid itā€™s really time-consuming. But it is possible to apply a configuration directly to several thermostats or to copy a configuration to another thermostat and then only adjust it.

I know that error. With me, however, it goes away after some time (a few hours?) also again by itself - without restart.

Iā€™m using the no-credits firmwareā€¦

Interesting, is your log entry ending ā€˜LOVFā€™ ? - If it isnā€™t, then i donā€™t think that is the credits problemā€¦
If it is, you shouldnā€™t be seeing it with that firmware :thinking:

Thanks for you comment. I will think about this and some other improvements like builds for other systems than RaspberryPi. I will have a look on theas features and update the Package.

@swifty , i look for a switch to the alpine repo that is used by hass.io. I dont know how complicated it is to get homegear run in alpine linux. If that is not a big deal i think it is possible to build this addon on all platforms that supported by hass.io.

homegear.log:11/15/18 19:05:25.139 Module MAX: CUNX "Max-CUNX": Warning: Too short packet received: Z0000
homegear.log:11/15/18 19:05:25.140 Module MAX: CUNX "Max-CUNX": Warning: Too short packet received: Z0058
homegear.log:11/15/18 19:21:53.877 Module MAX: CUNX "Max-CUNX": Warning: Too short packet received: Z012A00
homegear.log:11/15/18 19:23:11.421 Module MAX: CUNX "Max-CUNX": Warning: Too short packet received: Z00D2
homegear.log:11/15/18 21:28:15.775 Module MAX: CUNX "Max-CUNX": Warning: Too short packet received: Z011901
homegear.log:11/15/18 21:29:18.205 Module MAX: CUNX "Max-CUNX": Warning: Too short packet received: Z012C27
homegear.log:11/15/18 21:30:28.811 Module MAX: CUNX "Max-CUNX": Warning: Too short packet received: Z0059
homegear.log:11/15/18 21:32:15.836 Module MAX: CUNX "Max-CUNX": Warning: Too short packet received: Z0023
homegear.log:11/15/18 21:42:50.550 Module MAX: CUNX "Max-CUNX": Warning: Too short packet received: Z0023
homegear.log:11/15/18 22:21:34.613 Module MAX: CUNX "Max-CUNX": Warning: Too short packet received: Z0540186010FD7B
homegear.log:11/15/18 22:22:57.111 Module MAX: CUNX "Max-CUNX": Warning: Too short packet received: Z006C
homegear.log:11/16/18 01:21:34.433 Module MAX: CUNX "Max-CUNX": Warning: Too short packet received: Z02169368
homegear.log:11/16/18 01:21:37.901 Module MAX: CUNX "Max-CUNX": Warning: Too short packet received: Z04002CD8238A
homegear.log:11/16/18 01:27:11.114 Module MAX: CUNX "Max-CUNX": Warning: Too short packet received: Z02175A63
homegear.log:11/16/18 01:29:01.360 Module MAX: CUNX "Max-CUNX": Warning: Too short packet received: Z04774218E11A
homegear.log:11/16/18 01:37:47.810 Module MAX: CUNX "Max-CUNX": Warning: Too short packet received: Z0022
homegear.log:11/16/18 05:07:06.349 Module MAX: CUNX "Max-CUNX": Warning: Too short packet received: Z0540186010FD7B
homegear.log:11/16/18 05:07:48.465 Module MAX: CUNX "Max-CUNX": Warning: Too short packet received: Z0062
homegear.log:11/16/18 05:08:59.319 Module MAX: CUNX "Max-CUNX": Warning: Too short packet received: Z0022

No LOVFā€¦ Maybe I should connect the cube via usb instead of ip?

Ok no LOVF so the error is not credit limiting afaik.

I searched and found some other reports of this (itā€™s an issue in culfw), and someone noted some changes they made to help - iā€™ll see if i have any logs of the issue tonight and try out compiling a new firmware with the changes they mention.

Thank you. Let me know if I can help in any way.