@nicx @Oeda @DaBrave
MQTT Version
Home Assistant API was not as reliable as MQTT. Thats why I changed from HA API back to MQTT.
Node-RED flow:
[{"id":"ba274593.eb9c3","type":"exec","z":"8de0db91.dbfb8","command":"vclient -h 127.0.0.1 -f /home/pi/vito.cmd -t /home/pi/vito.tmpl","addpay":false,"append":"","useSpawn":"false","timer":"20","oldrc":false,"name":"vclient","x":300,"y":100,"wires":[["f34067e1.c39208"],["66732856.e60e78"],[]]},{"id":"f34067e1.c39208","type":"split","z":"8de0db91.dbfb8","name":"","splt":"\\n","spltType":"str","arraySplt":1,"arraySpltType":"len","stream":false,"addname":"","x":510,"y":50,"wires":[["9044195b.488ba8"]]},{"id":"9044195b.488ba8","type":"switch","z":"8de0db91.dbfb8","name":"wenn status=OK","property":"payload","propertyType":"msg","rules":[{"t":"cont","v":"status=OK","vt":"str"}],"checkall":"true","repair":false,"outputs":1,"x":680,"y":50,"wires":[["cbb84867.abb29"]]},{"id":"cbb84867.abb29","type":"split","z":"8de0db91.dbfb8","name":"","splt":"|","spltType":"str","arraySplt":"1","arraySpltType":"len","stream":false,"addname":"","x":860,"y":50,"wires":[["170227b9.3c4628"]]},{"id":"97ae585c.1581a","type":"change","z":"8de0db91.dbfb8","name":"setze Topic, Payload","rules":[{"t":"set","p":"topic","pt":"msg","to":"payload.1","tot":"msg"},{"t":"set","p":"payload","pt":"msg","to":"payload.2","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":600,"y":100,"wires":[["8ec8fcdd.60f3f8"]]},{"id":"170227b9.3c4628","type":"join","z":"8de0db91.dbfb8","name":"zusammenfügen","mode":"custom","build":"object","property":"payload","propertyType":"msg","key":"parts.index","joiner":"\\n","joinerType":"str","accumulate":false,"timeout":"","count":"","reduceRight":false,"reduceExp":"","reduceInit":"","reduceInitType":"num","reduceFixup":"","x":1040,"y":50,"wires":[["97ae585c.1581a"]]},{"id":"cd133edc.60bda","type":"switch","z":"8de0db91.dbfb8","name":"prüfe Wert","property":"payload","propertyType":"msg","rules":[{"t":"btwn","v":"19","vt":"num","v2":"25","v2t":"num"}],"checkall":"true","repair":false,"outputs":1,"x":395,"y":425,"wires":[["8c3004c3.4c433"]]},{"id":"5a6a38d3.0d37a","type":"switch","z":"8de0db91.dbfb8","name":"prüfe Wert","property":"payload","propertyType":"msg","rules":[{"t":"eq","v":"Abschaltbetrieb","vt":"str"},{"t":"eq","v":"Nur Warmwasser","vt":"str"},{"t":"eq","v":"Heizen und Warmwasser","vt":"str"}],"checkall":"true","repair":false,"outputs":3,"x":395,"y":300,"wires":[["a09878fa.c88378"],["12533f04.caa781"],["7e08c4e3.01300c"]]},{"id":"b6cbe550.280828","type":"exec","z":"8de0db91.dbfb8","command":"vclient -h 127.0.0.1","addpay":true,"append":"","useSpawn":"false","timer":"","oldrc":false,"name":"vclient set raumtemp","x":800,"y":425,"wires":[["aa62a5ce.359838"],["3ff58df1.966782"],[]]},{"id":"12533f04.caa781","type":"exec","z":"8de0db91.dbfb8","command":"vclient -h 127.0.0.1 setBetriebsartTo1","addpay":false,"append":"","useSpawn":"false","timer":"","oldrc":false,"name":"vclient set mode 1","x":790,"y":300,"wires":[["aa62a5ce.359838"],["3ff58df1.966782"],[]]},{"id":"7e08c4e3.01300c","type":"exec","z":"8de0db91.dbfb8","command":"vclient -h 127.0.0.1 setBetriebsartTo2","addpay":false,"append":"","useSpawn":"false","timer":"","oldrc":false,"name":"vclient set mode 2","x":790,"y":350,"wires":[["aa62a5ce.359838"],["3ff58df1.966782"],[]]},{"id":"1f828981.683936","type":"inject","z":"8de0db91.dbfb8","name":"Intervall 2m","topic":"","payload":"","payloadType":"date","repeat":"120","crontab":"","once":false,"onceDelay":0.1,"x":120,"y":100,"wires":[["ba274593.eb9c3"]]},{"id":"66732856.e60e78","type":"change","z":"8de0db91.dbfb8","name":"setze Topic","rules":[{"t":"set","p":"topic","pt":"msg","to":"[Node-RED] (stderr) exec vclient get","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":595,"y":150,"wires":[["8cb1fcbd.0941c8"]]},{"id":"3ff58df1.966782","type":"change","z":"8de0db91.dbfb8","name":"setze Topic","rules":[{"t":"set","p":"topic","pt":"msg","to":"[Node-RED] (stderr) exec vclient set","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":1120,"y":400,"wires":[["f65ba7e4.eaec5"]]},{"id":"aa62a5ce.359838","type":"change","z":"8de0db91.dbfb8","name":"setze topic","rules":[{"t":"set","p":"topic","pt":"msg","to":"[Node-RED] (stdout) exec vclient set","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":1120,"y":350,"wires":[["d7e37a5e.5648f"]]},{"id":"ebfe7dd7.96d54","type":"mqtt out","z":"8de0db91.dbfb8","name":"vcontrold","topic":"","qos":"","retain":"true","broker":"9fdfaef3.5aff18","x":1310,"y":100,"wires":[]},{"id":"d7e37a5e.5648f","type":"debug","z":"8de0db91.dbfb8","name":"","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","x":1320,"y":350,"wires":[]},{"id":"f65ba7e4.eaec5","type":"debug","z":"8de0db91.dbfb8","name":"","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","x":1320,"y":400,"wires":[]},{"id":"8cb1fcbd.0941c8","type":"debug","z":"8de0db91.dbfb8","name":"","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","x":1320,"y":150,"wires":[]},{"id":"ba79eec2.9aebd","type":"mqtt in","z":"8de0db91.dbfb8","name":"setze RaumSollTemp","topic":"vcontrold/setzeraumnormalsolltemp","qos":"0","datatype":"auto","broker":"9fdfaef3.5aff18","x":150,"y":425,"wires":[["cd133edc.60bda"]]},{"id":"8a439c8b.511c18","type":"change","z":"8de0db91.dbfb8","name":"setze Topic Prefix","rules":[{"t":"set","p":"topic","pt":"msg","to":"\"vcontrold/\" & topic","tot":"jsonata"}],"action":"","property":"","from":"","to":"","reg":false,"x":1015,"y":100,"wires":[["ebfe7dd7.96d54"]]},{"id":"8ec8fcdd.60f3f8","type":"change","z":"8de0db91.dbfb8","name":"lösche Payload","rules":[{"t":"delete","p":"rc","pt":"msg"},{"t":"delete","p":"parts","pt":"msg"},{"t":"delete","p":"status","pt":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":805,"y":100,"wires":[["8a439c8b.511c18"]]},{"id":"c9edc887.d3f918","type":"mqtt in","z":"8de0db91.dbfb8","name":"setze Betriebsart","topic":"vcontrold/setzebetriebsart","qos":"0","datatype":"auto","broker":"9fdfaef3.5aff18","x":130,"y":300,"wires":[["5a6a38d3.0d37a"]]},{"id":"a09878fa.c88378","type":"exec","z":"8de0db91.dbfb8","command":"vclient -h 127.0.0.1 setBetriebsartTo0","addpay":false,"append":"","useSpawn":"false","timer":"","oldrc":false,"name":"vclient set mode 0","x":790,"y":250,"wires":[["aa62a5ce.359838"],["3ff58df1.966782"],[]]},{"id":"c0641354.cd0d8","type":"switch","z":"8de0db91.dbfb8","name":"prüfe Wert","property":"payload","propertyType":"msg","rules":[{"t":"btwn","v":"50","vt":"num","v2":"60","v2t":"num"}],"checkall":"true","repair":false,"outputs":1,"x":395,"y":500,"wires":[["a6559749.c5e548"]]},{"id":"ebf381e1.3f6c08","type":"exec","z":"8de0db91.dbfb8","command":"vclient -h 127.0.0.1","addpay":true,"append":"","useSpawn":"false","timer":"","oldrc":false,"name":"vclient set warmwassertemp","x":820,"y":500,"wires":[["aa62a5ce.359838"],["3ff58df1.966782"],[]]},{"id":"e8517dd7.83d888","type":"mqtt in","z":"8de0db91.dbfb8","name":"setze WarmwasserSollTemp","topic":"vcontrold/setzewarmwassersolltemp","qos":"0","datatype":"auto","broker":"9fdfaef3.5aff18","x":170,"y":500,"wires":[["c0641354.cd0d8"]]},{"id":"8c3004c3.4c433","type":"template","z":"8de0db91.dbfb8","name":"setze Vorlage","field":"payload","fieldType":"msg","format":"handlebars","syntax":"mustache","template":"'setTempRaumNormalSoll {{payload}}'","output":"str","x":580,"y":425,"wires":[["b6cbe550.280828"]]},{"id":"a6559749.c5e548","type":"template","z":"8de0db91.dbfb8","name":"setze Vorlage","field":"payload","fieldType":"msg","format":"handlebars","syntax":"mustache","template":"'setTempWarmwasserSoll {{payload}}'","output":"str","x":580,"y":500,"wires":[["ebf381e1.3f6c08"]]},{"id":"9fdfaef3.5aff18","type":"mqtt-broker","z":"","name":"Mosquitto","broker":"192.168.8.41","port":"1883","clientid":"Node-RED","usetls":false,"compatmode":false,"keepalive":"60","cleansession":true,"birthTopic":"vcontrold/status","birthQos":"0","birthRetain":"true","birthPayload":"online","closeTopic":"vcontrold/status","closeQos":"0","closeRetain":"true","closePayload":"offline","willTopic":"","willQos":"0","willRetain":"false","willPayload":""}]
vito.cmd
getTempAussen
getTempVorlaufSoll
getTempVorlauf
getTempKesselSoll
getTempKessel
getHeizkreisPumpeDrehzahl
getBrennerStarts
getBrennerStunden
getTempWarmwasserSoll
getTempWasserSpeicher
getSammelstoerung
getBetriebsart
getBrennerStatus
getTempRaumNormalSoll
vito.tmpl
status=$E1|aussentemp|$1
status=$E2|vorlaufsolltemp|$2
status=$E3|vorlauftemp|$3
status=$E4|kesselsolltemp|$4
status=$E5|kesseltemp|$5
status=$E6|heizkreispumpe|$6
status=$E7|brennerstarts|$7
status=$E8|brennerstunden|$8
status=$E9|warmwassersolltemp|$9
status=$E10|wasserspeichertemp|$10
status=$E11|sammelstorung|$11
status=$E12|betriebsart|$R12
status=$E13|brennerstatus|$R13
status=$E14|raumnormalsolltemp|$14
vclient is installed in the PATH (/usr/local/bin/vclient)
Home Assistant automations
- id: '1578843693638'
alias: 'Input: vcontrold aktualisiere Raumsolltemperatur'
description: ''
trigger:
- platform: mqtt
topic: vcontrold/raumnormalsolltemp
condition: []
action:
- data_template:
option: '{{ trigger.payload | round (0) }}'
entity_id: input_select.vcontrold_setzeraumnormalsolltemp
service: input_select.select_option
- id: '1583611170145'
alias: 'Input: vcontrold aktualisiere Warmwassertemperatur'
description: ''
trigger:
- platform: mqtt
topic: vcontrold/warmwassersolltemp
condition: []
action:
- data_template:
option: '{{ trigger.payload | round (0) }}'
entity_id: input_select.vcontrold_setzewarmwassersolltemp
service: input_select.select_option
- id: '1578844162160'
alias: 'Input: vcontrold aktualisiere Betriebsart'
description: ''
trigger:
- platform: mqtt
topic: vcontrold/betriebsart
condition: []
action:
- data_template:
entity_id: input_select.vitowifi_setbetriebsart
option: '{% if trigger.payload == "0" %}Abschaltbetrieb {% elif trigger.payload
== "1" %}Nur Warmwasser {% elif trigger.payload == "2" %}Heizen und Warmwasser
{% endif %}'
entity_id: input_select.vcontrold_setzebetriebsart
service: input_select.select_option
- id: '1583581603709'
alias: 'Input: vcontrold setze Raumsolltemperatur'
description: ''
trigger:
- entity_id: input_select.vcontrold_setzeraumnormalsolltemp
platform: state
condition: []
action:
- data_template:
payload: '{{ states(''input_select.vcontrold_setzeraumnormalsolltemp'')}}'
retain: false
topic: vcontrold/setzeraumnormalsolltemp
service: mqtt.publish
- id: '1583610827163'
alias: 'Input: vcontrold setze Warmwassertemperatur'
description: ''
trigger:
- entity_id: input_select.vcontrold_setzewarmwassersolltemp
platform: state
condition: []
action:
- data_template:
payload: '{{ states(''input_select.vcontrold_setzewarmwassersolltemp'')}}'
retain: false
topic: vcontrold/setzewarmwassersolltemp
service: mqtt.publish
- id: '1583582442942'
alias: 'Input: vcontrold setze Betriebsart'
description: ''
trigger:
- entity_id: input_select.vcontrold_setzebetriebsart
platform: state
condition: []
action:
- data_template:
payload: '{{ states(''input_select.vcontrold_setzebetriebsart'')}}'
retain: false
topic: vcontrold/setzebetriebsart
service: mqtt.publish
And the MQTT sensors
- platform: mqtt
name: vcontrold_aussentemp
state_topic: "vcontrold/aussentemp"
availability_topic: "vcontrold/status"
value_template: "{{ value | round(1) }}"
unit_of_measurement: '°C'
device_class: temperature
- platform: mqtt
name: vcontrold_vorlaufsolltemp
state_topic: "vcontrold/vorlaufsolltemp"
availability_topic: "vcontrold/status"
value_template: "{{ value | round(0) }}"
unit_of_measurement: '°C'
device_class: temperature
- platform: mqtt
name: vcontrold_vorlauftemp
state_topic: "vcontrold/vorlauftemp"
availability_topic: "vcontrold/status"
value_template: "{{ value | round(1) }}"
unit_of_measurement: '°C'
device_class: temperature
- platform: mqtt
name: vcontrold_kesselsolltemp
state_topic: "vcontrold/kesselsolltemp"
availability_topic: "vcontrold/status"
value_template: "{{ value | round(0) }}"
unit_of_measurement: '°C'
device_class: temperature
- platform: mqtt
name: vcontrold_kesseltemp
state_topic: "vcontrold/kesseltemp"
availability_topic: "vcontrold/status"
value_template: "{{ value | round(1) }}"
unit_of_measurement: '°C'
device_class: temperature
- platform: mqtt
name: vcontrold_betriebsart
state_topic: "vcontrold/betriebsart"
availability_topic: "vcontrold/status"
value_template: >
{% if value == '0' %} Abschaltbetrieb
{% elif value == '1' %} Nur Warmwasser
{% elif value == '2' %} Heizen und Warmwasser
{% elif value == '3' %} Dauernd Reduziertbetrieb
{% elif value == '4' %} Dauernd Normalbetrieb
{% endif %}
icon: mdi:settings
- platform: mqtt
name: vcontrold_raumnormalsolltemp
state_topic: "vcontrold/raumnormalsolltemp"
availability_topic: "vcontrold/status"
value_template: "{{ value | round(0) }}"
unit_of_measurement: '°C'
device_class: temperature
- platform: mqtt
name: vcontrold_warmwassersolltemp
state_topic: "vcontrold/warmwassersolltemp"
availability_topic: "vcontrold/status"
value_template: "{{ value | round(0) }}"
unit_of_measurement: '°C'
device_class: temperature
- platform: mqtt
name: vcontrold_wasserspeichertemp
state_topic: "vcontrold/wasserspeichertemp"
availability_topic: "vcontrold/status"
value_template: "{{ value | round(1) }}"
unit_of_measurement: '°C'
device_class: temperature
- platform: mqtt
name: vcontrold_brennerstarts
state_topic: "vcontrold/brennerstarts"
availability_topic: "vcontrold/status"
value_template: "{{ value | round(0) }}"
unit_of_measurement: 'Starts'
icon: mdi:fire
- platform: mqtt
name: vcontrold_brennerstatus
state_topic: "vcontrold/brennerstatus"
availability_topic: "vcontrold/status"
value_template: "{{ value | round(0) }}"
unit_of_measurement: '%'
icon: mdi:fire
- platform: mqtt
name: vcontrold_brennerstunden
state_topic: "vcontrold/brennerstunden"
availability_topic: "vcontrold/status"
value_template: "{{ value | round(0) }}"
unit_of_measurement: 'Stunden'
icon: mdi:fire