As stated in my previous post, I report via MQTT directly from the NodeMCU on the Nodo-shop Opentherm Gateway to my Home Assistant installation. I use Tasmota (
https://tasmota.github.io/docs/#/Home) on the NodeMCU which has all required functionality already built-in. All that was necessary was to configure the serial port and the reset line and to specify two rules. One rule to initialize the system on boot and one to report the status of the OpenTherm Gateway every minute. As stated before I use the response to the PS=1 command to report the status. Much easier than processing each individual message from the gateway. Issuing commands to the gateway can be done from Home Assistant by publishing a serialsend command via MQTT.
The configuration template is:
template {"NAME":"OTGW","GPIO":[255,148,255,149,255,255,255,255,255,255,21,255,56],"FLAG":15,"BASE":18}
The rules are:
rule1 ON system#boot DO backlog power1 0; baudrate 9600; delay 10; power1 1; delay 10; serialsend3 \r; delay 10; serialsend3 GW=R\r; delay 10; serialsend3 PS=1\r ENDON
rule2 ON Time#Minute|1 DO SerialSend3 PS=1\r ENDON
In Home Assistant I use an MQTT sensor to receive the response and a template sensor to decode the response into status information
Code: Select all
- platform: mqtt
name: OpenTherm Gateway
availability_topic: "tele/tasmota-cv/LWT"
payload_available: "Online"
payload_not_available: "Offline"
state_topic: tele/tasmota-cv/RESULT
value_template: "{{ value_json.SerialReceived }}"
icon: mdi:radiator
- platform: template
sensors:
opentherm:
friendly_name: Opentherm OTGW
entity_id: sensor.opentherm_gateway
availability_template: >-
{{ states('sensor.opentherm_gateway')[0] == 'P' }}
icon_template: mdi:radiator
value_template: >-
{% if states('sensor.opentherm_gateway')[23] == '1' %}
Fout
{% else %}
OK
{% endif %}
attribute_templates:
cv_aan: >-
{% if states('sensor.opentherm_gateway')[14] == '1' %}
Ja
{% else %}
Nee
{% endif %}
ww_aan: >-
{% if states('sensor.opentherm_gateway')[13] == '1' %}
Ja
{% else %}
Nee
{% endif %}
cv_actief: >-
{% if states('sensor.opentherm_gateway')[22] == '1' %}
Actief
{% else %}
Uit
{% endif %}
ww_actief: >-
{% if states('sensor.opentherm_gateway')[21] == '1' %}
Actief
{% else %}
Uit
{% endif %}
brander: >-
{% if states('sensor.opentherm_gateway')[20] == '1' %}
Actief
{% else %}
Uit
{% endif %}
cv_instelling: >-
{{ states('sensor.opentherm_gateway').split(',')[5] }}
kamer_temperatuur: >-
{{ states('sensor.opentherm_gateway').split(',')[8] }}
cv_water_instelling: >-
{{ states('sensor.opentherm_gateway').split(',')[1] }}
cv_water_temperatuur: >-
{{ states('sensor.opentherm_gateway').split(',')[9] }}
ww_temperatuur: >-
{{ states('sensor.opentherm_gateway').split(',')[10] }}
buiten_temperatuur: >-
{{ states('sensor.opentherm_gateway').split(',')[11] }}
ww_regelbereik: >-
{{ states('sensor.opentherm_gateway').split(',')[13] }}
cv_regelbereik: >-
{{ states('sensor.opentherm_gateway').split(',')[14] }}
ww_instelling: >-
{{ states('sensor.opentherm_gateway').split(',')[15] }}