Skip to content

Instantly share code, notes, and snippets.

@hnykda
Last active July 23, 2023 13:13
Show Gist options
  • Save hnykda/bbd1bc3b81bd5ab62efac1bda9547943 to your computer and use it in GitHub Desktop.
Save hnykda/bbd1bc3b81bd5ab62efac1bda9547943 to your computer and use it in GitHub Desktop.
- alias: "Set ventilation Mode Selector"
trigger:
platform: mqtt
topic: "ventilation/mode"
# entity_id: input_select.ventilation_mode
action:
service: input_select.select_option
target:
entity_id: input_select.ventilation_mode
data:
option: "{{ trigger.payload }}"
- alias: "Set Ventilation Mode"
trigger:
platform: state
entity_id: input_select.ventilation_mode
action:
service: mqtt.publish
data:
topic: "ventilation/mode"
retain: true
payload: "{{ states('input_select.ventilation_mode') }}"
- alias: "Set ventilation Bypass Mode Selector"
trigger:
platform: mqtt
topic: "ventilation/bypass_mode"
action:
service: input_select.select_option
target:
entity_id: input_select.ventilation_bypass_mode
data:
option: "{{ trigger.payload }}"
- alias: Set Ventilation Bypass Mode
description: If the flow speed is too high, bypass won't be manipulated due to the
bad design of the HRV (there is "flapping" / "turbulence" that damages the bypass
valve) - the bypass can be broken.
trigger:
- platform: state
entity_id: input_select.ventilation_bypass_mode
action:
- service: mqtt.publish
data:
topic: ventilation/bypass_mode
retain: true
payload: '{{ states(''input_select.ventilation_bypass_mode'') }}'
- if:
- condition: numeric_state
entity_id: sensor.ventilation_flow_speed
below: '230'
then:
- service: mqtt.publish
data:
topic: ventilation/bypass_mode
retain: true
payload: '{{ states(''input_select.ventilation_bypass_mode'') }}'
else:
- service: notify.persistent_notification
data:
title: Not manipulating bypass due to too high flow speed.
message: If you want to manipulate the bypass, you have to first lower the
speed.
- alias: Reset ventilation publish filters after HA start
description: >-
Activates reset node in Nodered to force-publish all values again on the next
tik
trigger:
- platform: homeassistant
event: start
action:
- delay:
hours: 0
minutes: 1
seconds: 0
milliseconds: 0
- service: mqtt.publish
data:
topic: ventilation/_reset_publish_filters
initial_state: 'on'
mode: single
- alias: Increase ventilation mode to max speed for brief period
description: 'mostly for UI'
trigger: null
condition: []
action:
- variables:
original_mode: '{{ states(''input_select.ventilation_mode'') }}'
- service: input_select.select_option
data:
option: max
target:
entity_id: input_select.ventilation_mode
- delay:
hours: 0
minutes: 20
seconds: 0
milliseconds: 0
- service: input_select.select_option
target:
entity_id: input_select.ventilation_mode
data:
option: '{{ original_mode }}'
mode: restart
- alias: Decrease ventilation mode for N minutes
description: 'mostly for UI'
trigger: null
action:
- variables:
original_mode: '{{ states(''input_select.ventilation_mode'') }}'
- service: input_select.select_option
data:
option: low
target:
entity_id: input_select.ventilation_mode
- delay:
hours: 0
minutes: 30
seconds: 0
milliseconds: 0
- service: input_select.select_option
target:
entity_id: input_select.ventilation_mode
data:
option: '{{ original_mode }}'
mode: restart
mqtt:
sensor:
- unique_id: "ventilation/supply_temperature"
name: "Ventilation Supply Temperature"
state_topic: "ventilation/supply_temperature"
unit_of_measurement: "°C"
value_template: "{{ value }}"
- unique_id: "ventilation/output_temperature"
name: "Ventilation Output Temperature"
state_topic: "ventilation/output_temperature"
unit_of_measurement: "°C"
value_template: "{{ value }}"
- unique_id: "ventilation/outside_temperature"
name: "Ventilation Outside Temperature"
state_topic: "ventilation/outside_temperature"
unit_of_measurement: "°C"
value_template: "{{ value }}"
- unique_id: "ventilation/supply_humidity"
name: "Ventilation Supply Humidity"
state_topic: "ventilation/supply_humidity"
unit_of_measurement: "%"
value_template: "{{ value }}"
- unique_id: "ventilation/output_humidity"
name: "Ventilation Output Humidity"
state_topic: "ventilation/output_humidity"
unit_of_measurement: "%"
value_template: "{{ value }}"
- unique_id: "ventilation/flow_speed"
name: "Ventilation Flow Speed"
state_topic: "ventilation/flow_speed"
unit_of_measurement: "m3"
value_template: "{{ value }}"
- unique_id: "ventilation/flow_speed_pct"
name: "Ventilation Flow Speed Percentages"
state_topic: "ventilation/flow_speed_pct"
unit_of_measurement: "%"
value_template: "{{ value }}"
- unique_id: "ventilation/bypass_state"
name: "Ventilation Bypass State"
state_topic: "ventilation/bypass_state"
value_template: "{{ value }}"
- unique_id: "ventilation/preheater_state"
name: "Ventilation Preheater State"
state_topic: "ventilation/preheater_state"
value_template: "{{ value }}"
- unique_id: "ventilation/preheater_output"
unit_of_measurement: "%"
name: "Ventilation Preheater Output"
state_topic: "ventilation/preheater_output"
value_template: "{{ value }}"
- unique_id: "ventilation/filter_state"
name: "Ventilation Filter Status"
state_topic: "ventilation/filter_state"
value_template: "{{ value }}"
- unique_id: "ventilation/output_pressure"
name: "Ventilation Pressure Output"
state_topic: "ventilation/output_pressure"
unit_of_measurement: "pa"
- unique_id: "ventilation/input_pressure"
name: "Ventilation Pressure Input"
state_topic: "ventilation/input_pressure"
unit_of_measurement: "pa"
- unique_id: "ventilation/filter_usage"
name: "Filter Usage in Hours"
state_topic: "ventilation/filter_usage"
unit_of_measurement: "h"
value_template: "{{ value }}"
[{"id":"61755636.844f88","type":"tab","label":"Ventilation","disabled":false,"info":""},{"id":"720e809d.ed139","type":"modbus-read","z":"61755636.844f88","name":"Supply Temperature","topic":"","showStatusActivities":false,"logIOActivities":false,"showErrors":false,"unitid":"20","dataType":"InputRegister","adr":"4036","quantity":"1","rate":"1","rateUnit":"m","delayOnStart":false,"startDelayTime":"","server":"9270f483.3edde8","useIOFile":false,"ioFile":"","useIOForPayload":false,"emptyMsgOnFail":false,"x":170,"y":100,"wires":[[],["c7d65aa01f1fb8a0"]]},{"id":"1cccf2a4.6b6bdd","type":"mqtt out","z":"61755636.844f88","name":"","topic":"ventilation/supply_temperature","qos":"","retain":"","respTopic":"","contentType":"","userProps":"","correl":"","expiry":"","broker":"1b1e9157.0451ff","x":1030,"y":100,"wires":[]},{"id":"8cc7472a.b9b3d8","type":"mqtt out","z":"61755636.844f88","name":"","topic":"ventilation/outside_temperature","qos":"","retain":"","respTopic":"","contentType":"","userProps":"","correl":"","expiry":"","broker":"1b1e9157.0451ff","x":1030,"y":240,"wires":[]},{"id":"57495b84.6dcf24","type":"modbus-read","z":"61755636.844f88","name":"Outside Temperature","topic":"","showStatusActivities":false,"logIOActivities":false,"showErrors":false,"unitid":"20","dataType":"InputRegister","adr":"4081","quantity":"1","rate":"1","rateUnit":"m","delayOnStart":false,"startDelayTime":"","server":"9270f483.3edde8","useIOFile":false,"ioFile":"","useIOForPayload":false,"emptyMsgOnFail":false,"x":170,"y":240,"wires":[[],["a92fac1a5ae4e7a9"]]},{"id":"8c91642d.716a78","type":"modbus-read","z":"61755636.844f88","name":"Flow Speed","topic":"","showStatusActivities":false,"logIOActivities":false,"showErrors":false,"unitid":"20","dataType":"InputRegister","adr":"4042","quantity":"1","rate":"10","rateUnit":"s","delayOnStart":false,"startDelayTime":"","server":"9270f483.3edde8","useIOFile":false,"ioFile":"","useIOForPayload":false,"emptyMsgOnFail":false,"x":150,"y":360,"wires":[[],["49b645c0.5346dc"]]},{"id":"1ae9143b.306cac","type":"mqtt out","z":"61755636.844f88","name":"","topic":"ventilation/flow_speed","qos":"","retain":"","respTopic":"","contentType":"","userProps":"","correl":"","expiry":"","broker":"1b1e9157.0451ff","x":1000,"y":360,"wires":[]},{"id":"49b645c0.5346dc","type":"change","z":"61755636.844f88","name":"Flow Speed","rules":[{"t":"set","p":"payload","pt":"msg","to":"msg.payload.data[0]","tot":"jsonata"}],"action":"","property":"","from":"","to":"","reg":false,"x":410,"y":360,"wires":[["12e12cd3109e8823","4f1910d8bf39cbc3"]]},{"id":"525f542836999131","type":"modbus-read","z":"61755636.844f88","name":"Supply humidity","topic":"","showStatusActivities":false,"logIOActivities":false,"showErrors":false,"unitid":"20","dataType":"InputRegister","adr":"4037","quantity":"1","rate":"1","rateUnit":"m","delayOnStart":false,"startDelayTime":"","server":"9270f483.3edde8","useIOFile":false,"ioFile":"","useIOForPayload":false,"emptyMsgOnFail":false,"x":160,"y":180,"wires":[[],["fda2d7a29d240fce"]]},{"id":"6f76fa49b00a2d24","type":"mqtt out","z":"61755636.844f88","name":"","topic":"ventilation/supply_humidity","qos":"","retain":"","respTopic":"","contentType":"","userProps":"","correl":"","expiry":"","broker":"1b1e9157.0451ff","x":1020,"y":180,"wires":[]},{"id":"fda2d7a29d240fce","type":"change","z":"61755636.844f88","name":"","rules":[{"t":"set","p":"payload","pt":"msg","to":"$round(msg.payload.data[0],1)\t","tot":"jsonata"}],"action":"","property":"","from":"","to":"","reg":false,"x":420,"y":180,"wires":[["f083d45a57b87afb"]]},{"id":"1e67cfedb940f1b0","type":"modbus-read","z":"61755636.844f88","name":"Output humidity","topic":"","showStatusActivities":false,"logIOActivities":false,"showErrors":false,"unitid":"20","dataType":"InputRegister","adr":"4047","quantity":"1","rate":"1","rateUnit":"m","delayOnStart":false,"startDelayTime":"","server":"9270f483.3edde8","useIOFile":false,"ioFile":"","useIOForPayload":false,"emptyMsgOnFail":false,"x":160,"y":300,"wires":[[],["63dfe689d171e3ef"]]},{"id":"6461ce3bb09ea290","type":"mqtt out","z":"61755636.844f88","name":"","topic":"ventilation/output_humidity","qos":"","retain":"","respTopic":"","contentType":"","userProps":"","correl":"","expiry":"","broker":"1b1e9157.0451ff","x":1020,"y":300,"wires":[]},{"id":"63dfe689d171e3ef","type":"change","z":"61755636.844f88","name":"","rules":[{"t":"set","p":"payload","pt":"msg","to":"$round(msg.payload.data[0],1)\t","tot":"jsonata"}],"action":"","property":"","from":"","to":"","reg":false,"x":420,"y":300,"wires":[["cf7658565f29ee2e"]]},{"id":"f13178e847746e1f","type":"modbus-write","z":"61755636.844f88","name":"Write Mode","showStatusActivities":true,"showErrors":true,"unitid":"20","dataType":"HoldingRegister","adr":"8001","quantity":"1","server":"9270f483.3edde8","emptyMsgOnFail":false,"keepMsgProperties":false,"x":650,"y":960,"wires":[[],[]]},{"id":"6f71e75a8d07f85a","type":"mqtt in","z":"61755636.844f88","name":"","topic":"ventilation/mode","qos":"2","datatype":"utf8","broker":"1b1e9157.0451ff","nl":false,"rap":false,"x":100,"y":960,"wires":[["abda046bf47692bc"]]},{"id":"abda046bf47692bc","type":"change","z":"61755636.844f88","name":"Map modes to codes","rules":[{"t":"change","p":"payload","pt":"msg","from":"low","fromt":"str","to":"0","tot":"num"},{"t":"change","p":"payload","pt":"msg","from":"medium","fromt":"str","to":"1","tot":"num"},{"t":"change","p":"payload","pt":"msg","from":"high","fromt":"str","to":"2","tot":"num"},{"t":"change","p":"payload","pt":"msg","from":"max","fromt":"str","to":"3","tot":"num"}],"action":"","property":"","from":"","to":"","reg":false,"x":400,"y":960,"wires":[["f13178e847746e1f"]]},{"id":"e06591e8d6505dfa","type":"modbus-read","z":"61755636.844f88","name":"Ventilation mode read","topic":"","showStatusActivities":false,"logIOActivities":false,"showErrors":false,"unitid":"20","dataType":"HoldingRegister","adr":"8001","quantity":"1","rate":"1","rateUnit":"m","delayOnStart":false,"startDelayTime":"","server":"9270f483.3edde8","useIOFile":false,"ioFile":"","useIOForPayload":false,"emptyMsgOnFail":false,"x":140,"y":1020,"wires":[["b4398ed7c22c98b6"],[]]},{"id":"b4398ed7c22c98b6","type":"change","z":"61755636.844f88","name":"Map codes to modes","rules":[{"t":"change","p":"payload[0]","pt":"msg","from":"0","fromt":"num","to":"low","tot":"str"},{"t":"change","p":"payload[0]","pt":"msg","from":"1","fromt":"num","to":"medium","tot":"str"},{"t":"change","p":"payload[0]","pt":"msg","from":"2","fromt":"num","to":"high","tot":"str"},{"t":"change","p":"payload[0]","pt":"msg","from":"3","fromt":"num","to":"max","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":400,"y":1020,"wires":[["9adc45496c710891"]]},{"id":"84eb3cf9c5063613","type":"mqtt out","z":"61755636.844f88","name":"Publish mode to HA","topic":"ventilation/mode","qos":"","retain":"","respTopic":"","contentType":"","userProps":"","correl":"","expiry":"","broker":"1b1e9157.0451ff","x":1080,"y":1020,"wires":[]},{"id":"9adc45496c710891","type":"change","z":"61755636.844f88","name":"Set mode","rules":[{"t":"set","p":"payload","pt":"msg","to":"msg.payload[0]","tot":"jsonata"}],"action":"","property":"","from":"","to":"","reg":false,"x":640,"y":1020,"wires":[["87d0269ef6b835eb"]],"info":"just to get the number from the list"},{"id":"21b01bfeb56c7b9d","type":"mqtt out","z":"61755636.844f88","name":"","topic":"ventilation/output_temperature","qos":"","retain":"","respTopic":"","contentType":"","userProps":"","correl":"","expiry":"","broker":"1b1e9157.0451ff","x":1030,"y":480,"wires":[]},{"id":"7703aba136450c09","type":"modbus-read","z":"61755636.844f88","name":"Output Temperature","topic":"","showStatusActivities":false,"logIOActivities":false,"showErrors":false,"unitid":"20","dataType":"InputRegister","adr":"4046","quantity":"1","rate":"1","rateUnit":"m","delayOnStart":false,"startDelayTime":"","server":"9270f483.3edde8","useIOFile":false,"ioFile":"","useIOForPayload":false,"emptyMsgOnFail":false,"x":170,"y":480,"wires":[[],["92de04b2d01a9ca2"]]},{"id":"a4d406f56e612f10","type":"mqtt out","z":"61755636.844f88","name":"","topic":"ventilation/bypass_state","qos":"","retain":"","respTopic":"","contentType":"","userProps":"","correl":"","expiry":"","broker":"1b1e9157.0451ff","x":1050,"y":1100,"wires":[]},{"id":"82994afd1e1651f8","type":"modbus-read","z":"61755636.844f88","name":"Bypass state","topic":"","showStatusActivities":false,"logIOActivities":false,"showErrors":false,"unitid":"20","dataType":"InputRegister","adr":"4050","quantity":"1","rate":"1","rateUnit":"m","delayOnStart":false,"startDelayTime":"","server":"9270f483.3edde8","useIOFile":false,"ioFile":"","useIOForPayload":false,"emptyMsgOnFail":false,"x":110,"y":1100,"wires":[["fe044d4818cd2a37"],[]],"info":"0: inicializovat / 1: otevřený /\n2: zavřený / 3: otevřený / 4:\nzavřený / 255: chyba"},{"id":"773f943dfc6a9b0b","type":"mqtt out","z":"61755636.844f88","name":"","topic":"ventilation/bypass_mode","qos":"","retain":"","respTopic":"","contentType":"","userProps":"","correl":"","expiry":"","broker":"1b1e9157.0451ff","x":1030,"y":860,"wires":[]},{"id":"125fc8f55095dbac","type":"modbus-read","z":"61755636.844f88","name":"Bypass mode","topic":"","showStatusActivities":false,"logIOActivities":false,"showErrors":false,"unitid":"20","dataType":"HoldingRegister","adr":"6100","quantity":"1","rate":"1","rateUnit":"m","delayOnStart":false,"startDelayTime":"","server":"9270f483.3edde8","useIOFile":false,"ioFile":"","useIOForPayload":false,"emptyMsgOnFail":false,"x":110,"y":860,"wires":[["109b04f9d522fe05"],[]],"info":"0: Automatický\n1: Uzavřený obtok\n2: Otevřený obtok"},{"id":"f3204f9c4eecf384","type":"modbus-write","z":"61755636.844f88","name":"Write Bypass Mode","showStatusActivities":true,"showErrors":true,"unitid":"20","dataType":"HoldingRegister","adr":"6100","quantity":"1","server":"9270f483.3edde8","emptyMsgOnFail":false,"keepMsgProperties":false,"x":690,"y":800,"wires":[[],[]]},{"id":"418c5aed46ac5327","type":"mqtt in","z":"61755636.844f88","name":"","topic":"ventilation/bypass_mode","qos":"2","datatype":"utf8","broker":"1b1e9157.0451ff","nl":false,"rap":false,"x":150,"y":800,"wires":[["c551a9e6f62d7ae1"]]},{"id":"c551a9e6f62d7ae1","type":"change","z":"61755636.844f88","name":"Map modes to codes","rules":[{"t":"change","p":"payload","pt":"msg","from":"automatic","fromt":"str","to":"0","tot":"num"},{"t":"change","p":"payload","pt":"msg","from":"closed","fromt":"str","to":"1","tot":"num"},{"t":"change","p":"payload","pt":"msg","from":"open","fromt":"str","to":"2","tot":"num"}],"action":"","property":"","from":"","to":"","reg":false,"x":420,"y":800,"wires":[["f3204f9c4eecf384"]]},{"id":"109b04f9d522fe05","type":"change","z":"61755636.844f88","name":"Map codes to modes","rules":[{"t":"change","p":"payload[0]","pt":"msg","from":"0","fromt":"num","to":"automatic","tot":"str"},{"t":"change","p":"payload[0]","pt":"msg","from":"1","fromt":"num","to":"closed","tot":"str"},{"t":"change","p":"payload[0]","pt":"msg","from":"2","fromt":"num","to":"open","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":420,"y":860,"wires":[["8f8a6fec6769f8ee"]]},{"id":"8f8a6fec6769f8ee","type":"change","z":"61755636.844f88","name":"Set mode","rules":[{"t":"set","p":"payload","pt":"msg","to":"msg.payload[0]","tot":"jsonata"}],"action":"","property":"","from":"","to":"","reg":false,"x":660,"y":860,"wires":[["d7d453823c912298"]],"info":"just to get the number from the list"},{"id":"87d0269ef6b835eb","type":"rbe","z":"61755636.844f88","name":"","func":"rbe","gap":"","start":"","inout":"out","septopics":true,"property":"payload","topi":"topic","x":770,"y":1020,"wires":[["0ac1a77cf3ebce66"]]},{"id":"d7d453823c912298","type":"rbe","z":"61755636.844f88","name":"","func":"rbe","gap":"","start":"","inout":"out","septopics":true,"property":"payload","topi":"topic","x":790,"y":860,"wires":[["773f943dfc6a9b0b"]]},{"id":"6548f3f30f4783b3","type":"rbe","z":"61755636.844f88","name":"","func":"rbe","gap":"","start":"","inout":"out","septopics":true,"property":"payload","topi":"topic","x":770,"y":1100,"wires":[["a4d406f56e612f10"]]},{"id":"fe044d4818cd2a37","type":"change","z":"61755636.844f88","name":"Map codes to states","rules":[{"t":"change","p":"payload[0]","pt":"msg","from":"0","fromt":"num","to":"initializing","tot":"str"},{"t":"change","p":"payload[0]","pt":"msg","from":"1","fromt":"num","to":"open","tot":"str"},{"t":"change","p":"payload[0]","pt":"msg","from":"3","fromt":"num","to":"open","tot":"str"},{"t":"change","p":"payload[0]","pt":"msg","from":"2","fromt":"num","to":"closed","tot":"str"},{"t":"change","p":"payload[0]","pt":"msg","from":"4","fromt":"num","to":"closed","tot":"str"},{"t":"change","p":"payload[0]","pt":"msg","from":"255","fromt":"num","to":"error","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":340,"y":1100,"wires":[["460d536193a0f368"]],"info":"0: inicializovat / 1: otevřený /\n2: zavřený / 3: otevřený / 4:\nzavřený / 255: chyba"},{"id":"460d536193a0f368","type":"change","z":"61755636.844f88","name":"Set mode","rules":[{"t":"set","p":"payload","pt":"msg","to":"msg.payload[0]","tot":"jsonata"}],"action":"","property":"","from":"","to":"","reg":false,"x":520,"y":1100,"wires":[["6548f3f30f4783b3"]],"info":"just to get the number from the list"},{"id":"eeda98be59b81bcb","type":"inject","z":"61755636.844f88","d":true,"name":"Reseting filters every N minutes","props":[{"p":"reset","v":"true","vt":"bool"}],"repeat":"600","crontab":"","once":true,"onceDelay":"1","topic":"","x":160,"y":1320,"wires":[["87d0269ef6b835eb","d7d453823c912298","1dba9c6af0336c5e","6548f3f30f4783b3"]],"info":"Useful to make sure HA is in sync e.g. after the restart"},{"id":"c66b1bacd619f2c0","type":"modbus-write","z":"61755636.844f88","name":"Enable Modbus","showStatusActivities":true,"showErrors":true,"unitid":"20","dataType":"HoldingRegister","adr":"8000","quantity":"1","server":"9270f483.3edde8","emptyMsgOnFail":false,"keepMsgProperties":false,"x":960,"y":1520,"wires":[[],[]]},{"id":"07df10925507c5de","type":"inject","z":"61755636.844f88","name":"Enable modbus mode setting (only needs to be triggered once after disconnecting the device if not automatically below)","props":[{"p":"payload"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"0","payloadType":"num","x":420,"y":1520,"wires":[["c66b1bacd619f2c0"]]},{"id":"a2405a7f3d1d3435","type":"mqtt in","z":"61755636.844f88","name":"","topic":"ventilation/_reset_publish_filters","qos":"2","datatype":"utf8","broker":"1b1e9157.0451ff","nl":false,"rap":false,"x":130,"y":1220,"wires":[["5dd721427e058d57"]],"info":"If any message is published into this topic, it will reset the filters."},{"id":"4221f9284fa5488e","type":"change","z":"61755636.844f88","name":"Reset","rules":[{"t":"set","p":"reset","pt":"msg","to":"true","tot":"bool"}],"action":"","property":"","from":"","to":"","reg":false,"x":530,"y":1220,"wires":[["6548f3f30f4783b3","87d0269ef6b835eb","d7d453823c912298","f664010e418ee3d0","0da1d0e2d1853318","4f1910d8bf39cbc3","cf7658565f29ee2e","3576006b8d8316c2","f083d45a57b87afb","bb6afff892e70a66","1629f29cf4d559e4","1f611ab76e7d10fd","71e8d73961a3efa7","5c6f0b5c9bae3394","ae62d808a41fd831"]]},{"id":"5bb7ce3a01aeaa4e","type":"mqtt out","z":"61755636.844f88","name":"","topic":"ventilation/flow_speed_pct","qos":"","retain":"","respTopic":"","contentType":"","userProps":"","correl":"","expiry":"","broker":"1b1e9157.0451ff","x":1020,"y":420,"wires":[]},{"id":"12e12cd3109e8823","type":"change","z":"61755636.844f88","name":"flow_speed / 4","rules":[{"t":"set","p":"payload","pt":"msg","to":"$round(msg.payload / 4)","tot":"jsonata"}],"action":"","property":"","from":"","to":"","reg":false,"x":640,"y":420,"wires":[["0da1d0e2d1853318"]]},{"id":"0da1d0e2d1853318","type":"rbe","z":"61755636.844f88","name":"","func":"rbe","gap":"","start":"","inout":"out","septopics":true,"property":"payload","topi":"topic","x":810,"y":420,"wires":[["5bb7ce3a01aeaa4e"]]},{"id":"4f1910d8bf39cbc3","type":"rbe","z":"61755636.844f88","name":"","func":"rbe","gap":"","start":"","inout":"out","septopics":true,"property":"payload","topi":"topic","x":810,"y":360,"wires":[["1ae9143b.306cac"]]},{"id":"bb6afff892e70a66","type":"rbe","z":"61755636.844f88","name":"","func":"rbe","gap":"","start":"","inout":"out","septopics":true,"property":"payload","topi":"topic","x":650,"y":100,"wires":[["1cccf2a4.6b6bdd"]]},{"id":"f083d45a57b87afb","type":"rbe","z":"61755636.844f88","name":"","func":"rbe","gap":"","start":"","inout":"out","septopics":true,"property":"payload","topi":"topic","x":660,"y":180,"wires":[["6f76fa49b00a2d24"]]},{"id":"3576006b8d8316c2","type":"rbe","z":"61755636.844f88","name":"","func":"rbe","gap":"","start":"","inout":"out","septopics":true,"property":"payload","topi":"topic","x":660,"y":240,"wires":[["8cc7472a.b9b3d8"]]},{"id":"cf7658565f29ee2e","type":"rbe","z":"61755636.844f88","name":"","func":"rbe","gap":"","start":"","inout":"out","septopics":true,"property":"payload","topi":"topic","x":650,"y":300,"wires":[["6461ce3bb09ea290"]]},{"id":"f664010e418ee3d0","type":"rbe","z":"61755636.844f88","name":"","func":"rbe","gap":"","start":"","inout":"out","septopics":true,"property":"payload","topi":"topic","x":690,"y":480,"wires":[["21b01bfeb56c7b9d"]]},{"id":"e643912e9c7b9c05","type":"inject","z":"61755636.844f88","name":"Manual reset","props":[],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","x":110,"y":1280,"wires":[["4221f9284fa5488e","1dba9c6af0336c5e"]]},{"id":"4358af523fb1f4c0","type":"inject","z":"61755636.844f88","name":"Manual reset","props":[{"p":"reset","v":"true","vt":"bool"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","x":510,"y":1320,"wires":[["6548f3f30f4783b3","c0eb600c6ba1d674"]]},{"id":"0ac1a77cf3ebce66","type":"switch","z":"61755636.844f88","name":"","property":"payload","propertyType":"msg","rules":[{"t":"nnull"},{"t":"null"}],"checkall":"true","repair":false,"outputs":2,"x":910,"y":1020,"wires":[["84eb3cf9c5063613"],[]]},{"id":"5dd721427e058d57","type":"change","z":"61755636.844f88","name":"","rules":[{"t":"delete","p":"payload","pt":"msg"},{"t":"set","p":"reset","pt":"msg","to":"true","tot":"bool"}],"action":"","property":"","from":"","to":"","reg":false,"x":360,"y":1220,"wires":[["4221f9284fa5488e"]]},{"id":"25a216da171072fd","type":"mqtt out","z":"61755636.844f88","name":"","topic":"ventilation/preheater_state","qos":"","retain":"","respTopic":"","contentType":"","userProps":"","correl":"","expiry":"","broker":"1b1e9157.0451ff","x":1020,"y":560,"wires":[]},{"id":"4483ab23c32bb411","type":"modbus-read","z":"61755636.844f88","name":"Preheater state","topic":"","showStatusActivities":false,"logIOActivities":false,"showErrors":false,"unitid":"20","dataType":"InputRegister","adr":"4060","quantity":"1","rate":"1","rateUnit":"m","delayOnStart":false,"startDelayTime":"","server":"9270f483.3edde8","useIOFile":false,"ioFile":"","useIOForPayload":false,"emptyMsgOnFail":false,"x":160,"y":560,"wires":[["7711e20eac9937bf"],[]]},{"id":"1629f29cf4d559e4","type":"rbe","z":"61755636.844f88","name":"","func":"rbe","gap":"","start":"","inout":"out","septopics":true,"property":"payload","topi":"topic","x":690,"y":560,"wires":[["25a216da171072fd"]]},{"id":"f81b22cd7333dd01","type":"mqtt out","z":"61755636.844f88","name":"","topic":"ventilation/preheater_output","qos":"","retain":"","respTopic":"","contentType":"","userProps":"","correl":"","expiry":"","broker":"1b1e9157.0451ff","x":1020,"y":620,"wires":[]},{"id":"181e1715f6c11dbb","type":"modbus-read","z":"61755636.844f88","name":"Preheater output","topic":"","showStatusActivities":false,"logIOActivities":false,"showErrors":false,"unitid":"20","dataType":"InputRegister","adr":"4061","quantity":"1","rate":"1","rateUnit":"m","delayOnStart":false,"startDelayTime":"","server":"9270f483.3edde8","useIOFile":false,"ioFile":"","useIOForPayload":false,"emptyMsgOnFail":false,"x":160,"y":620,"wires":[[],["e4e9ff05071559fb"]]},{"id":"1f611ab76e7d10fd","type":"rbe","z":"61755636.844f88","name":"","func":"rbe","gap":"","start":"","inout":"out","septopics":true,"property":"payload","topi":"topic","x":690,"y":620,"wires":[["f81b22cd7333dd01"]]},{"id":"e4e9ff05071559fb","type":"change","z":"61755636.844f88","name":"","rules":[{"t":"set","p":"payload","pt":"msg","to":"$round(msg.payload.data[0],1)\t","tot":"jsonata"}],"action":"","property":"","from":"","to":"","reg":false,"x":420,"y":620,"wires":[["1f611ab76e7d10fd"]]},{"id":"7711e20eac9937bf","type":"change","z":"61755636.844f88","name":"Map codes to states","rules":[{"t":"change","p":"payload[0]","pt":"msg","from":"0","fromt":"num","to":"initializing","tot":"str"},{"t":"change","p":"payload[0]","pt":"msg","from":"1","fromt":"num","to":"inactive","tot":"str"},{"t":"change","p":"payload[0]","pt":"msg","from":"2","fromt":"num","to":"active","tot":"str"},{"t":"change","p":"payload[0]","pt":"msg","from":"3","fromt":"num","to":"testing","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":380,"y":560,"wires":[["fc45823424d6faad"]],"info":" - \"initializing\"\n - \"inactive\"\n - \"active\"\n - \"testing\""},{"id":"fc45823424d6faad","type":"change","z":"61755636.844f88","name":"Set mode","rules":[{"t":"set","p":"payload","pt":"msg","to":"msg.payload[0]","tot":"jsonata"}],"action":"","property":"","from":"","to":"","reg":false,"x":560,"y":560,"wires":[["1629f29cf4d559e4"]],"info":"just to get the number from the list"},{"id":"71e8d73961a3efa7","type":"debug","z":"61755636.844f88","name":"Filters reseted debug","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":850,"y":1320,"wires":[]},{"id":"5bdc16e47edcc568","type":"modbus-read","z":"61755636.844f88","name":"Modbus Status","topic":"","showStatusActivities":false,"logIOActivities":false,"showErrors":false,"unitid":"20","dataType":"HoldingRegister","adr":"8000","quantity":"1","rate":"3","rateUnit":"m","delayOnStart":true,"startDelayTime":"2","server":"9270f483.3edde8","useIOFile":false,"ioFile":"","useIOForPayload":false,"emptyMsgOnFail":false,"x":160,"y":1680,"wires":[["522da098473b29d6"],[]],"info":"0: inicializovat / 1: otevřený /\n2: zavřený / 3: otevřený / 4:\nzavřený / 255: chyba"},{"id":"522da098473b29d6","type":"switch","z":"61755636.844f88","name":"Only transmit if modbus is off","property":"payload[0]","propertyType":"msg","rules":[{"t":"eq","v":"0","vt":"num"}],"checkall":"true","repair":false,"outputs":1,"x":420,"y":1680,"wires":[["c5fbc54e6b99dfef"]],"info":"modbusOvladani = {0: \"vypnute\", 1: \"ovladaci spinac modbus\", 2: \"hodnota ovladani prutoku modbus\"}"},{"id":"c5fbc54e6b99dfef","type":"change","z":"61755636.844f88","name":"Set modbus to 1","rules":[{"t":"set","p":"payload","pt":"msg","to":"1","tot":"num"}],"action":"","property":"","from":"","to":"","reg":false,"x":680,"y":1680,"wires":[["c66b1bacd619f2c0"]]},{"id":"a92fac1a5ae4e7a9","type":"function","z":"61755636.844f88","name":"raw2temp","func":"var orig_value = msg.payload.data[0];\n\nconst INT_SIZE = 65536;\nconst NEGATIVE_THRESHOLD = 60000;\n\nvar value = orig_value\n// if the number is bigger than NEGATIVE_THRESHOLD\n// substract it from INT_SIZE with negative sign\nif (orig_value > NEGATIVE_THRESHOLD) {\n value = orig_value - INT_SIZE\n}\nvalue = value / 10;\n\nmsg.payload = value;\nreturn msg","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":420,"y":240,"wires":[["3576006b8d8316c2"]],"info":"It seems that negative values are being sent as positive integers starting at 2^16 (Uint16)."},{"id":"c7d65aa01f1fb8a0","type":"function","z":"61755636.844f88","name":"raw2temp","func":"var orig_value = msg.payload.data[0];\n\nconst INT_SIZE = 65536;\nconst NEGATIVE_THRESHOLD = 60000;\n\nvar value = orig_value\n// if the number is bigger than NEGATIVE_THRESHOLD\n// substract it from INT_SIZE with negative sign\nif (orig_value > NEGATIVE_THRESHOLD) {\n value = orig_value - INT_SIZE\n}\nvalue = value / 10;\n\nmsg.payload = value;\nreturn msg","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":420,"y":100,"wires":[["bb6afff892e70a66"]],"info":"It seems that negative values are being sent as positive integers starting at 2^16 (Uint16)."},{"id":"92de04b2d01a9ca2","type":"function","z":"61755636.844f88","name":"raw2temp","func":"var orig_value = msg.payload.data[0];\n\nconst INT_SIZE = 65536;\nconst NEGATIVE_THRESHOLD = 60000;\n\nvar value = orig_value\n// if the number is bigger than NEGATIVE_THRESHOLD\n// substract it from INT_SIZE with negative sign\nif (orig_value > NEGATIVE_THRESHOLD) {\n value = orig_value - INT_SIZE\n}\nvalue = value / 10;\n\nmsg.payload = value;\nreturn msg","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":420,"y":480,"wires":[["f664010e418ee3d0"]],"info":"It seems that negative values are being sent as positive integers starting at 2^16 (Uint16)."},{"id":"226b2a1e489a959d","type":"modbus-read","z":"61755636.844f88","name":"Filter state","topic":"","showStatusActivities":false,"logIOActivities":false,"showErrors":false,"unitid":"20","dataType":"InputRegister","adr":"4100","quantity":"1","rate":"12","rateUnit":"h","delayOnStart":false,"startDelayTime":"","server":"9270f483.3edde8","useIOFile":false,"ioFile":"","useIOForPayload":false,"emptyMsgOnFail":false,"x":100,"y":1160,"wires":[["437461899adebc9e"],[]],"info":"0: inicializovat / 1: otevřený /\n2: zavřený / 3: otevřený / 4:\nzavřený / 255: chyba"},{"id":"1dba9c6af0336c5e","type":"rbe","z":"61755636.844f88","name":"","func":"rbe","gap":"","start":"","inout":"out","septopics":true,"property":"payload","topi":"topic","x":810,"y":1180,"wires":[["0b9acbdb43506845"]]},{"id":"437461899adebc9e","type":"change","z":"61755636.844f88","name":"Map filter status codes to modes","rules":[{"t":"change","p":"payload[0]","pt":"msg","from":"0","fromt":"num","to":"clean","tot":"str"},{"t":"change","p":"payload[0]","pt":"msg","from":"1","fromt":"num","to":"dirty","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":370,"y":1160,"wires":[["a33e7fad8a0c1378"]]},{"id":"0b9acbdb43506845","type":"mqtt out","z":"61755636.844f88","name":"","topic":"ventilation/filter_state","qos":"","retain":"","respTopic":"","contentType":"","userProps":"","correl":"","expiry":"","broker":"1b1e9157.0451ff","x":1040,"y":1180,"wires":[]},{"id":"a33e7fad8a0c1378","type":"change","z":"61755636.844f88","name":"Set mode","rules":[{"t":"set","p":"payload","pt":"msg","to":"msg.payload[0]","tot":"jsonata"}],"action":"","property":"","from":"","to":"","reg":false,"x":600,"y":1160,"wires":[["1dba9c6af0336c5e"]],"info":"just to get the number from the list"},{"id":"29a7df596cef97e1","type":"modbus-read","z":"61755636.844f88","name":"Output pressure","topic":"","showStatusActivities":false,"logIOActivities":false,"showErrors":false,"unitid":"20","dataType":"InputRegister","adr":"4024","quantity":"1","rate":"5","rateUnit":"m","delayOnStart":false,"startDelayTime":"","server":"9270f483.3edde8","useIOFile":false,"ioFile":"","useIOForPayload":false,"emptyMsgOnFail":false,"x":160,"y":680,"wires":[[],["dca0dc0fec31138d"]]},{"id":"4ce6dab8b41a7ba7","type":"mqtt out","z":"61755636.844f88","name":"","topic":"ventilation/output_pressure","qos":"","retain":"","respTopic":"","contentType":"","userProps":"","correl":"","expiry":"","broker":"1b1e9157.0451ff","x":1020,"y":700,"wires":[]},{"id":"dca0dc0fec31138d","type":"change","z":"61755636.844f88","name":"","rules":[{"t":"set","p":"payload","pt":"msg","to":"$round(msg.payload.data[0],1)\t","tot":"jsonata"}],"action":"","property":"","from":"","to":"","reg":false,"x":420,"y":700,"wires":[["ae62d808a41fd831"]]},{"id":"ae62d808a41fd831","type":"rbe","z":"61755636.844f88","name":"","func":"rbe","gap":"","start":"","inout":"out","septopics":true,"property":"payload","topi":"topic","x":650,"y":700,"wires":[["4ce6dab8b41a7ba7"]]},{"id":"e27e9d79daeedcf2","type":"modbus-read","z":"61755636.844f88","name":"Input pressure","topic":"","showStatusActivities":false,"logIOActivities":false,"showErrors":false,"unitid":"20","dataType":"InputRegister","adr":"4023","quantity":"1","rate":"5","rateUnit":"m","delayOnStart":false,"startDelayTime":"","server":"9270f483.3edde8","useIOFile":false,"ioFile":"","useIOForPayload":false,"emptyMsgOnFail":false,"x":150,"y":740,"wires":[[],["d84dd92031b9428c"]]},{"id":"2523f6584de02528","type":"mqtt out","z":"61755636.844f88","name":"","topic":"ventilation/input_pressure","qos":"","retain":"","respTopic":"","contentType":"","userProps":"","correl":"","expiry":"","broker":"1b1e9157.0451ff","x":1010,"y":740,"wires":[]},{"id":"d84dd92031b9428c","type":"change","z":"61755636.844f88","name":"","rules":[{"t":"set","p":"payload","pt":"msg","to":"$round(msg.payload.data[0],1)\t","tot":"jsonata"}],"action":"","property":"","from":"","to":"","reg":false,"x":420,"y":740,"wires":[["5c6f0b5c9bae3394"]]},{"id":"5c6f0b5c9bae3394","type":"rbe","z":"61755636.844f88","name":"","func":"rbe","gap":"","start":"","inout":"out","septopics":true,"property":"payload","topi":"topic","x":650,"y":740,"wires":[["2523f6584de02528"]]},{"id":"c9fe265c3b700321","type":"modbus-write","z":"61755636.844f88","name":"Write Flow","showStatusActivities":true,"showErrors":true,"unitid":"20","dataType":"HoldingRegister","adr":"8002","quantity":"1","server":"9270f483.3edde8","emptyMsgOnFail":false,"keepMsgProperties":false,"x":670,"y":1440,"wires":[[],[]]},{"id":"bacbf97874ea95a3","type":"mqtt in","z":"61755636.844f88","name":"","topic":"ventilation/set_flow","qos":"2","datatype":"utf8","broker":"1b1e9157.0451ff","nl":false,"rap":false,"x":110,"y":1440,"wires":[["a37239f0a8597ae1"]]},{"id":"08d4d4e8120683cc","type":"debug","z":"61755636.844f88","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":670,"y":1400,"wires":[]},{"id":"a37239f0a8597ae1","type":"change","z":"61755636.844f88","name":"toint","rules":[{"t":"set","p":"payload","pt":"msg","to":"$number(payload)","tot":"jsonata"}],"action":"","property":"","from":"","to":"","reg":false,"x":350,"y":1440,"wires":[["08d4d4e8120683cc"]]},{"id":"ef9d9bb53406da9d","type":"mqtt out","z":"61755636.844f88","name":"","topic":"ventilation/filter_usage","qos":"","retain":"","respTopic":"","contentType":"","userProps":"","correl":"","expiry":"","broker":"1b1e9157.0451ff","x":960,"y":920,"wires":[]},{"id":"61e744a3a922a450","type":"modbus-read","z":"61755636.844f88","name":"Filter in hours","topic":"","showStatusActivities":false,"logIOActivities":false,"showErrors":false,"unitid":"20","dataType":"InputRegister","adr":"4115","quantity":"1","rate":"600","rateUnit":"m","delayOnStart":false,"startDelayTime":"","server":"9270f483.3edde8","useIOFile":false,"ioFile":"","useIOForPayload":false,"emptyMsgOnFail":false,"x":110,"y":920,"wires":[["0d19d893e1a65e79"],[]]},{"id":"c0eb600c6ba1d674","type":"rbe","z":"61755636.844f88","name":"","func":"rbe","gap":"","start":"","inout":"out","septopics":true,"property":"payload","topi":"topic","x":650,"y":920,"wires":[["ef9d9bb53406da9d"]]},{"id":"0d19d893e1a65e79","type":"change","z":"61755636.844f88","name":"get days","rules":[{"t":"set","p":"payload","pt":"msg","to":"$round(msg.payload[0] / 24)","tot":"jsonata"}],"action":"","property":"","from":"","to":"","reg":false,"x":400,"y":920,"wires":[["c0eb600c6ba1d674"]]},{"id":"9270f483.3edde8","type":"modbus-client","name":"Ventilation","clienttype":"serial","bufferCommands":true,"stateLogEnabled":true,"queueLogEnabled":true,"tcpHost":"127.0.0.1","tcpPort":"502","tcpType":"DEFAULT","serialPort":"/dev/ttyUSB0","serialType":"RTU-BUFFERD","serialBaudrate":"19200","serialDatabits":"8","serialStopbits":"1","serialParity":"even","serialConnectionDelay":"500","unit_id":"20","commandDelay":"10","clientTimeout":"1000","reconnectOnTimeout":true,"reconnectTimeout":"2000","parallelUnitIdsAllowed":false},{"id":"1b1e9157.0451ff","type":"mqtt-broker","name":"HomeAssistant","broker":"192.168.0.202","port":"1883","clientid":"","usetls":false,"compatmode":false,"protocolVersion":"5","keepalive":"60","cleansession":true,"birthTopic":"","birthQos":"0","birthPayload":"","birthMsg":{},"closeTopic":"","closeQos":"0","closePayload":"","closeMsg":{},"willTopic":"","willQos":"0","willPayload":"","willMsg":{},"sessionExpiry":""}]
- title: ventilation
path: ventilation
badges: []
cards:
- type: horizontal-stack
title: Set ventilation speed
cards:
- type: custom:button-card
styles:
card:
- height: 200px
icon: mdi:fan-off
size: 100%
show_state: true
name: low
state:
- operator: template
value: |
[[[
return states['input_select.ventilation_mode'].state == "low"
]]]
color: green
- operator: default
tap_action:
action: call-service
service: input_select.select_option
service_data:
option: low
entity_id: input_select.ventilation_mode
- type: custom:button-card
name: medium
styles:
card:
- height: 200px
icon: mdi:fan-speed-1
size: 100%
show_state: true
state:
- operator: template
value: |
[[[
return states['input_select.ventilation_mode'].state == "medium"
]]]
color: green
- operator: default
tap_action:
action: call-service
service: input_select.select_option
service_data:
option: medium
entity_id: input_select.ventilation_mode
- type: custom:button-card
styles:
card:
- height: 200px
icon: mdi:fan-speed-2
name: high
size: 100%
show_state: true
state:
- operator: template
value: |
[[[
return states['input_select.ventilation_mode'].state == "high"
]]]
color: green
- operator: default
tap_action:
action: call-service
service: input_select.select_option
service_data:
option: high
entity_id: input_select.ventilation_mode
- type: custom:button-card
styles:
card:
- height: 200px
icon: mdi:fan-speed-3
name: max
size: 100%
show_state: true
state:
- operator: template
value: |
[[[
return states['input_select.ventilation_mode'].state == "max"
]]]
color: green
- operator: default
tap_action:
action: call-service
service: input_select.select_option
service_data:
option: max
entity_id: input_select.ventilation_mode
- type: entities
entities:
- entity: input_select.ventilation_bypass_mode
- type: entities
entities:
- entity: sensor.ventilation_bypass_state
- entity: sensor.ventilation_flow_speed
- entity: sensor.ventilation_flow_speed_percentages
- entity: sensor.ventilation_outside_temperature
- entity: sensor.ventilation_supply_humidity
- entity: sensor.ventilation_supply_temperature
- entity: sensor.ventilation_output_humidity
- entity: sensor.ventilation_output_temperature
- type: horizontal-stack
title: Override vent for 30 mins
cards:
- type: custom:button-card
styles:
card:
- height: 200px
icon: mdi:fan-chevron-down
size: 100%
show_state: true
show_label: true
label: |
[[[
return 'Low speed ' + ((states['input_select.ventilation_mode'].state == 'low') ? 'activated' : 'deactivated');
]]]
state:
- operator: template
value: |
[[[
return states['input_select.ventilation_mode'].state == "low"
]]]
color: green
- operator: default
color: black
tap_action:
action: call-service
service: automation.trigger
service_data:
entity_id: automation.decrease_ventilation_mode_for_n_minutes
- type: custom:button-card
icon: mdi:fan-chevron-up
size: 100%
styles:
card:
- height: 200px
show_state: true
show_label: true
label: |
[[[
return 'Max speed ' + ((states['input_select.ventilation_mode'].state == 'max') ? 'activated' : 'deactivated');
]]]
state:
- operator: template
value: |
[[[
return states['input_select.ventilation_mode'].state == "max"
]]]
color: green
- operator: default
tap_action:
action: call-service
service: automation.trigger
service_data:
entity_id: >-
automation.increase_ventilation_mode_to_max_speed_for_brief_period
- type: button
name: Push state
icon: mdi:publish
show_state: false
tap_action:
action: call-service
service: mqtt.publish
service_data:
topic: ventilation/_reset_publish_filters
@garystewart
Copy link

I bought the extra humidity sensor for the brink flair 400: https://www.brinkclimatesystems.nl/documenten/rh-sensor-614860.pdf
as I did not know that there was one already inside. However this one and the internal one report different values. The extra one reflects more the value in the house whilst the internal one is a lot lower and probably the value inside the unit.
To solved I needed to modify the value to 4083 as this was a more interesting humidity reading for me.

Thanks again.

@hnykda
Copy link
Author

hnykda commented Dec 22, 2021

Update: Added better handling of negative values. They are read from modbus as values subtracted from 65536, so a transformation needs to be applied.

@limwakra
Copy link

limwakra commented Jan 8, 2022

Thanks, @hnykda got it working, only getting the error in HA: Custom element doesn't exist: button-card. Any idea how to fix this? Thanks in advance.

@hnykda
Copy link
Author

hnykda commented Jan 8, 2022

Hey. You are right, I forgot.to mention that, it's https://github.com/custom-cards/button-card#configuration and it is not part of vanilla HA installation.

But the recent HA got a Button card IIRC, so you might get away with that :-)

@limwakra
Copy link

Thanks got it working. First, I could only read values and couldn't change the fan speed. I got the 4 positions switch attached on x14 on the brink print, when 2 and 3 are closed I'm not able to change the fan speed. But when I remove it, it works with the buttons in home assistant.

@limwakra
Copy link

limwakra commented Sep 8, 2022

Hi hnykda, home assistant requires a new MQTT sensor format. Today I changed all the sensors from this project to the new mqtt sensor format.

mqtt:
  sensor:
    - name: "Ventilation Supply Temperature"
      unique_id: "ventilation/supply_temperature"
      state_topic: "ventilation/supply_temperature"
      unit_of_measurement: "°C"
      value_template: "{{ value }}"
    - name: "Ventilation Output Temperature"
      unique_id: "ventilation/output_temperature"
      state_topic: "ventilation/output_temperature"
      unit_of_measurement: "°C"
      value_template: "{{ value }}"
    - name: "Ventilation Outside Temperature"
      unique_id: "ventilation/outside_temperature"
      state_topic: "ventilation/outside_temperature"
      unit_of_measurement: "°C"
      value_template: "{{ value }}"
    - name: "Ventilation Supply Humidity"
      unique_id: "ventilation/supply_humidity"
      state_topic: "ventilation/supply_humidity"
      unit_of_measurement: "%"
      value_template: "{{ value }}"
    - name: "Ventilation Output Humidity"
      unique_id: "ventilation/output_humidity"
      state_topic: "ventilation/output_humidity"
      unit_of_measurement: "%"
      value_template: "{{ value }}"
    - name: "Ventilation Flow Speed"
      unique_id: "ventilation/flow_speed"
      state_topic: "ventilation/flow_speed"
      unit_of_measurement: "m3"
      value_template: "{{ value }}"
    - name: "Ventilation Flow Speed Percentages"
      unique_id: "ventilation/flow_speed_pct"
      state_topic: "ventilation/flow_speed_pct"
      unit_of_measurement: "%"
      value_template: "{{ value }}"
    - name: "Ventilation Bypass State"
      unique_id: "ventilation/bypass_state"
      state_topic: "ventilation/bypass_state"
      value_template: "{{ value }}"

@hnykda
Copy link
Author

hnykda commented Sep 8, 2022

Thanks. I have updated the gist (with some additional values, such as pressure).

If you have the same unit as I do, I recommend to update the bypass_mode automation. I have found out that there is turbulence when you run on more than ~250m3/h that makes the bypass "flap" and the technician said it's a bug and it might damage the bypass valve, eventually (as it's really just plastic).

And this might be just my unit specific bug, but it switch off the fans when the temperature goes under zero. It's driving me crazy, technicians say things like "it's probably preheater, but dunno, let's reflash latest firmware"...

Also, apparently, Brink fired the whole programming team and there's a new team now, so everyone is praying that things don't break as there's not much knowledge.

@limwakra
Copy link

limwakra commented Sep 8, 2022

Hi hnykda, I have 300 unit version without the preheater. Haven't yet noticed the bypass flapping. Adopted the new automation anyway.

It's all a bit buggy the brink firmware, every time I try to change the volume from the modes(1,2,3,etc) in the web interface from the unit I have a hard time to get the unit to listen to modbus again. At this moment I only listen to mode 0 correctly, if I insert mode 1 2 3 it only goes to maximum speed (300m3/h). Checked the output to the modbus with a debug node it's all correctly inserting the right values.

I also read out register 4115 (filter use in hours) divide this with / 24 and publish this in days to HA.

@hnykda
Copy link
Author

hnykda commented Sep 8, 2022

It is buggy and I experience somewhat similar behavior, but it's to some degree expected, as the manual in section 5.5.8 says this:

Note: When ModBus is active, the ventilation mode cannot be changed using the display or, if applicable, the
connected multiple switch! Also any connected humidity sensor will not function.

so it's actually a miracle that you can manipulate it from the display at all even when using modbus at other times. Btw. for me it somehow works just fine even when modbus is active.

Those 250m3h for the flapping thing is my guesstimate when it shouldn't do any flapping (note that it might still do some vibrations even if you can't hear it). Maybe it can be higher, this is "safe" side.

By the way, one could trivially edit the automation not to just raise a notification, but to simply safe the current speed/mode into a variable, lower it to safe speed if current_speed > 250m3h (e.g. 250m3h), increase it back to the originally speed.

@garystewart
Copy link

Hi hnykda, I have 300 unit version without the preheater. Haven't yet noticed the bypass flapping. Adopted the new automation anyway.

It's all a bit buggy the brink firmware, every time I try to change the volume from the modes(1,2,3,etc) in the web interface from the unit I have a hard time to get the unit to listen to modbus again. At this moment I only listen to mode 0 correctly, if I insert mode 1 2 3 it only goes to maximum speed (300m3/h). Checked the output to the modbus with a debug node it's all correctly inserting the right values.

I also read out register 4115 (filter use in hours) divide this with / 24 and publish this in days to HA.

Perhaps it will help - I had to set the ‘switch default position’ 6031 to 1 (for some reason it was on 0 for me).
If I changed this then the rf senders, web-app and modbus appear to work. Highest setting wins. Basically When it is zero it has some confusing ‘vacation mode’. It totally confusing. But I now set 6031 to 1 on starting the modbus and works quite well now.

@hnykda
Copy link
Author

hnykda commented Sep 8, 2022

Added filter usage in hours, thanks for the tip @limwakra and also everyone who contributes here and helps others!

@limwakra
Copy link

limwakra commented Sep 8, 2022

thanks, @garystewart, I've tried your suggestion, but the register was already on 1.
Can anyone read out register: 7990 It's not in the manual what the default value is for this one, maybe that one is wrong. Mine is currently at 1 (1 = Modbus external connect)

@hnykda
Copy link
Author

hnykda commented Sep 8, 2022

Reading 7990 doesn't do anything for me, no return value.

@garystewart
Copy link

7990 is 1 for me.
it has been awhile since I looked at this and the symptom is so familiar.
Do you ever set the mode to 0? (Via app or home assistant). Basically i disabled every chance of setting to 0 with home assistant. And don’t make change to 0 via the web-app.

and a final protection - I added a power plug that I can remotely switch off and on in case I forget to turn it down when using the rf sender or if something goes wrong. This way I can switch it off and on then all is reset. :)

@garystewart
Copy link

And to add - set it to 1 on modbus, web app and rf senders if you have it. Then test from there. 🤞🏻

@limwakra
Copy link

limwakra commented Sep 8, 2022

Yes! @garystewart that was it. Changed the state to 1 in the local interface, and now it's working again. Thank you so much!

@garystewart
Copy link

your welcome. it drove me crazy. Basically, highest setting wins except mode=0. which I think is some sort of vacation setting which in imho should never be used.
If you have the 4 button cabled switch the ventilator sign is mode 0. In the end I removed the cabled switch and replaced it with the rf sender one. so now nothing can set to 0 in my house :-)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment