Controlling the UVR1611 with CMI via Home Assistant

I want to share how I managed to controll the UVR1611 with the CMI via HomeAssistant. Not only read the sensors (temperature, heating pump on/off) but also controlling the heating pump / the heating circuits. I am now even able to controll the heating weather dependent and don’t need to manually turn things on and off for saving a lot of heating costs. I think other models, which can be controlled via the CMI are also possible, but I can’t confirm that.

Step 1: CMI Online Portal

Make sure you are logged in via the CMI Online portal as the expert user for reading the sensor values and controlling the switches. Make sure to get access via the lan-ip-adress, not the online webadress.

Step 2: Get the UVR1611 sensor values to HomeAssistant

There are 2 possibilities for that:

Variant 1: (the new and way more simple and the recommended one)
Get the Custom Home Assistant integration to read data from a C.M.I.

When I tried to get the CMI to my HomeAssistant, there wasn’t this integration so I had to use a workaround with variant 2, but I would definitly recommend variant 1, because its way more simple.

Variant 2: (the old one and not the recommended one)
In my configuration.yaml I set:

rest:
  - authentication: basic
    username: "****"
    password: "****"
    scan_interval: 30
    resource: http://****:****@192.168.0.11/INCLUDE/api.cgi?jsonnode=3&jsonparam=I,O,Na,Nd
    sensor:
      - name: "cmi_og_3"
        value_template: '{{ value_json.cmi_og_3 }}'
        json_attributes:
          - "Header"
          - "Data"
          - "Status"     

Then in my templates.yaml I set:

- sensor:
    - name: "CMI OG 3 Status"
      state: '{{ states.sensor.cmi_og_3.attributes["Status"] }}'

- sensor:
    - name: "CMI OG Vorlauftemperatur Heizkreis Süden"
      state: '{{ states.sensor.cmi_og_3.attributes["Data"]["Inputs"][0]["Value"]["Value"] }}'

- sensor:
    - name: "CMI OG Vorlauftemperatur Heizkreis Norden"
      state: '{{ states.sensor.cmi_og_3.attributes["Data"]["Inputs"][1]["Value"]["Value"] }}'

- sensor:
    - name: "CMI OG Rücklauftemperatur Heizkreis"
      state: '{{ states.sensor.cmi_og_3.attributes["Data"]["Inputs"][3]["Value"]["Value"] }}'

- sensor:
    - name: "CMI OG Temperatur Aussen"
      state: '{{ states.sensor.cmi_og_3.attributes["Data"]["Inputs"][4]["Value"]["Value"] }}'

- sensor:
    - name: "CMI OG Temperatur Innen"
      state: '{{ states.sensor.cmi_og_3.attributes["Data"]["Inputs"][5]["Value"]["Value"] }}'

Again, that’s now unnecessarily because there is the custom integration for that, but I just wanted to share it here how I had done this without the integration.

Step 3: Rename the values to the correct term.

Just compare the values from the CMI with the new values from the imported ones in HomeAssistant and give them clear names.

That’s how it should look like in HA then:

image

So now we are able to READ the CMI values, but not controlling it. It took me ages to find a solution to controll the CMI via HomeAssistant. Finally I randomly read that comment from emign in the issues section from a different topic:

So you are able to controll the CMI via HTTP GET request and I knew you can do something like this without problems with NodeRed.

Step 4: Controll the CMI via HTTP GET requests in NodeRed in HA

In NodeRed there is the Node “http request”. image

Now we need to figure out which http adress switches for example the heating circuit to normal / abgesenkt / standby / zeit/auto .
Go to your CMI Online Portal (via local ip adress), then to your “Knoten” and then to “Funktionsübersicht”. Now activate the developer tools in Chrome.
You can see this:

Now we want to controll the heating circuit 1. So we press the double arrow button and now we can see on the right side all the things we need for the http adress:

The http adress should look like this: http://username:password@ipadress/menupage.cgi?page=0301580E&changeadr=039003301D&changeto=1

Get the menupage number, the changeadr number and the changeto number from the developer tool section.

We took this adress so the changeto number is 1 > so with that adress it will change the heatingt circuit to “Standby”. Now we put this inside the http request node in NodeRed and rename it.

Now we do this exact same thing with all the heating circuits and also for the heating pump:

Step 5: Creating and using input_booleans for controlling

Maybe there is a better method to make the switches but it works for me.
First you create all these helpers in HomeAssistant, one specific helper for one specific http request:

Second in NodeRed you need to setup the nodes so if you switch on the input_boolean for Heating pump On, the other input_booleans for the heating pump switches should turn off.

And now you can make a nice looking dashboard as a control center and start controlling your CMI.

Optional Step 6: Make your heating weather dependent

I’m still trying to figure out good ways to make the weather forecase more reliable, but this is what I got so far:

I’m using the Forecast Solar integration. Now I have my fictional Photovoltaik system. This gives me an estimated amount of kWh of fictional production and now I know how much approximately sun there will be the next day.

So I dont want to activate the heating pump today when the sun is shining the whole next day.
In NodeRed I created some nodes with conditions and in the end it looks like this:

