as the guide says in the service menu of homeassistant i used the learn_command_ipaddress to learn my remote code… but nothing appears… and watching my logs i can see this:
2017-08-29 17:07:00 INFO (MainThread) [homeassistant.core] Bus:Handling <Event call_service[L]: service_call_id=1974081712-1011, service=learn_command_192_168_1_189, service_data=, domain=chuangmi>
2017-08-29 17:07:05 ERROR (MainThread) [miio.miio] got error when receiving: timed out
2017-08-29 17:07:06 ERROR (MainThread) [homeassistant.core] Error doing job: Task exception was never retrieved
Traceback (most recent call last):
File “/usr/lib/python3.4/asyncio/tasks.py”, line 237, in _step
result = next(coro)
File “/srv/homeassistant/lib/python3.4/site-packages/homeassistant/core.py”, line 1025, in _event_to_service_call
yield from service_handler.func(service_call)
File “/home/homeassistant/.homeassistant/custom_components/switch/chuangmi_ir.py”, line 67, in _learn_command
ir_remote.send(“miIO.ir_learn”, {‘key’: str(key)})
File “/srv/homeassistant/lib/python3.4/site-packages/miio/miio.py”, line 128, in send
data, addr = s.recvfrom(1024)
socket.timeout: timed out
2017-08-29 17:07:06 ERROR (MainThread) [homeassistant.core] Timer got out of sync. Resetting
@syssi this is the output when i try to learn a remote:
2017-08-30 17:12:13 ERROR (MainThread) [miio.miio] got error when receiving: timed out
2017-08-30 17:12:13 ERROR (MainThread) [homeassistant.core] Error doing job: Task exception was never retrieved
Traceback (most recent call last):
File "/usr/lib/python3.4/asyncio/tasks.py", line 237, in _step
result = next(coro)
File "/srv/homeassistant/lib/python3.4/site-packages/homeassistant/core.py", line 1025, in _event_to_service_call
yield from service_handler.func(service_call)
File "/home/homeassistant/.homeassistant/custom_components/switch/chuangmi_ir.py", line 67, in _learn_command
ir_remote.send("miIO.ir_learn", {'key': str(key)})
File "/srv/homeassistant/lib/python3.4/site-packages/miio/miio.py", line 128, in send
data, addr = s.recvfrom(1024)
socket.timeout: timed out
2017-08-30 17:12:14 ERROR (MainThread) [homeassistant.core] Timer got out of sync. Resetting
this is when i try to send a ir command
2017-08-30 17:16:13 ERROR (MainThread) [miio.miio] got error when receiving: timed out
2017-08-30 17:16:13 ERROR (MainThread) [homeassistant.core] Error doing job: Task exception was never retrieved
Traceback (most recent call last):
File "/home/homeassistant/.homeassistant/custom_components/switch/chuangmi_ir.py", line 98, in _send_packet
ir_remote.send("miIO.ir_play", {'freq':38400, 'code': str(packet)})
File "/srv/homeassistant/lib/python3.4/site-packages/miio/miio.py", line 128, in send
data, addr = s.recvfrom(1024)
socket.timeout: timed out
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/usr/lib/python3.4/asyncio/tasks.py", line 237, in _step
result = next(coro)
File "/srv/homeassistant/lib/python3.4/site-packages/homeassistant/core.py", line 1025, in _event_to_service_call
yield from service_handler.func(service_call)
File "/usr/lib/python3.4/asyncio/coroutines.py", line 141, in coro
res = func(*args, **kw)
File "/home/homeassistant/.homeassistant/custom_components/switch/chuangmi_ir.py", line 100, in _send_packet
except (socket.timeout, ValueError):
NameError: name 'socket' is not defined
2017-08-30 17:16:13 ERROR (MainThread) [homeassistant.core] Timer got out of sync. Resetting
I think changing the timeout doesn’t help because the timeout is used at L71 and the code fails at L68 already.
@hangy Could you try to change the following line:
Increase the timeout a bit (10 seconds?) for testing. This timeout is applied here and later used at L128. The implementation and used library is pretty old… I will try to rewrite the component this weekend.
Sorry, I didn’t get the thread notification until late night, although I see that you solved it.
I am using the same component by SchumiHao, and I got that error only twice: once when I hadn’t set the timeout parameter and another time that I couldn’t understand why. I solved this last one by rebooting my router.
i have tried this and learn_command works perfect, but when i try to send_command i get this error:
2017-09-03 13:15:09 ERROR (MainThread) [mirobo.device] Unable to discover a device at address 192.168.1.143
2017-09-03 13:15:09 ERROR (MainThread) [homeassistant.core] Error doing job: Task exception was never retrieved
Traceback (most recent call last):
File “/usr/lib/python3.4/asyncio/tasks.py”, line 237, in _step
result = next(coro)
File “/srv/homeassistant/homeassistant_venv/lib/python3.4/site-packages/homeassistant/core.py”, line 1025, in _event_to_service_call
yield from service_handler.func(service_call)
File “/usr/lib/python3.4/asyncio/coroutines.py”, line 141, in coro
res = func(*args, **kw)
File “/home/homeassistant/.homeassistant/custom_components/switch/chuangmi_ir.py”, line 101, in _send_packet
“miIO.ir_play”, {‘freq’: 38400, ‘code’: str(packet)})
File “/srv/homeassistant/homeassistant_venv/lib/python3.4/site-packages/mirobo/device.py”, line 120, in send
self.do_discover()
File “/srv/homeassistant/homeassistant_venv/lib/python3.4/site-packages/mirobo/device.py”, line 72, in do_discover
raise DeviceException(“Unable to discover the device %s” % self.ip)
mirobo.device.DeviceException: Unable to discover the device 192.168.1.143
2017-09-03 13:15:09 ERROR (MainThread) [homeassistant.core] Timer got out of sync. Resetting
Yes, it works with that command. I’ve replaced [] to {} to make it work.
Now, back in homeassistant, when i try to send this same captured command, the blue led flashed several times and then it turned off. I’ve must to reset manually the chuangmi_ir to make it be usable again.
i’ve updated the python-miio and python-mirobo to version 0.0.11 and 0.1.4.