My HA is mainly controling Broadlink switches and everything works exellent.
But after day or two one of the switches “stops” working and in log file I see following errors.
The problem disappears each time if I restart HA, everything back to work.
17-01-09 19:40:37 homeassistant.components.http: Serving /api/services/switch/turn_on to 3.23.24.143 (auth: True)
17-01-09 19:40:37 homeassistant.core: Bus:Handling <Event call_service[L]: service=turn_on, service_call_id=3052416464-45, service_data=entity_id=switch.ac, domain=switch>
17-01-09 19:40:37 homeassistant.core: Error doing job: Task exception was never retrieved
Traceback (most recent call last):
File “/usr/lib/python3.4/asyncio/tasks.py”, line 234, in _step
result = coro.throw(exc)
File “/usr/local/lib/python3.4/dist-packages/homeassistant/core.py”, line 1049, in _event_to_service_call
yield from service_handler.func(service_call)
File “/usr/local/lib/python3.4/dist-packages/homeassistant/components/switch/init.py”, line 87, in async_handle_switch_service
yield from switch.async_turn_on()
File “/usr/local/lib/python3.4/dist-packages/homeassistant/helpers/entity.py”, line 353, in async_turn_on
None, ft.partial(self.turn_on, **kwargs))
File “/usr/lib/python3.4/asyncio/futures.py”, line 386, in iter
yield self # This tells Task to wait for completion.
File “/usr/lib/python3.4/asyncio/tasks.py”, line 287, in _wakeup
value = future.result()
File “/usr/lib/python3.4/asyncio/futures.py”, line 275, in result
raise self._exception
File “/usr/lib/python3.4/concurrent/futures/thread.py”, line 54, in run
result = self.fn(*self.args, **self.kwargs)
File “/usr/local/lib/python3.4/dist-packages/homeassistant/components/switch/broadlink.py”, line 134, in turn_on
if self._sendpacket(self._command_on):
File “/usr/local/lib/python3.4/dist-packages/homeassistant/components/switch/broadlink.py”, line 148, in _sendpacket
self._device.send_data(packet)
File “/root/.homeassistant/deps/broadlink/init.py”, line 376, in send_data
self.send_packet(0x6a, packet)
File “/root/.homeassistant/deps/broadlink/init.py”, line 214, in send_packet
aes = AES.new(bytes(self.key), AES.MODE_CBC, bytes(self.iv))
File “/usr/local/lib/python3.4/dist-packages/Crypto/Cipher/AES.py”, line 95, in new
return AESCipher(key, *args, **kwargs)
File “/usr/local/lib/python3.4/dist-packages/Crypto/Cipher/AES.py”, line 59, in init
blockalgo.BlockAlgo.init(self, _AES, key, *args, **kwargs)
File “/usr/local/lib/python3.4/dist-packages/Crypto/Cipher/blockalgo.py”, line 141, in init
self._cipher = factory.new(key, *args, **kwargs)
ValueError: AES key must be either 16, 24, or 32 bytes long
I have just setup home assistant on my man mini. Running version 0.37.0 and I am still seeing the above behaviour.
Should I be running a dev version or are you saying dev version. 0.37.0 only came out a couple of days ago so not sure if your running this or dev version.
BTW - just setup homebridge. Having siri to control my switches is so cool.
Made changes as suggested to all my spmini switches. Bedroom Light has not failed yet but the issue appears to be rather intermittent. Noticed now however that the Lounge Light did fail after about 15-20 minutes.
Again for clarity sake I have the following configs for the spmini devices. Also including the customize section just so we have everything on these devices
On the Home Assistant web portal under states I see the switch but when I click on it, it goes to on mode briefly then flicks back to off. Does nothing to the actual switch itself.
Noticed this in the log file
17-02-01 08:33:05 ERROR (<concurrent.futures.thread.ThreadPoolExecutor object at 0x103f8c898>_5) [homeassistant.components.switch.broadlink] timed out
Not always the same device. Now its the dehumidifier switch.
Entry in log file
17-02-02 12:43:14 ERROR (<concurrent.futures.thread.ThreadPoolExecutor object at 0x103740a90>_1) [homeassistant.components.switch.broadlink] timed out
It happens on multiple switch with no set time till failure.
I dont send multiple commands in a script, It just happens. Can you suggest how I get more information from the log files. How do I turn on more detailed logging.
Have shown only the relevant sections for one of the switches below.
This one just failed. I am also experiencing the “OSError: [Errno 24] Too many open files” but this problem happens independently of the “too many open files” error. To get things working for the problem switch I just restart HA and it works.
The “too many open files” - requires a machine reboot. When this problem happens restarting HA also fails.
regarding too many open files, google it, there’s few solutions could be found of stackoverflow.
and for broadlink switches, my config looking like this: