-
Notifications
You must be signed in to change notification settings - Fork 34
Home Assistant
The objective is to control the (non-)CVE fan within Home Assistant and show relevant sensors.
An example of the CVE unit with humidity and other sensors looks like this:
- The "medium" setting needs to be enabled (see main setup for CVE)
- MQTT broker must be running and reachable by the add-on
- MQTT must be activated in Home Assistant in configuration.yaml.
- MQTT must be activated in "MQTT" page on the add-on Web interface Applies to pre-2.3 versions only: change "State topic" to itho/state and "Itho Status topic" to itho/ithostatus
Recommendation is to leave all MQTT defaults as-is and only enter IP-address, username & password. Username and password must match the one used for MQTT broker, add-on and Home Assistant.
Note: MQTT brokers can run without credentials but it's recommended as a best practice to secure it even on the local network.
-
Install a broker (e.g. mosquitto) manually or via Home Assistant Add-ons. MQTT broker configuration is out of scope for this project as this is covered in many tutorials already.
-
Configure MQTT in Home Assistant by adding the following to configuration.yaml
# Example configuration.yaml entry which assumes MQTT_USERNAME and mysecretpassword are the credentials for the MQTT broker and created via mosquitto_passwd
mqtt:
broker: "IP_ADDRESS_BROKER"
username: "MQTT_USERNAME"
password: !secret MQTT_PASSWORD
Create or edit secrets.yaml and add:
MQTT_PASSWORD: mysecretpassword
- Restart Home Assistant and verify there is no connection error by checking the logs (Configuration / Logs).
Integrating the add-on with Home Assistant can be done via different options.
With MQTT Auto-discovery turned on in the "MQTT" menu of the add-on, the add-on should show up under Configuration -> Devices as a fan. Search for "Itho" and you should see 1 device. After clicking on it, you should see the fan registered as entity. Under "Device info" click on "MQTT Info" to see the received MQTT messages.
To manually add the fan, edit configuration.yaml and restart Home Assistant when done.
# Itho daalderop MV www.nrgwatch.nl
fan:
- platform: mqtt
device:
identifiers: nrg-itho-1
model: ITHO Wifi Add-on
name: ITHO-WIFI
availability_topic: itho/lwt
unique_id: nrg-itho-1
name: nrg-itho-1_fan
state_topic: itho/lwt
state_value_template: '{% if value == ''online'' %}ON{% else %}OFF{% endif %}'
json_attributes_topic: itho/ithostatus
command_topic: itho/cmd/not_used/but_needed_for_HA
percentage_command_topic: itho/cmd
percentage_command_template: '{{ value * 2.54 }}'
percentage_state_topic: itho/state
percentage_value_template: '{{ ((value | int) / 2.54) | round}}'
Auto-discovery for non-CVE (E.g. Demandflow/QualityFlow/HRU-350) today does not work as there is no fan speed. Edit configuration.yaml and add the following and adjust where needed. Comment the preset_mode_command_template if you want to control the device via an RF remotes. This is useful when you don't have the CC1101 module. This example uses a virtual remote.
The config below assumes:
- Normalize keys is Off in the module’s System settings page
- Home Assistant MQTT Discovery is Off in the module's MQTT settings page.
mqtt:
fan:
- name: "Itho HRU 350 "
unique_id: "Itho_hru_Fan"
state_topic: "ithohru/lwt"
state_value_template: "{% if value == 'online' %}ON{% else %}OFF{% endif %}"
command_topic: "ithohru/cmd"
preset_mode_state_topic: "ithohru/ithostatus"
preset_mode_command_template: "{ vremote: '{{ value }}'}"
preset_mode_value_template: >
{% set am = value_json['Actual Mode'] | int %}
{% if am == 1 %}
low
{% elif am == 2 %}
medium
{% elif am == 3 %}
high
{% elif am == 13 %}
timer
{% elif am == 24 %}
auto
{% elif am == 25 %}
autonight
{% else %}
{{ am }}
{% endif %}
preset_mode_command_topic: "ithohru/cmd"
preset_modes:
- "low"
- "medium"
- "high"
- "auto"
- "autonight"
- "timer1"
- "timer2"
- "timer3"
The above configuration only makes the fan available as entity. Additional sensors might be available to report CO2 (via Remote), Humidity percentage and temperature.
Add following to sensor configuration (e.g. sensors.yaml or configuration.yaml):
mqtt:
sensor:
- name: "ITHO Temperature"
state_topic: "itho/ithostatus"
unit_of_measurement: "°C"
value_template: "{{ value_json.temp }}"
device_class: "temperature"
unique_id: "itho_temp"
To display humidity (if supported by the unit), add following to sensor configuration (e.g. sensors.yaml or configuration.yaml):
mqtt:
sensor:
- name: "ITHO Humidity"
state_topic: "itho/ithostatus"
unit_of_measurement: "%"
value_template: "{{ value_json.hum }}"
device_class: "humidity"
unique_id: "itho_hum"
MQTT home assistant setup for CO2 sensor (via Itho remote) If you have a remote that also shows the CO2 level, this can be visualised in Home Assistant.
mqtt:
sensor:
- name: Itho <unit> CO2
state_topic: "itho/remotesinfo"
value_template: "{{ value_json.<unit>.co2 }}"
device_class: "carbon_dioxide"
unique_id: "itho_<unit>_co2"
Replace with the name given in the Add-on RF Remotes page.
While it is possible to add the sensors and fan via YAML to the dashboard, doing this via the UI is easier. To add the Entities card to your user interface, click the Lovelace menu (three dots at the top right of the screen) and then Edit Dashboard. Click the “Add Card” button in the bottom right corner and select Entities from the card picker. You can filter for them by typing 'itho'.
Some examples for integrating the fan and other data with Home Assistant
This assumes that the CVE Itho unit has a built-in humidity sensor
-----Bathroom humidity and increasing fan speed
- id: "Fan up when showering"
alias: fan UP when showering
description: Bathroom humidity and increasing fan speed
trigger:
- platform: template
value_template: "{{ is_state_attr('fan.itho_fan', 'hum', '50') }}"
for: "00:10:00" # only triggers if humidity is >50% for 10 minutes or more
condition: []
action:
- service: fan.set_percentage
target:
entity_id: fan.itho_fan
data:
percentage: 100
- wait_template: ''
timeout: '00:15:00' # trigger low speed after 15 minutes
continue_on_timeout: true
- service: fan.set_percentage
target:
entity_id: fan.itho_fan
data:
percentage: 33
mode: single
Non-CVE without Demandflow/Qualityflow don't have a built-in humidity sensor. This example uses a separate humidity sensor. It sets fan to high if humidity is 70% or higher for 5 minutes. If humidity decreases to 60% or lower, set preset to low.
- id: '1636121777685'
alias: Itho - Bathroom
description: 'Humidity controlled fan speed'
trigger:
- platform: numeric_state entity_id: sensor.bathroom_hum above: '70' for: hours: 0 minutes: 5 seconds: 0 milliseconds: 0 condition: [] action:
- service: fan.set_preset_mode data: preset_mode: high target: entity_id: fan.itho_fan
- wait_for_trigger:
- platform: numeric_state entity_id: sensor.bathroom_hum below: '60'
- service: fan.set_preset_mode target: entity_id: fan.itho_fan data: preset_mode: low mode: single
### 2. TODO: Why is this needed?
```yaml
- alias: "Set fan slider Itho F"
trigger:
platform: mqtt
topic: 'itho/state'
action:
service: input_number.set_value
data:
entity_id: input_number.itho_fan_nr
value: "{{ trigger.payload }}"
- alias: "Fan slider itho<description> moved"
trigger:
platform: state
entity_id: input_number.itho_fan_nr
condition:
condition: template
value_template: "{{ states('sensor.itho_status_<unit2>_fan') | int != states('input_number.itho_0b08_fan') | int }}"
action:
service: mqtt.publish
data:
topic: 'itho/cmd'
retain: true
payload: "{{ states('input_number.itho_fan') | int }}"
When showering (rising humidity) increase fan speed
To create a 3 button interface (scripts.yml)
#-----Mechanical ventilation presets
mv_preset_low:
alias: MV preset low
icon: mdi:fan-speed-1
sequence:
- service: fan.set_percentage
target:
entity_id: fan.itho_fan
data:
percentage: 33
mv_preset_medium:
alias: MV preset medium
icon: mdi:fan-speed-2
sequence:
- service: fan.set_percentage
target:
entity_id: fan.itho_fan
data:
percentage: 50
mv_preset_high:
alias: MV preset high
icon: mdi:fan-speed-3
sequence:
- service: fan.set_percentage
target:
entity_id: fan.itho_fan
data:
percentage: 100
The Lovelace part for using the buttons on the UI
- title: Mechanische ventilatie
type: entities
entities:
- entity: input_number.fan_itho_speed
name: Fan
icon: mdi:fan
- entity: sensor.fan_itho_state
- type: horizontal-stack
cards:
- type: button
show_name: false
show_state: false
icon_height: 75px
entity: script.mv_preset_low
tap_action:
action: call-service
service: script.turn_on
service_data:
entity_id: script.mv_preset_low
- type: button
show_name: false
show_state: false
icon_height: 75px
entity: script.mv_preset_medium
tap_action:
action: call-service
service: script.turn_on
service_data:
entity_id: script.mv_preset_medium
- type: button
show_name: false
show_state: false
icon_height: 75px
entity: script.mv_preset_high
tap_action:
action: call-service
service: script.turn_on
service_data:
entity_id: script.mv_preset_high