joleys / niko-home-control-II

Home Assistant Custom Integration for Niko Home Control II
MIT License
74 stars 21 forks source link

Renson boost switch #95

Closed davidvf closed 10 months ago

davidvf commented 10 months ago

Hello, i've just added my Renson ventilation into my NHC II setup. All the rooms are properly linked to the generic ventilation units in Niko programming software. From the Niko app, I am able to set the boost for a specific room.

I noticed that these fans are also added in homeassistant now. I've tried to enable the boost switch, but it doesn't seem to work.

If I enable debug logging for this integration this is the only output i get:

2023-11-23 11:04:46.339 DEBUG (Thread-3 (_publish_device_control_commands)) [custom_components.nhc2.nhccoco.coco] → Publishing device control command: {"Method": "devices.control", "Params": [{"Devices": [{"Uuid": "e78be156-7f2c-4d61-8840-a2c02e17fb1e", "Properties": [{"Boost": "True"}]}]}]}

If i try the fan entities instead of the boost switches, i get this error:

2023-11-23 11:09:48.051 ERROR (MainThread) [homeassistant.components.websocket_api.http.connection] [140563092672704] 'Nhc2GenericFanFanEntity' object has no attribute '_preset_modes'
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/components/websocket_api/commands.py", line 230, in handle_call_service
    await hass.services.async_call(
  File "/usr/src/homeassistant/homeassistant/core.py", line 2035, in async_call
    response_data = await coro
                    ^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/core.py", line 2072, in _execute_service
    return await target(service_call)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/helpers/entity_component.py", line 235, in handle_service
    return await service.entity_service_call(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 876, in entity_service_call
    response_data = await _handle_entity_call(
                    ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 948, in _handle_entity_call
    result = await task
             ^^^^^^^^^^
  File "/config/custom_components/nhc2/entities/generic_fan_fan.py", line 93, in async_set_percentage
    self._device.set_fan_speed(self._gateway, percentage_to_ordered_list_item(self._preset_modes, percentage))
                                                                              ^^^^^^^^^^^^^^^^^^
AttributeError: 'Nhc2GenericFanFanEntity' object has no attribute '_preset_modes'

Home Assistant version: 2023.11.3

Let me know if you need any additional output.

tijsverkoyen commented 10 months ago

Can you share your device list please. See https://github.com/joleys/niko-home-control-II#i-need-to-see-the-device-list

davidvf commented 10 months ago

Can you share your device list please. See https://github.com/joleys/niko-home-control-II#i-need-to-see-the-device-list

Dropped you an email with the yaml file.

tijsverkoyen commented 10 months ago

First findings:

Way forward The Nhc2GenericFanFanEntity should be more robust. For instance:

Some questions for you @davidvf :

  1. I suspect you are not able to turn off the ventilation system through Niko or Renson itself?
  2. I suspect there are only 3 modes: Silent, Auto, Boost. Correct?
davidvf commented 10 months ago

Some questions for you @davidvf :

  1. I suspect you are not able to turn off the ventilation system through Niko or Renson itself?

Correct, i cannot turn it off.

  1. I suspect there are only 3 modes: Silent, Auto, Boost. Correct?

In the Niko app, if i select the ventilation, it indeed shows 3 different speeds i can select for the ventilation. Auto, Silent, Boost

So your suspicion is correct.

tijsverkoyen commented 10 months ago

@davidvf I have made some changes, which can be seen in https://github.com/joleys/niko-home-control-II/pull/97 Can you apply these changes and let me know if this works?

In your case:

davidvf commented 10 months ago

image

There are probably still some debug entries in the code, haven't checked it in detail, but i saw the following errors in the home-assistant logs:

2023-11-30 19:54:55.414 ERROR (Thread-11 (_thread_main)) [custom_components.nhc2.nhccoco.coco] 'NoneType' object has no attribute 'loop'
2023-11-30 19:55:23.408 ERROR (Thread-11 (_thread_main)) [custom_components.nhc2.nhccoco.coco] 'NoneType' object has no attribute 'states'
2023-11-30 19:56:51.877 ERROR (MainThread) [custom_components.nhc2.entities.generic_fan_fan] async_set_percentage: 100
2023-11-30 19:57:05.108 ERROR (MainThread) [custom_components.nhc2.entities.generic_fan_fan] async_set_percentage: 66
2023-11-30 19:57:25.137 ERROR (MainThread) [custom_components.nhc2.entities.generic_fan_fan] async_set_percentage: 66
2023-11-30 19:58:48.346 ERROR (MainThread) [custom_components.nhc2.entities.generic_fan_fan] async_set_percentage: 0
2023-11-30 19:58:54.201 ERROR (MainThread) [custom_components.nhc2.entities.generic_fan_fan] async_set_percentage: 100
2023-11-30 19:59:02.620 ERROR (MainThread) [custom_components.nhc2.entities.generic_fan_fan] async_set_percentage: 0
2023-11-30 20:00:47.131 ERROR (MainThread) [custom_components.nhc2.entities.generic_fan_fan] async_set_percentage: 66
2023-11-30 20:00:47.412 ERROR (MainThread) [custom_components.nhc2.entities.generic_fan_fan] async_set_percentage: 66
2023-11-30 20:03:41.796 ERROR (MainThread) [custom_components.nhc2.entities.generic_fan_fan] async_set_percentage: 33

Thanks for the quick fix!

tijsverkoyen commented 10 months ago

Thx for your feedback. I have created the v3.3.1 release. Which includes the required changes.