Its definitly not perfect and I still trying to figure out the most effective way, but so far it works fine.

All in all I hope I could help someone! I’m not a developer, I’m just trying to get my whole Home smart as a hobby, so I think there is a better way for sure to controll the UVR1611 via Home Assistant but for me it works like a charm.

2 Likes

sadly I can’t get this to work in node red… when I put the url http://user:[email protected]/INCLUDE/change.cgi?changeadrx2=01000544141101&changetox2=1 in the browser on my Mac , everything works as expected. but when I follow your description in node red the http response node give me an OK but nothing happens on the uvr… I use an uvr16x2 and node red on raspberry pi. maybe you could help me out?

1 Like

Hi, I think TA changed their interface. My interface already looks different than the one in your pictures…


Also I think the url/script has changed. I found the “switch” responsible for the variable i am trying to change. However I can’t get a working URL together(Currently trying to run the URL in the browser to see if the var value changes).

I have the following information: menupagex.cgi#01035800 , fadresse=01165a05 , adresse = 11644140187 , possible values = EIN, AUS

Can anyone help pls? Thank you!

i can not connect to the CMI.

is there a log to check the problem?

how can i add more then 1 jsonnode? i have jsonnode 1,2,3,4 and 5. how should i insert all 5 jsonnode?

Hi,
I have also 4 nodes and integrated all of them in HA.

In my example I used the link "http://:@192.168.0.11/INCLUDE/api.cgi?jsonnode=3&jsonparam=I,O,Na,Nd.

So thats just the link for jsonnode 3.

Now you need to set these up for each node individually.
Node 1: http://:@192.168.0.11/INCLUDE/api.cgi?jsonnode=1&jsonparam=I,O,Na,Nd.
Node 2: http://:@192.168.0.11/INCLUDE/api.cgi?jsonnode=2&jsonparam=I,O,Na,Nd.

So for each node this: (thats for node 3)


rest:
  - authentication: basic
    username: "****"
    password: "****"
    scan_interval: 30
    resource: http://****:****@192.168.0.11/INCLUDE/api.cgi?jsonnode=3&jsonparam=I,O,Na,Nd
    sensor:
      - name: "cmi_og_3"
        value_template: '{{ value_json.cmi_og_3 }}'
        json_attributes:
          - "Header"
          - "Data"
          - "Status"     

Hope I could help! :slightly_smiling_face:

I also use the CMI to control my heatpump.

Try to integrate it but I am getting this screen :
WP

What can be wrong?

After the new version I am getting another error that it can not connect:

cmi1

After 3 times trying it is connecting, I have the values in HA.

Now lets try to control them…

FYI, in case of Interest:

1 Like

What about this URL?

http://user:[email protected]/menupagex.cgi?pagex2&changeadrx2=01000544141101&changetox2=1

It works in my browser, but nowhere else. :roll_eyes: Incidentally, I also use the UVR16x2.

hi actually i got it working using python requests.
the second url might be correct(allthough i set the outputs directly)
i made a session and set following header for the request
headers = {“X-Requested-With”: “XMLHttpRequest”, “Connection”: “keep-alive”,“Referer”:“<your_cmi>/menupagex.cgi?nodex2=<your_node>”}
also i had to append the timestamp in seconds converted to integer at the end

1 Like

Hi

Hey, that sounds great. I would love to try it out. Do you have a flow to test that you could post here?

well , actually i am planning to set up home assistant in the following weeks, so i am just evaluating the possibilities and i am quite new to the topic. but i have some python knowledge, and i saw that you can deploy python scripts.
so here is my test script , which is slightly modified, so i never testet this version, since i cut out my personal information :slight_smile:

from requests import Session, get
import time


def main():
    ta_address = "http://192.x.x.x"
    username = "admin"
    password = "xxx"
    with Session() as s:
        s.auth = (username, password)
        headers = {"X-Requested-With": "XMLHttpRequest", "Connection": "keep-alive","Referer":f"{ta_address}/menupagex.cgi?nodex2=01005800"}
        timestamp = int(time.time())
        # craft ta session
        print(timestamp)
        #retvar = s.get(f"{ta_address}/menupagex.cgi?nodex2=01005800#01045800",headers=headers)
        time.sleep(1)
        #retvar = s.get(f"{ta_address}/INCLUDE/devpagex.cgi?pagex2=01045800",headers=headers)
        #print(retvar.content)
        time.sleep(1)
        timestamp = int(time.time())
        retvar = s.get(
            f"{ta_address}/INCLUDE/change.cgi?changeadrx2=01000740DA1200&changetox2=1&_={timestamp}", headers=headers
        )
        print(retvar.content)
        timestamp = int(time.time())
       
        print(retvar.content)

        time.sleep(5)
        retvar = s.get(
            f"{ta_address}/INCLUDE/change.cgi?changeadrx2=01000740DA1201&changetox2=0&_={timestamp}", headers=headers
        )

if __name__ == "__main__":
    main()

btw whats a flow ? (sry i am new ^^)