Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for AtlanticHeatRecoveryVentilation #379

Merged
merged 36 commits into from
Jun 14, 2022

Conversation

iMicknl
Copy link
Owner

@iMicknl iMicknl commented Feb 11, 2021

Fixes #376

@iMicknl iMicknl marked this pull request as ready for review May 28, 2021 14:51
@iMicknl iMicknl marked this pull request as draft August 4, 2021 19:28
Copy link
Collaborator

@vlebourl vlebourl left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is this still needed?

@tillstaff
Copy link
Contributor

I find a typo error in the pyoverkiz library ('O' is missing in VENTILATION) :
SET_VENTILATIN_MODE = "setVentilationMode"
The presets and cooling modes need this command to work properly.

ventilation_mode = self.executor.select_state(OverkizState.IO_VENTILATION_MODE)
prog = ventilation_mode.get(OverkizCommandParam.PROG)

if prog == OverkizCommandParam.PROG:
Copy link
Contributor

@tillstaff tillstaff Feb 23, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.


We have to replace "OverkizCommandParam.PROG" by "OverkizCommandParam.ON" because the value to compare is "on"

@iMicknl
Copy link
Owner Author

iMicknl commented Feb 23, 2022

I find a typo error in the pyoverkiz library ('O' is missing in VENTILATION) :

SET_VENTILATIN_MODE = "setVentilationMode"

The presets and cooling modes need this command to work properly.

Even though we need to fix this typo, this should not matter. The typo is only in our constant, not in the actual exposed value.

@vlebourl
Copy link
Collaborator

Even though we need to fix this typo, this should not matter. The typo is only in our constant, not in the actual exposed value.

But wouldn't that make that fail ?

        ventilation_mode = self.executor.select_state(OverkizState.IO_VENTILATION_MODE)

@tillstaff
Copy link
Contributor

tillstaff commented Feb 23, 2022

But wouldn't that make that fail ?

        ventilation_mode = self.executor.select_state(OverkizState.IO_VENTILATION_MODE)

Not this one, but the following command fail for sure :

        await self.executor.async_execute_command(
            OverkizCommand.SET_VENTILATION_MODE, ventilation_mode
        )

By the way, even with the correct command, there is an error from Cozytouch.
image

Copy link
Contributor

@tillstaff tillstaff left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @iMicknl,
Could you fix the typo error and update with the last commits from master build instead?

@tillstaff
Copy link
Contributor

By the way, even with the correct command, there is an error from Cozytouch. image

I think this error is linked to the following logs :

Logger: custom_components.tahoma
Source: helpers/update_coordinator.py:219
Integration: Overkiz (by Somfy) - Custom component
First occurred: March 16, 2022, 3:43:59 PM (14 occurrences)
Last logged: March 16, 2022, 4:49:39 PM

Error fetching device events data: Too many requests, try again later.
Logger: custom_components.tahoma.climate_devices.atlantic_electrical_heater_with_adjustable_temperature_setpoint
Source: custom_components/tahoma/climate_devices/atlantic_electrical_heater_with_adjustable_temperature_setpoint.py:158
Integration: Overkiz (by Somfy) - Custom component
First occurred: March 16, 2022, 3:43:59 PM (56 occurrences)
Last logged: March 16, 2022, 4:49:39 PM

Unable to update from sensor: could not convert string to float: 'unavailable'

The problem is that the "refresh" commands takes a lot of time to execute and it seems the cozytouch API refuse other requests during the execution.
Is it possible to add some delay to wait the end of the execution of "refresh" commands?

@iMicknl
Copy link
Owner Author

iMicknl commented Mar 31, 2022

@tillstaff this one is very hard for me to debug without actual access. Is this PR currently working or still broken?

I am looking if this one can be migrated to core as well.

@tillstaff
Copy link
Contributor

@tillstaff this one is very hard for me to debug without actual access. Is this PR currently working or still broken?

I am looking if this one can be migrated to core as well.

@iMicknl this PR is working, all the commands are working with the corrections in the last comments.

One of the log error can be solve with this change :
if state is None or state.state == STATE_UNAVAILABLE:
instead of if state is None or state.state == STATE_UNKNOWN:

For the other error log, I don't know how we can avoid the "too many request error".

…y_ventilation.py

Co-authored-by: tillstaff <tillstaff@gmail.com>
@iMicknl
Copy link
Owner Author

iMicknl commented Apr 2, 2022

Did you test the latest version? if state is None or state.state == STATE_UNAVAILABLE: this is not used anymore?

I just applied your suggestions. Could you check if everything works now? Does the too many request error happen a lot, or only during testing (when you reboot a lot) and maybe even have 2 installations running at the same time?

@tillstaff
Copy link
Contributor

Thanks for the commits, I will test this new build.

The correction if state is None or state.state == STATE_UNAVAILABLE: has to be applied in another climate device, click the following link : if state is None or state.state == STATE_UNKNOWN:
I don't know if it replaces STATE_UNKNOWN or if we have to add it after.

The log error "too many request" appears each time I change the preset or the fan-mode.
Adding some delay with time.sleep(3) helps a lot, but I don't know if it's a good solution.

@iMicknl
Copy link
Owner Author

iMicknl commented Apr 2, 2022

The correction if state is None or state.state == STATE_UNAVAILABLE: has to be applied in another climate device, click the following link : if state is None or state.state == STATE_UNKNOWN:
I don't know if it replaces STATE_UNKNOWN or if we have to add it after.

