Add support for Zehnder Comfoconnect LAN C bridge.#7246
Conversation
|
@michaelarnauts, thanks for your PR! By analyzing the history of the files in this pull request, we identified @turbokongen, @balloob and @pvizeli to be potential reviewers. |
There was a problem hiding this comment.
line too long (83 > 79 characters)
There was a problem hiding this comment.
line too long (83 > 79 characters)
|
Note I had to remove the This caused the interface to always render the target_temperature picker, also when the platform didn't support setting it. |
|
Also note that I had to write a python library for this (https://github.com/michaelarnauts/comfoconnect), and this is my first one. There are so many ways I could have done something wrong there, but it seems to work fine. Is it safe for example to use |
There was a problem hiding this comment.
Make sure that the callback only start after EVENT_HOMEASSISTANT_START event is receive with a event listener (You can also Register the callback inside async_added_to_hass and hass.async_add_job. Make also sure that the callback thread is closing with a EVENT_HOMEASSISTANT_STOP event listener.
There was a problem hiding this comment.
The callback thread of comfoconnect is only started when the update is executed (when self._comfoconnect.connect is executed). It is stopped in self._comfoconnect.disconnect in the finally clause. It only stays awake for maximum 5 seconds (during wait_for_sensor_values).
I initially used the EVENT_HOMEASSISTANT_[START|STOP] event, and kept the callback thread open, but the bridge only allows one open connection at the same time, so I decided to stay with polling and open the connection during update.
There was a problem hiding this comment.
Not needed, remove that and use self.hass they will set on core
There was a problem hiding this comment.
Actually, I don't need hass. I will remove it out of the __init__.
2297048 to
c57a02b
Compare
|
I've rebased with dev, and the travis errors are gone now. |
|
@pvizeli and @turbokongen |
| } | ||
|
|
||
| target_temperature = self.target_temperature | ||
| if target_temperature is not None: |
There was a problem hiding this comment.
I already mentioned this in the chat, this is not allowed. Please revert this change.
The idea of the climate component is for devices that can control the temperature. If your device can't control the temperature, it is a fan. And so please implement a platform for the fan component.
You can have an extra sensor platform to expose the current temperature.
There was a problem hiding this comment.
Hmm, I didn't know the rule that only temperature controllable things could be climate platforms. This contradicts the climate documentation:
The climate component is built for the controlling and monitoring of HVAC (heating, ventilating, and air conditioning) and thermostat devices.
I will try to find some time to move over to the fan component, although it's unfortunate that that component doesn't support the temperature view.
There was a problem hiding this comment.
If you implement the temperature as a separate sensor, you get graphs too.
There was a problem hiding this comment.
Alright, I've setup my hass to use template sensors and fetch them from the attributes. Works fine!
|
I've moved the platform to the fan component. There still seems to be a frontend since it is also displaying a "Oscillate" toggle, what isn't returned in the |
| data = {} | ||
|
|
||
| for key, value in self._data.items(): | ||
| if key == SENSOR_FAN_SPEED_MODE: |
There was a problem hiding this comment.
You won't have to add this to the state attributes, the fan already exposes this.
| data[ATTR_OUTSIDE_HUMIDITY] = value | ||
|
|
||
| elif key == SENSOR_TEMPERATURE_EXTRACT: | ||
| data[ATTR_CURRENT_TEMPERATURE] = value / 10.0 |
There was a problem hiding this comment.
Wouldn't it make more sense to have these be added as a sensor platform? That way we get graphs and easy to automate against it.
- Move auth to
components/comfoconnect.pyand have it store the ComfoConnect object inhass.data - add
sensor/comfoconnect.pyto expose sensors - update the fan platform to use the ComfoConnect object in
hass.data
| _LOGGER.debug('Subscribed to sensors.') | ||
|
|
||
| # Wait maximum of 5 seconds for all the sensor values. | ||
| self.wait_for_sensor_values(5) |
| _LOGGER.error('Timeout while waiting for sensor data.') | ||
| return | ||
|
|
||
| time.sleep(1) |
There was a problem hiding this comment.
Home Assistant only has 10 threads to do work for synchronous components/platforms. Blocking a thread with a sleep is not allowed. Instead, use track_point_in_time to schedule a function to be called again
|
Alright, I will close this PR for now, since I have to rework some stuff to handle the threads better. |
Description:
This PR adds support for the Zehnder ComfoAir Q350/450/600 ventilation systems. You'll need a ComfoConnect LAN C bridge to interface with it.
The bridge can report sensor data, and you can adjust the ventilation mode (away, low, medium and high).
Pull request in home-assistant.github.io with documentation (if applicable): home-assistant/home-assistant.io#2483
Example entry for
configuration.yaml(if applicable):Checklist:
If user exposed functionality or configuration variables are added/changed:
If the code communicates with devices, web services, or third-party tools:
toxrun successfully. Your PR cannot be merged unless tests passREQUIREMENTSvariable (example).requirements_all.txtby runningscript/gen_requirements_all.py..coveragerc.