Viessmann OpenV vcontrold Client (Optolink)

I just ordered my D1 Mini and the resistors + LED’s. I am already looking forward to the tinkering project. :slight_smile:
I still have one question @jota29 : How do I get the addresses for the sensors. Is that visible in the log? Is there possibly an overview for this?
Unfortunately, this is not so easy for me to see in your pull request.

@CM000n, the addresses for the sensors depend on the type of the Vitotronic controlling unit of your boiler. It’s best to start without any sensor configuration with just the component initialization:

optolink:
  protocol: P300
  device_info: Device Info
  state: Component state

Eventually replace P300 with KW (this also depends on your boiler type).
If your DIY adapter works correctly, you should see a sensor “Device Info” in Home Assistant or the web interface of your ESP. The device info (4 digit-letter-combination) must match to one value in the line “Gerätekennung” of the table at Adressen · openv/openv Wiki · GitHub. If a value matches you find valid addresses for more sensor configurations in the lines below.
Be aware: the table has more columns than you see in the first moment. Scroll horizontally to see all devices.
Good luck!

P.S.: Take a look at the PR discussion (Optolink platform to integrate Viessmann heating units into Home Assistant by j0ta29 · Pull Request #4453 · esphome/esphome · GitHub) for more common problems (especially regarding the DIY adapter)

1 Like

Thank you very much for clarification! Will give it a try :slight_smile:

I can’t get it to work, unfortunately, and I don’t know if it’s my pathetic soldering skills or if one of the LEDs or resistors is defective. :frowning:
I have already checked my solder joints and the correct position of the anodes/cathodes and collectors/emitters several times (I don’t see any IR signal through my smart phone camera).
Unfortunately I can’t get a device_info read out. Both with KW, and with P300 protocol. And with different positions of the LEDs on the Viessmann connector.
Unfortunately I am at my wit’s end and do not know how I can debug it further better. :-/ Eventually I wait and hope until there maybe the first pre-mounted read heads available.

.::edit::.
I have now added a remote_transmitter for the SIR 204 EVL diode and a remote_receiver for the SFH 309 FA diode for debugging.

remote_receiver:
  pin: 
    number: GPIO3
    inverted: True
  dump:
    - raw

remote_transmitter:
  pin: GPIO1
  carrier_duty_percent: 50%

switch:
  - platform: template
    name: "Panasonic TV Off"
    turn_on_action:
      remote_transmitter.transmit_panasonic:
        address: 0x4004
        command: 0x100BCBD
        repeat:
          times: 5
          wait_time: 1s

With the smart phone camera I could now also see that the SIR 204 EVL is sending a signal. But the SFH 309 FA seems to receive no signal when I look at the ESP logs. I will now order a new SFH 309 FA and try it again.

Signal on:

Signal off:

Maybe this approach is also helpful for someone else to debug.
Perhaps we should also create a separate thread for OpenV with ESP Home @jota29 ? So that it is better known and we do not spam everything here. :smiley:

I ordered new components and tested it again with these. Unfortunately still without success. I give it up for now with it :frowning:

…::edit::…
Today I replaced the Wemos D1 Mini with a NodeMCUv2 I had lying around. And with that it worked right away :smiley:
Screenshot 2023-05-09 193619

Had an opportunity to try this out with a Viessman optolink. It is very good at getting values, but I haven’t had success in setting values. There also is a disparity in the get & set on the mode control in particular. This is what my mqtt/select looks like:

  - name: "Viessmann Operating Mode"
    unique_id: "vcontroldgetOperatingMode"
    state_topic: "openv/getBetriebArt"
    icon: mdi:water-boiler
    device:
      identifiers: vcontrold
      manufacturer: Viessmann
    command_topic: "openv/setBetriebArt"
    options:
      - "Heating & Domestic Hot Water"
      - "Domestic Hot Water"
      - "Reduced"
      - "Normal"
      - "Antifreeze"
      - "Shutdown"
    command_template: |-
      {% if value == 'Heating & Domestic Hot Water' %}
        H+WW
      {% elif value == 'Domestic Hot Water' %}
        WW
      {% elif value == 'Reduced' %}
        RED
      {% elif value == 'Normal' %}
        NORM
      {% elif value == 'Antifreeze' %}
        H+WW FS
      {% elif value == 'Shutdown' %}
        ABSCHALT
      {% endif %}
    value_template: |-
      {% if value == 'H+WW' %}
        "Heating & Domestic Hot Water"
      {% elif value == 'WW' %}
        "Domestic Hot Water"
      {% elif value == 'RED' %}
        Reduced
      {% elif value == 'NORM' %}
        Normal
      {% elif value == 'H+WW FS' %}
        Antifreeze
      {% elif value == 'ABSCHALT' %}
        Shutdown
      {% endif %}

This is based off the example (and translated to English) here.

Unfortunately, it does nothing. I also noticed that there is a disparity in the vito.xml in regards to setBetriebArt. There is “setBetriebArtM1” and also a “getBetriebArtM2” and “getBetriebArt”, but no “getBetriebArtM1”. Unfortunately, modifying my select to use “getBetriebArt” and “setBetriebArtM1” still has no effect on changing the mode of the Viessmann.

It would be nice if someone adapted the Vicare Integration to use vcontrold and optolink. The Vicare API has been notoriously unreliable for me. Right now it can’t connect at all, and of course, I hate using the cloud altogether.

@CM000n, glad to see that you finally got it to work. Unfortunately you are the second person that had problems with the Wemos D1 mini. A few minute ago I read in Optolink platform to integrate Viessmann heating units into Home Assistant by j0ta29 · Pull Request #4453 · esphome/esphome · GitHub that another guy had to replace the D1 mini with a esp32-s2-wroom.

Hi.
Do you already have a template or configuration with which you can set the heating times?
I would appreciate an example.
Thx.

Hi,

I did not dig through the whole thread but wanted to share my solution, maybe it helps someone. In my configuration, the vcontrold service runs on a different machine and HASSOS is running in a VM. At the time when implementing, I did not know how to use the vclient executable, so I wrote a python wrapper connecting via the network (currently only readout):

File: /config/python_scripts/gastherme.py

#!/usr/bin/python3
import sys
import telnetlib
import re

#start telnet to vcontrold
tn = telnetlib.Telnet("192.168.10.2",3002)
tn.read_until(b">")

value = 128.5
while value==128.5:
    tn.write(sys.argv[1].encode('ascii') + b"\n")
    value = round(float(re.findall('^(?!\s)-?\d+\.?\d*', (tn.read_until(b'vctrld>', timeout=5).decode('ascii')))[0]),1)
    if value < 100:
        print(value)
tn.write(b"quit\n")

In command_line.yaml I have:

- sensor:
    command: 'python3 /config/python_scripts/gastherme.py getTempWWist'
    name: "Warmwassertemperatur"
    unique_id: gastherme_warmwasseristtemperatur
    unit_of_measurement: "°C"
    scan_interval: 30
- sensor:
    command: 'python3 /config/python_scripts/gastherme.py getTempKist'
    name: "Kesseltemperatur"
    unique_id: gastherme_kesseltemperatur
    unit_of_measurement: "°C"
    scan_interval: 61
- sensor:
    command: 'python3 /config/python_scripts/gastherme.py getTempWWsoll'
    name: "Warmwassersolltemperatur"
    unique_id: gastherme_warmwassersolltemperatur
    unit_of_measurement: "°C"
    scan_interval: 301
- sensor:
    command: 'python3 /config/python_scripts/gastherme.py getTempAtp'
    name: "Außentemperatur TP"
    unique_id: gastherme_warmwasseraussentemperatur_tp
    unit_of_measurement: "°C"
    scan_interval: 299
- sensor:
    command: 'python3 /config/python_scripts/gastherme.py getTempStp'
    name: "Speichertemperatur TP"
    unique_id: gastherme_speichertemperatur_tp
    unit_of_measurement: "°C"
    scan_interval: 298
- sensor:
    command: 'python3 /config/python_scripts/gastherme.py getTempA'
    name: "Außentemperatur"
    unique_id: gastherme_aussentemperatur
    unit_of_measurement: "°C"
    scan_interval: 62

However, starting now I would for sure use the integration :slight_smile:

Hallo @steini86

This seems to be a very interesting solution. Especially since it allows to set individual scan intervals (in seconds?). Could you also expand your script on the set commands? I’m still looking for a solution to set heating schedules.
I am not a programmer, but the ‘vctrld>’ reads out the values, definied in the vito.xml?
Would it also be possible to read not only float values but also string values?

I have a similar configuration to yours. I use a Raspberry Pi in the heating room to retrieve data from the Vitodens 333 using vcontrold. Home Assistant on my server then fetches the data.

Hi @SSX ,
currently I do not plan to improve my python script although would also like to get more values and set things. As I said, before investing more time into this I will try the addon. IMHO it makes more sense if people focus on one working solution :slight_smile:

supports remote vcontrold like your setup.

Anyway, for your questions:

Yes, that’s in seconds

In principle, could be done. I would probably write a new python file just to send commands.

My guess is that this would work with the integration but I did not dig into this. Important is to set the payload correctly: like setTimerWWDi 06:10 9:30 17:30 20:40

That is part of the response when you connect. For debugging, you can just connect with telnet to the port, for example on your rpi:

# telnet localhost 3002
Trying ::1...
Trying 127.0.0.1...
Connected to localhost.
Escape character is '^]'.
vctrld>getTempWWist
40.5 Grad Celsius
vctrld>

So, the program first reads until > which is after the initialization of the connection. Then sends the command and reads until the next line “vctrld>” The value itself is extracted via regex: regex101: build, test, and debug regex

Yes, the regex needs to be adjusted accordingly. Easiest might be another python script which gets the string values. Use the telnet console to get your original readback, paste that into the regex101 website and adjust your regex until you have the correct output.

Good luck!

@steini86
Thank you for the response.
Yes, the adapter is working as expected. However, I wish it had an option for integrating that scan_interval feature.
The payload for the heating timer doesn’t work at all. I.e. this

select: 
    - name: "HZ01 Timer HZ Mo Sel"
      unique_id: "vcontroldgetTimerMoHeizen"
      state_topic: "openv/getTimerMoHeizen"
      device:
        identifiers: vcontrold
        manufacturer: Viessmann
      command_topic: "openv/setTimerMoHeizen"
      options:
        - "Zeit 1"
        - "Zeit 2"
      command_template: |-
        {% if value == 'Zeit 1' %}
        06:30 08:30 18:30 22:00
        {% elif value == 'Zeit 2' %}
        07:30 10:30 19:30 23:30
        {% endif %}

sends only the first “on”-time in the string “06:30”. It doesn’t send the other values.
Anyway, I hope that there will be a solution for that at some point as well.

Hi Simon
am struggeling at the same point. i don t get any data
are you also using the ESPhome projekt? or what code are you running on the esp?

I am currently (still) using the official Vitoconnect Hub, as we live here with my parents-in-law and my father-in-law would like to continue using the Viessmann app instead of Home Assistant. Some functions, such as setting timers for the heating circuit pumps, for example, cannot be implemented in Home Assistant or can only be implemented with difficulty.

However, it basically worked and I could read out the data. The problem for me was simply my Wemos D1 Mini. It just wouldn’t work with it. After I switched to a NodeMCU instead, it worked without any problems.

how can i use an external mqtt server in the local network and not the MQTT in the HA

Hey guys,

i desgined two housings for d1 mini clones (az delivery).
Maybe someone would like to use one of them.

This one is for using die V cutout like the original optolink:

This one is for mounting in the Vitotronic Lid:

Hello everyone,

I have a problem. After the last ESPHome update, the Viessmann Optolink update appeared.

Unfortunately, after starting the update, the process reports errors as below.
I will add that Optolink is still working (fortunately) and the update of the second ESP responsible for the DSC alarm went without a problem.

Please read breaking changes here:

Also review the documentation as there are some other things that have changed as well, e.g. the mapping for text sensors.

1 Like

Thank you much!
I have edited my yaml according to new requirements and it’s compile and all working fine.
By the way, I have a question about the new functions - DAY_SCHEDULE / _SYNCHRONIZED:

image

The description says: The mode DAY_SCHEDULE can be used to read daily schedule plans with On/Off time pairs, for example, to turn on or off heating or warm water. Each day of the week can have up to four time pairs. (…) The mode DAY_SCHEDULE_SYNCHRONIZED can be used to write a schedule plan back to the Viessmann unit.

Does this mean that if I want to display the heating plan for all days of the week, I have to prepare entries for each day separately? E.g. for Friday:

  • platform: optolink
    name: Heating schedule Friday
    mode: DAY_SCHEDULE
    day_of_week: FRIDAY
    address: 0x2000
    bytes: 56

Will all days be at the same address 0x2000?
Second question - what if I want to read (not save to the boiler) the warm water heating plan? Should I then enter the following entry in yaml:

  • platform: optolink
    name: Warm water schedule Friday
    mode: DAY_SCHEDULE
    day_of_week: FRIDAY
    address: ???
    bytes: 56

Thank you in advance.

I’d suggest to ask those questions in either the above PR discussion or on the author’s repo: Issues · j0ta29/esphome · GitHub