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

XiaomiGenericDevice.async_turn_on() takes from 1 to 2 positional arguments but 3 were given #239

Closed
wokkeltje13 opened this issue Dec 9, 2023 · 11 comments

Comments

@wokkeltje13
Copy link

Since HA 2023.12 I receive an error when turning on the fan. Turning off is working.
I receive the following log entry.

`Logger: homeassistant.components.websocket_api.http.connection
Source: components/websocket_api/commands.py:238
Integration: Home Assistant WebSocket API (documentation, issues)
First occurred: 07:05:46 (6 occurrences)
Last logged: 11:39:33

[140603200636608] XiaomiGenericDevice.async_turn_on() takes from 1 to 2 positional arguments but 3 were given
[140603187250112] XiaomiGenericDevice.async_turn_on() takes from 1 to 2 positional arguments but 3 were given
[140602901802944] XiaomiGenericDevice.async_turn_on() takes from 1 to 2 positional arguments but 3 were given
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/components/websocket_api/commands.py", line 238, in handle_call_service
response = await hass.services.async_call(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/core.py", line 2067, in async_call
response_data = await coro
^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/core.py", line 2104, in _execute_service
return await target(service_call)
^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/helpers/entity_component.py", line 272, in handle_service
return await service.entity_service_call(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 878, in entity_service_call
single_response = await _handle_entity_call(
^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 948, in _handle_entity_call
result = await task
^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/components/fan/init.py", line 305, in async_handle_turn_on_service
await self.async_turn_on(percentage, preset_mode, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
TypeError: XiaomiGenericDevice.async_turn_on() takes from 1 to 2 positional arguments but 3 were given
`

@ankitmehtame
Copy link

I have the same error, downgraded to 2023.11 (works fine with 2023.11)

@syssi
Copy link
Owner

syssi commented Dec 10, 2023

I will prepare a 2023.12 compatible release as soon as possible.

@ostracizado
Copy link

ostracizado commented Dec 11, 2023

For now simply change the automation or script to fan: set speed X%; instead of fan: turn on.

@rothconsulting
Copy link

rothconsulting commented Dec 14, 2023

Had the same problem.

Problem cause appears to be this:
home-assistant/core@953a212

To fix in this project:
In line 635 of fan.py an additional argument is required to make it work again.

#    async def async_turn_on(self, speed: str = None, **kwargs) -> None:
#    Fix for HA 2023.12.2 where turn_on would not work anymore.
    async def async_turn_on(self, speed: str = None, mode: str = None, **kwargs) -> None:

@syssi syssi closed this as completed in a2ed36c Dec 14, 2023
@wokkeltje13
Copy link
Author

Tnx, this fix seems to work, when will this be released?

@syssi
Copy link
Owner

syssi commented Dec 16, 2023

I will prepare a release soon.

@syssi
Copy link
Owner

syssi commented Dec 20, 2023

I've prepared a new release. Please give it a try!

@wokkeltje13
Copy link
Author

I see some errors and fan is unavailable now

Logger: miio.miioprotocol
Source: /usr/local/lib/python3.11/site-packages/miio/miioprotocol.py:240
First occurred: 20:00:13 (3 occurrences)
Last logged: 20:01:33

Got error when receiving: timed out

Logger: homeassistant.helpers.entity
Source: helpers/entity.py:929
First occurred: 20:00:53 (2 occurrences)
Last logged: 20:01:23

Update of fan.ventilator_bureau is taking over 10 seconds

Logger: miio.miioprotocol
Source: /usr/local/lib/python3.11/site-packages/miio/miioprotocol.py:240
First occurred: 20:00:13 (3 occurrences)
Last logged: 20:01:33

Got error when receiving: timed out

@syssi
Copy link
Owner

syssi commented Dec 20, 2023

Are you sure your fan isn't in deep sleep? Are you able to ping the device?

@wokkeltje13
Copy link
Author

Sorry fan changed its IP because of some network maintenance today. Can be closed.

@NzKyle
Copy link

NzKyle commented Dec 20, 2023

I've prepared a new release. Please give it a try!

Looks to be working on my side now - thanks! 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants