Giter VIP home page Giter VIP logo

whr_930's Introduction

WHR 930

PROJECT DEPRECATED !!

This project delivered code to manage a Storkair/Comfoair WHR 930 for many years, but will not be maintained from now on.

For quite a while we are working on a new method where a dedicated microcontroller board is used, so that running a Raspberry Pi or something alike is not nescessary anymore. The solution that we, my son and I, have created is an ESP32 based controller which connects to the WHR 930 (or others) using a regular UTP cable that also delivers power to the controller. It is very easy to connect this ESP32 based controller to the WHR 930 and to adopt it in Home Assistant, which makes it easier for people who are less of a "tinker", then the previous method required.

The ESP32 based controller can be ordered from https://shop.svenar.nl.

ESPHome Storkair / ComfoAir Controller

The old code is still present and usable, see the deprecated readme if you prefer to use that method.

whr_930's People

Contributors

diedb avatar joel-apollo avatar michael-yongshi avatar mosibi avatar skamoen avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

whr_930's Issues

Home Assistant has changed MQTT Fans

The wtw.yaml I think now needs to have the fan looks like this:

  - platform: mqtt
    name: "Ventilation"
    state_topic: "house/2/attic/wtw/ventilation_level"
    command_topic: "house/2/attic/wtw/set_ventilation_level"
    speed_state_topic: "house/2/attic/wtw/ventilation_level"
    state_value_template: "{{ states.sensor.wtw_ventilation_level.state }}"
    speed_value_template: "{{ states.sensor.wtw_ventilation_level.state }}"
    preset_mode_command_topic: "house/2/attic/wtw/set_ventilation_level"
    preset_mode_command_template: >
        {% if value == "low" %}
            '"1"'
        {% elif value == "medium" %}
            '"2"'
        {% elif value == "high" %}
            '"3"'
        {% else %}
            '"1"'
        {% endif %}
    payload_off: "1"
    payload_on: "3"
    preset_modes:
      - "off"
      - low
      - medium
      - high

I think this is correct? Let me know what you think - it works for me

Speed 100%

Hi,

When I set the WHR on level 3, the fan speed is max 70%

image

When I use the bathroom button, it sets the speed at 100%

image

Is it possible to add a extra level?

Can't set fan speed

Hello,

First of all, thanks for this awesome project and the blog post about this. I have been wanting to automate my ventilation unit.

My setup for this is as follows:

  • Zehnder WHR 930 Basic controled with 3-state switch (perilex).
  • Raspberry pi zero with RS232 extension port.
  • Ethernet cable with RJ45 To RS232 converter (with pin mapping 2 -> 3, 3 -> 2, 8 -> 5).
  • Home assistant running in Docker.

It now successfully gets data from the ventilation units and pushes it to Home Assistant.
When I try to change the fan speed (from HA) I see the 'Setting ventilation to x' message appearing in the debug log but unfortunately nothing happens.

Do you know what goes wrong? Is it because is switched with the 3-state switch?

I appreciate any help I could get with this,

If message is empty and debug > 1 out of index is thrown

problem is the 'debug_data' function where only the first if function is checked for emptyness of the message. Whenever the debug level is set to 2 or higher the second if (debug_level > 1) will run and error out if data_len is empty.

few questions

Hi
I hope you can help me out a bit.

the service whr930.service is running and I get the message "Successfull subscribed to the MQTT topics".
so this is a good sign I think, but I can't see any data in home assistant yet.
I added the wtw.yaml as a package so the entities are visible.
One thing I CAN do is change the "fan.wtw_ventilation" speed. this one works, but I would also would expect to see other data like WTW Outside Temperature and so on.

  1. Any idea what i'm missing?

  2. Do I have to configure anything else in Home assistant? I have an MQTT docker image running myself and added it as an integration, do I have to set up certain topics? I thought this would not be needed.
    image

  3. is there any way i can check if it works? whether your script receives data, for example?
    thanks in advance

Filter Status

Hi,

The filter check isn't working on my unit...

image

image

Does it work on your unit?

Error in calculation of fan speed

The calculation of the fan speed (RPM) in get_fan_status() is overly complex and wrong. It ignores leading zeroes in the hex values, leading to incorrect speeds being calculated.

My solution:

Replace the two lines of code

        IntakeFanRPM = int(1875000 / int(''.join([str(int(data[9], 16)), str(int(data[10], 16))])))
        ExhaustFanRPM = int(1875000 / int(''.join([str(int(data[11], 16)), str(int(data[12], 16))])))

by the following two lines:

        IntakeFanRPM = int(1875000 / (int(data[9], 16) * 256 + int(data[10], 16)))
        ExhaustFanRPM = int(1875000 / (int(data[11], 16) * 256 + int(data[12], 16)))

ValueError: invalid literal for int() with base 10: 'a0'

Not sure what triggered the error yet, have been running the script without issues since yesterday but it just stopped with the following message. I'll update if/when i'm able to reproduce. In the mean time is this something that look familiar to you and is an actual issue?

Traceback (most recent call last):
  File "whr930.py", line 905, in <module>
    sys.exit(main())
  File "whr930.py", line 892, in main
    get_status()
  File "whr930.py", line 753, in get_status
    ActiveStatus1 = int(data[13])  # (0x01 = P10 ... 0x80 = P17)
ValueError: invalid literal for int() with base 10: 'a0'

Question

Hi,

i’ve recently moved into the house and o try to automate/control everything with HA as much as possible. I have a whr 930 in the attic, but it’s quite hard to make a direct connection for it to my pi.

Do you know if there is a way to make it work without the direct connection? Like having a WiFi adapter in the whr.

Cheers,
Alexandru

Q: is there a way to install this module on Hasio? (the os)

My parents recently moved and want to integrate their ventilation system to Home-assistant.

To keep things easy I'm using the hassio os image on a Raspberri pi 4. Now I'm not a n00b regarding linux; but Home Assistant is still new to me. at first glance it seems like this distro is severely limited(?) OR I just don't see anything obvious.

Before I completely go the advanced route: has anyone installed it on this os?

Lovelace error: Custom element doesn't exist: wtw-card.