We moved away from this part of the code, thus when we add it to core, this will be fixed as well.

The log error "too many request" appears each time I change the preset or the fan-mode.
Adding some delay with time.sleep(3) helps a lot, but I don't know if it's a good solution.

I will have a look, in the end we should group these commands in a single call.. Are the refresh calls needed?

@tillstaff
Copy link
Contributor

The log error "too many request" appears each time I change the preset or the fan-mode.
Adding some delay with time.sleep(3) helps a lot, but I don't know if it's a good solution.

I will have a look, in the end we should group these commands in a single call.. Are the refresh calls needed?

Yes, there are needed. I made some tests without them and the states of the VMC were totally wrong after that.

I made some new traces with the cozytouch app and I confirm that the two first commands (setVentilationMode and setVentilationConfigurationMode) are send in a single call and the two refresh commands are send later in a single call (1.5 seconds after the end of execution of the first commands).

9:12:18.700 (end at 9:12:19.372) : INFO (MainThread) [custom_components.tahoma] HistoryExecution(id='ebb1490a-d9b6-8679-6435-065e846e8db3', event_time=1648926738700, owner=GACOMA_Production_24148, source='mobile:mobile', end_time=1648926739372, effective_start_time=1648926738700, duration=672, label='Android 3.1.0#310 Set device mode : PROG', type='Immediate execution - MANUAL_CONTROL', state=<ExecutionState.COMPLETED: 'COMPLETED'>, failure_type='NO_FAILURE', commands=[HistoryExecutionCommand(device_url=io://****-****-6923/15021786#1, command='setVentilationMode', rank=0, dynamic=False, state=<ExecutionState.COMPLETED: 'COMPLETED'>, failure_type='NO_FAILURE', parameters=[{'test': 'off', 'end_of_line_test': 'off', 'leap_year': 'off', 'prog': 'on', 'month': 4, 'day_night': 'night', 'cooling': 'off', 'day': 2}]), HistoryExecutionCommand(device_url=io://****-****-6923/15021786#1, command='setVentilationConfigurationMode', rank=1, dynamic=False, state=<ExecutionState.COMPLETED: 'COMPLETED'>, failure_type='NO_FAILURE', parameters=['standard'])], execution_type=<ExecutionType.IMMEDIATE_EXECUTION: 'Immediate execution'>, execution_sub_type=<ExecutionSubType.MANUAL_CONTROL: 'MANUAL_CONTROL'>)

9:12:20.696 (end at 9:12:21.878) : INFO (MainThread) [custom_components.tahoma] HistoryExecution(id='ebb150d7-d9b6-8679-6435-065e5d6e26c1', event_time=1648926740696, owner=GACOMA_Production_24148, source='mobile:mobile', end_time=1648926741878, effective_start_time=1648926740697, duration=1181, label='Android 3.1.0#310 null', type='Immediate execution - MANUAL_CONTROL', state=<ExecutionState.COMPLETED: 'COMPLETED'>, failure_type='NO_FAILURE', commands=[HistoryExecutionCommand(device_url=io://****-****-6923/15021786#1, command='refreshVentilationState', rank=0, dynamic=False, state=<ExecutionState.COMPLETED: 'COMPLETED'>, failure_type='NO_FAILURE', parameters=[]), HistoryExecutionCommand(device_url=io://****-****-6923/15021786#1, command='refreshVentilationConfigurationMode', rank=1, dynamic=False, state=<ExecutionState.COMPLETED: 'COMPLETED'>, failure_type='NO_FAILURE', parameters=[])], execution_type=<ExecutionType.IMMEDIATE_EXECUTION: 'Immediate execution'>, execution_sub_type=<ExecutionSubType.MANUAL_CONTROL: 'MANUAL_CONTROL'>)

Can we build the same commands requests?

@tillstaff
Copy link
Contributor

Hello @iMicknl and @tetienne,
Is it possible to add this PR to the master branch?
Some commands are not working well and need a way to send two commands in one request, but all is ok for the other commands.

@iMicknl
Copy link
Owner Author

iMicknl commented Jun 14, 2022

@tetienne if you can approve, I will merge. Perhaps we can bring this one to core a well?

)
prog = ventilation_mode.get(OverkizCommandParam.PROG)

if prog == OverkizCommandParam.ON:
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can use a dict here no?

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I will have a look, thanks!

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@tetienne you mean a dict for ventilation_configuration? Since we need to check from two values. (prog and ventilation_configuration).

_attr_hvac_modes = [HVAC_MODE_FAN_ONLY]
_attr_preset_modes = [PRESET_AUTO, PRESET_PROG, PRESET_MANUAL]
_attr_temperature_unit = TEMP_CELSIUS
_attr_supported_features = SUPPORT_PRESET_MODE | SUPPORT_FAN_MODE
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can use ClimateEntityFeatures here

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I will do that for core, but otherwise I need to bump the custom component version etc. :D

@tetienne
Copy link
Collaborator

OK to be merged.

@iMicknl iMicknl merged commit 69f9a2d into master Jun 14, 2022
@iMicknl iMicknl deleted the feature/AtlanticHeatRecoveryVentilation branch June 14, 2022 16:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add support for Atlantic Optimocosy - Double Flow CMV (io:AtlanticHeatRecoveryVentilationIOComponent)
5 participants