Opentherm Gateway

Hi there,

I just switched from Domoticz to Hass but there is one thing i cant get to work is my OTGW.

is there a way to get it working?

info: http://otgw.tclcode.com/

Greetings Arco Veenhuizen

I was also looking for this, because i intend to buy the opentherm gateway, but homeassitant doesn’t support it yet.

I got this working, which was quite easy.

First, run the otmonitor and let it publish to an mqtt like mosquitto.
(Create an systemd file so I gets started at boot time.)

Second, create the mqtt sensors within home assistant, eg.:

    - platform: mqtt
      state_topic: "events/central_heating/otmonitor/boilerwatertemperature"
      name: "OTGW Boiler Water Temperature"
      unit_of_measurement: '°C'

Do you just use it as sensor or also for control purposes (basically all the thermostat functionality)? I now have the OTG plugin on a VERA hub which integrates as a thermostat in HASS but also not ideal.

Yes, I use both ways. But, you are limited to the otmonitors capabilities (mqtt subscription), which (as far as I know) only supports the setpoint override and pushing the outside temperature to the thermostat.

how do you control the setpoint?

I created a input_select with some values (0=reset, 15, 18, 20) and a automation that publishes the value to mosquito. The otmonitor will pick it up and will do the rest.

- alias: OTGW Override
  initial_state: true
  trigger:
    platform: state
    entity_id: input_select.otgw_override_select
  action:
    service: mqtt.publish
    data_template:
      topic: 'actions/otmonitor/setpoint'
      payload: '{{ trigger.to_state.state | round(1) }}'

thanks! i edited to build an slider here is how i did it:

automation:

  - alias: Set Thermostat Heat Target
  trigger:
    platform: state
    entity_id: input_slider.thermostat_heat_target
  action:
    service: mqtt.publish
    data_template:
      topic: "actions/otmonitor/setpoint"
      retain: true
      payload: '{{ states.input_slider.thermostat_heat_target.state }}'

  - alias: Set Thermostat Heat Target Slider
  trigger:
    platform: mqtt
    topic: "actions/otmonitor/setpoint"
  action:
    service: input_slider.select_value
    data_template:
      entity_id: input_slider.thermostat_heat_target
      value: '{{ trigger.payload }}'

configuration:

sensor:
  - platform: mqtt
    state_topic: "events/central_heating/otmonitor/roomtemperature"
    name: "OTGW roomtemperature"
    unit_of_measurement: '°C'

  - platform: mqtt
    state_topic: "events/central_heating/otmonitor/setpoint"
    name: "OTGW setpoint"
    unit_of_measurement: '°C'

input_slider:
  thermostat_heat_target:
  name: Set Heat Target
  min: 10
  max: 30
  step: 0.5

groups:

Thermostaat:
  name: Thermostaat
  entities:
  - sensor.OTGW_roomtemperature
  - sensor.OTGW_setpoint
  - input_slider.thermostat_heat_target
1 Like

I personally think a select is better for mobile use, also you need a 0 value for disabling the override and let the thermostat return back to his normal operations.

I’m looking to also add my opentherm gateway to hass but have little knowledge of systemd services.
Care to share how to setup the otmonitor to mqtt part also?
Thanks, greatly appreciate the help.

What MQTT broker are you using?
Anyone had succes with the embedded broker in home-assistant?

With the internal broker i have the following error.

[33m2017-11-22 20:59:32 WARNING (MainThread) [hbmqtt.broker] [MQTT-3.1.0-1] (client @=127.0.0.1:59987): Can’t read first packet an CONNECT: [MQTT-3.1.2-1] Incorrect protocol name: "MQIsdp"e[0m

I’m running Home Assisstant on Rancher/Docker. A separate container is running Mosquitto which works perfect.

Thanks for the information, I used your code to start with my own project in HA for OTGW.

I used climate, since I want the HA in full control of the Thermostat


climate:
  - platform: mqtt
    name: Thermostaat
    current_temperature_topic: events/central_heating/otmonitor/roomtemperature
    temperature_command_topic: actions/otmonitor/setpoint
    modes:
     - off
     - heat
     - auto
    min_temp: 15
    max_temp: 21
    target_temp: 17
    cold_tolerance: 0.3

Still a little busy with fine tuning the integration.

I’ve had no luck connecting otmonitor’s MQTT client to Home Assistant’s built-in MQTT broker, so I decided to create a simple python service to do it. It’s on github: https://github.com/martenjacobs/py-otgw-mqtt

I also had no luck with the embedded broker from HA with otmonitor, so i installed mosquitto and that is working well.
In the orginal otmonitor implementation i was missing the “override roomtemperature” as MQTT signal.

I also started to write my own code based on the raw messages from OTGW, but have no expierence yet in phyton (C++,C#, visual basic etc…) so i have a learning curve in pyhon to overwin first.

In your implementation the signal is available. :grinning::grinning::grinning:
Why not create a new climate component for HA without MQTT?
I would love to see the TCP/IP variant, because i am using an esp8266 for the connection with the OTGW

Hi Jodur,
In my use case, the MQTT client/OTGW host is on a separate machine than HASS, so writing a component wouldn’t really work without at least some code on the OTGW-side.
I guess that if you’re using an esp and connecting from your HASS host, a built-in component would seem better. However, I still think a better solution would be to connect to HASS from the esp. This way you could push data instead of pulling it, potentially reducing network load.
This does mean you’ll have to write a client for your esp (in C, probably). If you want to use my program, you could replace your esp module with a RPi Zero W. That one costs around €11 and has WiFi built-in.
I’m using the MQTT climate component to control my thermostat, and that works great.
I don’t have a good way to debug a TCP version, that’s why I didn’t build it yet.

Hi martenjacobs,

I would be better as you suggested that the MQTT client is running on the ESP.
This should be possible with micropyhton on the ESP. Perhaps your code could easily ported to use with micropython. I will also investigate this further.

I also tried the MQTT climate component, i do not permanent control the temperature from homeassistant. My thermostat has its own clock programm, and i only want to override the setpoint temporary. The gateway is supporting this with the <TT= xx> and the original otmonitor uses this command for the setpoint topic. After the next switchpoint of the thermostat the temperature setpoint is set back to the temperature that is set in the clock programm. The MQTT climate component doesn’t support this, so this is not really an option for me.

martenjacobs,

I have added the code for the tcp variant. (Your phyton framwork was universal, so it was very easy for me to fill in the tcp/ip variant, despite the lack of phyton knowledge yet. I am also new to github (used svn in the past when i was active in coding) so i am looking how to get these modifications to you. Also i wan to make a modification that for example the flame status is not send every time. This current programm create a large amount of data within homeassistant.

I agree that there should be a filter of some sort, to make sure we don’t send duplicate data. If you don’t want the flame data to take up space in your event database, you could simply not subscribe any listener to it. This way, while some traffic is generated (we’re talking less than a kB per minute), it’s not saved anywhere.
In my config, I can set the temperature from HASS, and override it again from my thermostat. This is my config:

climate otgw:
  - platform: mqtt
    name: "OTGW"
    modes:
      - auto
    current_temperature_topic: "value/otgw/room_temperature"
    temperature_command_topic: "set/otgw/room_setpoint/temporary"
    temperature_state_topic: "value/otgw/room_setpoint"