title: WTW
views:
  - badges: []
    cards:
      - entities:
          - entity: sensor.wtw_type
            icon: mdi:arrow-left-right-bold
            name: Type
          - entity: sensor.wtw_size
            icon: mdi:checkbox-blank-circle-outline
            name: Size
          - entity: sensor.wtw_bypass_present
            icon: mdi:checkbox-blank-circle-outline
            name: Bypass present
          - entity: sensor.wtw_enthalpy_present
            icon: mdi:checkbox-blank-circle-outline
            name: Enthalpy present
          - entity: sensor.wtw_ewt_present
            icon: mdi:checkbox-blank-circle-outline
            name: EWT present
          - entity: sensor.wtw_options_present
            icon: mdi:checkbox-blank-circle-outline
            name: Options present
          - entity: sensor.wtw_preheating_present
            icon: mdi:checkbox-blank-circle-outline
            name: Preheating present
          - entities:
              - sensor.wtw_p10_active
              - sensor.wtw_p11_active
              - sensor.wtw_p12_active
              - sensor.wtw_p13_active
              - sensor.wtw_p14_active
              - sensor.wtw_p15_active
              - sensor.wtw_p16_active
              - sensor.wtw_p17_active
              - sensor.wtw_p18_active
              - sensor.wtw_p19_active
              - sensor.wtw_p90_active
              - sensor.wtw_p91_active
              - sensor.wtw_p92_active
              - sensor.wtw_p93_active
              - sensor.wtw_p94_active
              - sensor.wtw_p95_active
              - sensor.wtw_p96_active
              - sensor.wtw_p97_active
            head:
              label: Active states (P#)
              type: section
            type: custom:fold-entity-row
          - type: divider
          - entity: sensor.wtw_filter_status
            icon: mdi:filter
            name: Filter
          - entity: sensor.wtw_preheating_state
            icon: mdi:radiator
            name: Preheating active
          - entity: sensor.wtw_summer_mode
            icon: mdi:weather-sunny
            name: Summer mode
        title: WTW
        type: entities
      - type: custom:wtw-card
      - columns: 3
        entities:
          - entity: sensor.wtw_return_air_level
            icon: mdi:fan
            name: Fan speed (%) return
          - entity: sensor.wtw_supply_air_level
            icon: mdi:fan
            name: Fan speed (%) supply
          - entity: sensor.wtw_exhaust_fan_rpm
            icon: mdi:fan
            name: Fan speed (rpm) exhaust
          - entity: sensor.wtw_intake_fan_rpm
            icon: mdi:fan
            name: Fan speed (rpm) intake
          - entity: sensor.wtw_ventilation_level
            icon: mdi:fan
            name: Current level
        show_icon: true
        show_name: true
        show_state: true
        title: Ventilation
        type: glance
      - columns: 2
        entities:
          - entity: sensor.wtw_outside_temperature
            name: Supply to WTW
          - entity: sensor.wtw_exhaust_temperature
            name: Return from WTW
          - entity: sensor.wtw_supply_temperature
            name: Supply to house
          - entity: sensor.wtw_return_temperature
            name: Return from house
        title: Temperatures
        type: glance
      - entities:
          - entity: sensor.wtw_bypass_valve
            icon: mdi:electric-switch
            name: Valve
          - entity: sensor.wtw_bypass_correction
            icon: mdi:electric-switch
            name: Correction value
          - entity: sensor.wtw_bypass_factor
            icon: mdi:electric-switch
            name: Factor
          - entity: sensor.wtw_bypass_open_hours
            icon: mdi:electric-switch
            name: Open (hours)
          - entity: sensor.wtw_bypass_step
            icon: mdi:electric-switch
            name: Step
          - entity: sensor.wtw_motor_current_bypass
            icon: mdi:electric-switch
            name: Motor current
        title: Bypass
        type: entities
      - entities:
          - entity: fan.wtw_ventilation
          - entity: input_number.set_wtw_comfort_temperature
        title: Settings
        type: entities
      - entities:
          - entity: sensor.wtw_motor_current_preheating
            name: Preheating motor current
          - entity: sensor.wtw_preheating_hours
            name: Preheating (hours)
          - entity: sensor.wtw_preheating_state
            name: Preheating state
          - entity: sensor.wtw_preheating_valve
            name: Preheating valve
          - type: divider
          - entity: sensor.wtw_frost_protection_active
            name: Frost protection active
          - entity: sensor.wtw_frost_protection_hours
            name: Frost protection (hours)
          - entity: sensor.wtw_frost_protection_level
            name: Frost protection level
          - entity: sensor.wtw_frost_protection_minutes
            name: Frost protection (minutes)
        title: Preheating / Frost protection
        type: entities
    icon: mdi:fan
    path: wtw
    title: WTW

Please advise!
whr930 test1

Error in HA wtw: !include includes/wtw.yaml

Hi when i put this and i check configuration i get the following error.

Component error: packages - Integration 'packages' not found.

I put the src/wtw.yaml in the config/includes directory.

And put the following text in the configuration.yaml
packages:
wtw: !include includes/wtw.yaml

Warning get_fan_status

Hi Mosibi,

Dankjwel for the nice work you did!

For all warnings you have the function name and than function ... Only for the get_fan_status its the otherway arround.

27-06-2020 12:28:45 WARNING: get_temp function could not get serial data
27-06-2020 12:28:47 WARNING: get_ventilation_status function could not get serial data
27-06-2020 12:28:49 WARNING: get_filter_status function could not get serial data
27-06-2020 12:28:51 WARNING: function get_fan_status could not get serial data
27-06-2020 12:28:53 WARNING: get_bypass_control function could not get serial data
27-06-2020 12:28:55 WARNING: get_valve_status function could not get serial data
27-06-2020 12:28:57 WARNING: get_status function could not get serial data
27-06-2020 12:28:59 WARNING: get_operating_hours function could not get serial data
27-06-2020 12:29:01 WARNING: get_preheating_status function could not get serial data

question about custom:wtw-card

Hi

Ive got some trouble adding the "custom:wtw-card" from:
https://github.com/Mosibi/lovelace-wtw/tree/mosibi
I see the picture but it looks like data is missing or the card is not complete.
So I have doubts about the card yaml setup (left to it)
image

Do you mind sharing the card configuration for this?
and should the icons do something at the bottom? can you click on it? or ?

get_operating_hours could not get serial data

I receive the following when running the python script:

02-07-2020 20:54:17 WARNING: Received garbage data, ignored ...
02-07-2020 20:54:17 WARNING: get_operating_hours function could not get serial data
Traceback (most recent call last):
  File "whr930.py", line 885, in <module>
    sys.exit(main())
  File "whr930.py", line 874, in main
    get_preheating_status()
  File "whr930.py", line 587, in get_preheating_status
    int(data[7], 16)
KeyError: 255

Edit:
Commeting out these lines in whr930.py does make it work and I'm able to control the unit.

line 873            get_operating_hours()
line 874            get_preheating_status()

I do however get these messages a lot:

02-07-2020 22:01:53 WARNING: Received garbage data, ignored ...
02-07-2020 22:01:53 WARNING: get_fan_status function could not get serial data

Duplicate '07' bytes in data

Hi,
I'm a newby on Github, so bare with me. Can't get the layout correct ...

According to the protocol, any '07'value in the data part of a respons from the WHR is repeated, without any impact on length or checksum. Upon receipt, such duplicate bytes should be removed.
I detected this because I received strange values for fan speed (RPM).

My solution for serial_command():


def serial_command(cmd):
    data = []
    ser.write(cmd)
    time.sleep(2)
    while ser.inWaiting() > 0:
        data.append(ser.read(1).hex())
    if len(data) <= 1: # always expect a valid ACK at least
        return None
    if len(data) == 2 and data[0] == '07' and data[1] == 'f3':
        pass  # just ACK by itself (on all "setting" commands, such as setting ventilation level, command x99)
    else: # valid respons should be at least 10 bytes (ACK + respons with data length = 0)
        if len(data) < 10 or data[0] != '07' or data[1] != 'f3' or data[2] != '07' or data[3] != 'f0' or data[-2] != '07' or data[-1] != '0f':
            warning_msg('Received garbage data, ignored ...')
            return None
        if debug:
            debug_data(data)
        dat_len = int(data[6], 16) # 
        if len(data) > 10 and dat_len > 0:
            for i in range(7,6+dat_len): # REMOVE ANY DOUBLE x07 IN DATA-PART !!!
                if data[i] == '07' and data[i+1] == '07':
                    del data[i+1] ## remove the duplicate
        # CHECK rest of message: correct command, correct checksum ...??
    return data


get_status type wrong

Hi Mosibi,

I got a error on get_status()

My WHR 930 is a right side type, i received number 2 as a result. According the document of your blog this is indeed number 2.
Only in the status_data is defined as 0.

status_data = {
    "PreHeatingPresent": {0: False, 1: True},
    "ByPassPresent": {0: False, 1: True},
    "Type": {0: "Right", 1: "Left"},
    "Size": {1: "Large", 2: "Small"},
    "OptionsPresent": {0: False, 1: True},
    "EnthalpyPresent": {0: False, 1: True, 2: "PresentWithoutSensor"},
    "EWTPresent": {0: False, 1: "Managed", 2: "Unmanaged"},
}

WHR 930 Basic model doesn't support all commands

I have a WHR 930 Basic, which supports a subset of the currently implemented commands, but doesn't get all the data as expected. This results in empty values or a KeyError for a number of commands, crashing the program.

I assume you don't have a spare basic model lying around so I'll try to see if I can implement two different profiles so it only issues supported commands. Expect a PR somewhere this month once I figure out what's supported and what not.

Problem installing on RPi4 HA

Hi, I'm having trouble installing your module since my HA doesn't support "apt-get" commands if I open a terminal editor in HA?
Please advise!

UnboundLocalError: local variable 'EnthalpyPresent' referenced before assignment

Have been running for a couple of days now.
The following error was thrown after not changing the ventilation for a longer period. Then changing the ventilation using the remote control and after a few hours i used home assistant to change the ventilation again. I will try to reproduce if possible but thought it would be best to also post it here.

Traceback (most recent call last):
  File "whr930.py", line 916, in <module>
    sys.exit(main())
  File "whr930.py", line 903, in main
    get_status()
  File "whr930.py", line 777, in get_status
    EnthalpyPresent,
UnboundLocalError: local variable 'EnthalpyPresent' referenced before assignment

Edit:
@Mosibi Was able to reproduce the issue. It happens when the remote control is used to set the WHR 930 into a timed mode of 15 minutes on level 3. When the script then tries to retrieve the current state it crashes with the above error.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.