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

Service "remote.learn_command" does not work #276

Open
ReWiG opened this issue Dec 3, 2021 · 4 comments
Open

Service "remote.learn_command" does not work #276

ReWiG opened this issue Dec 3, 2021 · 4 comments
Labels
enhancement New feature or request

Comments

@ReWiG
Copy link

ReWiG commented Dec 3, 2021

I connected the "chuangmi.ir.v2" device to my HomeAssistant using the "MIOT" integration.
I want to teach him a few commands, for this I try to use the "remote.learn_command" service but it doesn't work and keeps giving an "Unknown error" error.
In this case, the following error is recorded in the log:

ERROR (MainThread) [homeassistant.components.websocket_api.http.connection] [1746101584] Error handling message: Unknown error
Traceback (most recent call last):
File "/srv/homeassistant/lib/python3.9/site-packages/homeassistant/components/websocket_api/decorators.py", line 26, in _handle_async_response
await func(hass, connection, msg)
File "/srv/homeassistant/lib/python3.9/site-packages/homeassistant/components/websocket_api/commands.py", line 523, in handle_execute_script
await script_obj.async_run(msg.get("variables"), context=context)
File "/srv/homeassistant/lib/python3.9/site-packages/homeassistant/helpers/script.py", line 1243, in async_run
await asyncio.shield(run.async_run())
File "/srv/homeassistant/lib/python3.9/site-packages/homeassistant/helpers/script.py", line 353, in async_run
await self._async_step(log_exceptions=False)
File "/srv/homeassistant/lib/python3.9/site-packages/homeassistant/helpers/script.py", line 371, in _async_step
await getattr(self, handler)()
File "/srv/homeassistant/lib/python3.9/site-packages/homeassistant/helpers/script.py", line 571, in _async_call_service_step
await service_task
File "/srv/homeassistant/lib/python3.9/site-packages/homeassistant/core.py", line 1495, in async_call
task.result()
File "/srv/homeassistant/lib/python3.9/site-packages/homeassistant/core.py", line 1530, in _execute_service
await handler.job.target(service_call)
File "/srv/homeassistant/lib/python3.9/site-packages/homeassistant/helpers/entity_component.py", line 213, in handle_service
await self.hass.helpers.service.entity_service_call(
File "/srv/homeassistant/lib/python3.9/site-packages/homeassistant/helpers/service.py", line 667, in entity_service_call
future.result() # pop exception if have
File "/srv/homeassistant/lib/python3.9/site-packages/homeassistant/helpers/entity.py", line 863, in async_request_call
await coro
File "/srv/homeassistant/lib/python3.9/site-packages/homeassistant/helpers/service.py", line 704, in _handle_entity_call
await result
File "/srv/homeassistant/lib/python3.9/site-packages/homeassistant/components/remote/init.py", line 202, in async_learn_command
await self.hass.async_add_executor_job(ft.partial(self.learn_command, **kwargs))
File "/usr/lib/python3.9/concurrent/futures/thread.py", line 52, in run
result = self.fn(*self.args, **self.kwargs)
File "/home/homeassistant/.homeassistant/custom_components/xiaomi_miot/remote.py", line 163, in learn_command
raise NotImplementedError()
NotImplementedError

@al-one al-one added bug Something isn't working enhancement New feature or request and removed bug Something isn't working labels Dec 3, 2021
al-one added a commit that referenced this issue Dec 3, 2021
@al-one
Copy link
Owner

al-one commented Dec 3, 2021

Added in c3bd723

service: remote.learn_command
data:
  entity_id: remote.chuangmi_v2_a0d5
  device: 666 # For store ir command, 1 - 1000000

https://github.com/rytilahti/python-miio/blob/master/miio/chuangmi_ir.py#L38-L50

@al-one
Copy link
Owner

al-one commented Dec 7, 2021

Does it work ?

@ReWiG
Copy link
Author

ReWiG commented Dec 7, 2021

Does it work ?

No. The error, of course, is gone and does not appear in the log anymore, but no action is taken when the service is called. I am trying to teach the remote a command, but I am not getting it in any way. Maybe I don’t understand how to use it?

@doobes
Copy link

doobes commented Dec 8, 2023

Has this been resolved?

I'm trying to use the service and I get the following:

"Failed to call service remote.learn_command. Unknown error"

Thanks

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

No branches or pull requests

3 participants