Eq3 Max! Cube and thermostat integration via Mqtt and Max Home Automation

Ok my problem is solved and I’m back to my previous configuration
So I might give another try with a spare Pi (1) I have!

so I tried again to install max home automation on a spare Pi, followed your instructions and everything seemed fine
the only (big) problem I have is that the X11 forwarding does not work (neither on a Mac or Windows) so I cannot set up the software :face_with_symbols_over_mouth:

With windows I use MobaXterm https://mobaxterm.mobatek.net/download.html. Home edition is sufficient.

The integration is using JSON API for whole cube from max_home_automation. I encounter, that sometimes, usually after restart of RPi, some windows sensors and eco button get to some strange state, that max_home_automation is not able to process. Unfortunatelly the JSON API returns empty device list.

Open&close window and clicking the button usually helps to resolve the issue.

I plan to read list of devices via another max_home_automation API, that does’n suffer this issue and use JSON API for separate devices. Hope I will finish this by end of week.

I used Moba Xterm! and confirmed it worked with xclock, so not a set up issue between server and client…

So your setup is as follows?
Two RPis, one with HA and second with MHA.
MHA with HTTP API enabled and set to be available not on localhost and port 8080, but on IP of your RPi with MHA.

Did you try to call MHA with wget or curl?
Something like: http://192.168.1.123:8080/get-status-json?cube=ABCDEF
It should return JSON with devices. If this doesn’t work, then there is problem with MHA configuration.

Run MHA X11 forwarded. Look in the “trace”. To run HTTP API on port 80 may return in error, if ths port is already used.

Correct
But I can’t activate the http API in MHA since the X11 forwarding does not work…

I am not sure if this helps…
Stop MHA.
Locate file in your home .local/share/recently-used.xbel.
There should be stored the MHA configuration.

One configuration entry looks like this:

<bookmark href="http-server" added="2019-02-20T07:31:42Z" modified="2019-02-26T17:52:54Z" visited="2019-02-20T07:31:43Z">
    <title>on</title>
    <desc>stored value for http-server</desc>
    <info>
      <metadata owner="http://freedesktop.org">
        <mime:mime-type type="application/octet-stream"/>
        <bookmark:applications>
          <bookmark:application name="max_home_automation" exec="&apos; max_home_automation%u&apos;" modified="2019-02-26T17:52:54Z" count="15"/>
        </bookmark:applications>
      </metadata>
    </info>
  </bookmark>

Find and set values for following - the value is in “title” element:

http-server : on
http-address : <IP>
http-port : 8080

Start MHA.

just tried
I have no file in this directory…
so it seems MHA is not starting fully but I have no way to know what’s going on without display…
it appears in the list of processes but that’s all I can say
thanks for your help, but forget it, since my cube has reset once again (third time in a week!), I’ve decided to try to flash it: Converting a MAX! Cube to CUL/CUN to use with Home Assistant

Since koleo9ams Addon doesnt work anymore I made some progress to bridge mqtt. Here is how I did it:

1: Activate MQTT server in max! home automation on a different port than your hass port e.g 1880
2: Go to your hass.io Mosquitto Addon and set customize to true. After this follow the steps here under Access Control Lists (ACLs) and create the two files listed there with its content
3: create a file called bridge.conf (name doesnt matter) in the share\mosquitto folder where you put the files from step 2
4: fill the bridge.conf file with the following content and save it: (all commands and information is going over the thermostat topic. Nothing beside whats written in here will be send to max home automation mqtt server)

connection bridge
address YOUR_ADRESS:PORT
clientid max
try_private false
start_type automatic
topic # out 0 thermostat/ “”
topic # in 0 thermostat/ “”

5: restart the addon
6: enjoy

I will now figure out how I can add the Thermostats into Home Assistant. :slight_smile:

Edit: I got this basic setup working now with my Thermostat. You can change the temperatue in the manual mode. I could not figure out how to use the other modes like boost or schedule. If we want to use some schedule it is also possible to send it over mqtt. But I think we will need some sort of menu to make it possible. Please tell me if it works for you too and your suggestions.

climate:
  - platform: mqtt
    name: YOUR_NAME
    unique_id: YOUR_ID
    qos: 0
    retain: true
    send_if_off: true
    #initial: "20"
    current_temperature_topic: "thermostat/CUBE_ADDRESS/radiator thermostat/DEVICE_ADDRESS/set temperature"
    temperature_command_topic: "thermostat/CUBE_ADDRESS/set/DEVICE_ADDRESS/manual"
    availability_topic: "thermostat/CUBE_ADDRESS/radiator thermostat/DEVICE_ADDRESS/link"
    payload_available: "ok"
    payload_not_available: "error"
    #mode_state_topic: "thermostat/CUBE_ADDRESS/radiator thermostat/DEVICE_ADDRESS/mode"
    #mode_command_topic: "thermostat/CUBE_ADDRESS/radiator thermostat/DEVICE_ADDRESS/mode"

Thanks for your feedback.
I’ve tried to reproduce your config but mosquitto do not connect to max mqtt with a simple error message:
1573378408: Connecting bridge max_cube (max:1884)
1573378408: Socket error on client local.max, disconnecting.

Any idea how to solve this ?
I’m running hass, mosquitto and Max on docker.

edit: ok now it looks like the connexion is ok.
Didn’t notice “” caracters and I’ve replaced them with “”
Still need to configure the climate entity.
By CUBE_ADDRESS you mean his ip address ?

Sorry I didnt had time to answer faster. No I mean the CUBE_ADDRESS. Its the hex number you can see when Max Home Automation is running. See here under Adress http://www.dmitry-kazakov.de/ada/overview-screen-shot.png

Ok I’ve made some progress thanks to you:

  • platform: mqtt
    name: dorian_chauffage
    unique_id: dorian_chauffage
    retain: true
    temp_step: 0.5
    modes:
    • auto
    • heat
    • cool
    • ‘off’
      mode_state_topic: “thermostat/1803FC/radiator thermostat/180968/mode”
      mode_state_template: >-
      {% set values = { ‘automatic’:‘auto’, ‘boost’:‘heat’, ‘manual’:‘cool’, ‘vacation’:‘off’} %}
      {{ values[value] if value in values.keys() else ‘off’ }}
      current_temperature_topic: “thermostat/1803FC/radiator thermostat/180968/temperature”
      temperature_state_topic: “thermostat/1803FC/radiator thermostat/180968/set temperature”
      temperature_command_topic: “thermostat/1803FC/set/180968/automatic”
      availability_topic: “thermostat/1803FC/radiator thermostat/180968/link”
      payload_available: “ok”
      payload_not_available: “error”

There’s a lot of work to :

  • being able to change mode, because each mode is a different topic
  • find a way to change the temperature without changing the mode (actually I prefer to keep the automatic mode in case of manual change but it could be usefull to use manual mode instead sometimes).

And the last thing I’ve to understand it’s why hass does not seems to read correct values for states after a restart.


Actually correct values are 18.5, 17.5 and auto.
I’ve to change to a different value for mode and target t° and then hass ui is updated. (doesn’t work for the current t° of coures)
But on the web site of MAX! cube home automation I can read this:

All topics are retained, that means a client may subscribe to them at any time and get the latest values of.

Ok I’ve somthing working as I want.
First I’ve remove all retain flag from my hass config and reset my mqtt boker, now hass display the correct information just after a restart.

Here’s my climate config:

  - platform: mqtt
    unique_id: d_chauffage
    name: d_chauffage
    temp_step: 0.5
    min_temp: 12
    max_temp: 22
    modes:
      - auto
      - heat
      - cool
    mode_state_topic: "thermostat/1803FC/radiator thermostat/180968/mode"
    mode_command_topic: "temp/climate/max_mode/1803FC/180968"
    mode_state_template: >-
      {% set values = { 'automatic':'auto', 'boost':'heat',  'manual':'cool'} %}
      {{ values[value] if value in values.keys() else 'off' }}
    current_temperature_topic: "thermostat/1803FC/radiator thermostat/180968/temperature"
    temperature_state_topic: "thermostat/1803FC/radiator thermostat/180968/set temperature"
    temperature_command_topic: "thermostat/1803FC/set/180968/automatic"
    availability_topic: "thermostat/1803FC/radiator thermostat/180968/link"
    payload_available: "ok"
    payload_not_available: "error"

And I’ve found this post telling me how I can template mode command with a dummy intermediate topik and an automation, here’s the automation:

- alias: max_mode controller
  trigger:
    platform: mqtt
    topic: temp/climate/max_mode/#
  action:
    service: mqtt.publish
    data_template:
      topic: >
        {% set values = { "auto":"automatic", "heat":"boost", "cool":"manual"} %}
        thermostat/{{ trigger.topic[22:-7] }}/set/{{ trigger.topic[29:] }}/{{ values[trigger.payload] if trigger.payload in values.keys() else "automatic" }}
      payload: >
        {% set values = { "auto":"automatic", "heat":"boost", "cool":"manual"} %}
        {{ "eco" if trigger.payload == "cool" }}

Now when I click on heat it activate boost mode with the thermostat config.
When I click cool it activate manual mode with the eco temp thermostat config
And finally if i click auto the thermostat is back in automatic and with the scheduled temp at this moment.

For the temp setting, when I increase or decrease it I stay in automatic mode, doing it that way on the next scheduled change the thermostat will get back on the scheduled temp set in max home automation and do not stay in manual forever.

I agree that we need to find an alternate way of controling the valves, the current maxcube integration is not ideal and MAX Home Automation works pretty good.
We could push to get it working via an mqtt or http method, or enhange maxcube integration

Hi all together. I’m searching as well for stable solution to integrate the Max! components to hassio. Unfortunately all stuff I’ve already tried (Integration, homegear, max home automation by dmitry kazakov, …) didn’t work properly.

How do you guys handle this now?

I do it through the max home automation/mqtt solution described a few posts above, it works perfectly from a software point of view (no loss of cube configuration, I’ve lost the connection between the cube and max home automation a few times but it was fixed within a few minutes)

The issue I have is more hardware related: I lose frequently (several times a week) the link between the cube and one valve (not always the same) and a reboot fixes that so I scripted something with node red and a smart plug to automate it, and I have a very high battery consumption even though the cube is less than 4 or 5 meters of the valves…
Anybody with the same issue?

Yep, the connection between different devices got flaky here as well. Without any changes in configuration. I suppose the hardware is starting to fail. :frowning:

By the way, how do you manage the on/off of the boiler (for those with a boiler)?
At the beginning I was comparing the target temperature and current temperature, and activating the boiler when a room was more than 1° apart from the target temperature.

Then I reflected that the internal valves system should be managing this better, so I activate the boiler when the valves are open more than x% (or the sum of all valves is over a threshold)

However I find the behaviour a bit erratic, leading to overheating frequently some rooms… For example today I was over the target temperature by 0,5° since at least half hour and the valve was still open at 52%!

How do you manage this?

Hello.
Trying to replicate your guide to get my mosquitto bridged to MHA mqtt server, but when acces to the link explaining how to setup the ACL files seems to be missing. Please can you provide or replicate this info?

Thanks

1 Like