Avi-On Component

Trying this component now that it has been released but cannot get it to work with a dimmer that I have. I see the following error in my logs. Anyone else tried this yet?

File "/home/homeassistant/.homeassistant/deps/avion/__init__.py", line 38, in __init__
self.password = csrmesh.network_key(password)
AttributeError: 'module' object has no attribute 'network_key'

@mjg59 When you worked on this component, was there anything else that you needed to do to get it working? I am using a Raspberry Pi 3. I have manually typed my passphrase into the init.py file and it continues but then gives me another error around bluepy. Any help would be appreciated

Post your configuration. It doesn’t appear that platform:avion uses a “network_key”. It does have an api_key…

Correct. I have the api key entered. Config below. Changed the MAC and api_key. Got these from the curl command listed in the component configuration. However, I have to remove the “| jq” to make this command work. I am able to get the passphrase from the output though and that is entered in the api_key section in the config below

light:
  platform: avion
  devices:
    00:00:00:00:00:00:
      name: Butlers Pantry
      api_key: <redacted>

And this is the error you’re still seeing?

Correct. I can manually enter the pass phrase in the file above where network key is listed but then it’s a completely different error. So I just reverted that file and waited for further assistance

Hopefully someone familiar with the component can chime in.

Thanks for the reply

Author of the csrmesh library here. This issue was a result of an API change made to the csrmesh library that python-avion depends on as of csrmesh 0.8 to add support for more than a single csrmesh device per network as well as to allow for communication with multiple classes of device. It looks like @mjg59 has updated his library to support the new API and I do not intend to make such radical API changes moving forwards unless there is a VERY pressing reason to do so. If you are still having trouble I should be able to help as well.

I’ll try it again. I had given up on the component since I couldn’t get it to work. I’ll report back after I enable it

still getting errors on startup with a raspberry pi 3.

config:

light:
  - platform: avion
devices:
  00:00:80:00:00:00:
    name: Butlers Pantry
    api_key: MyAPIKEY0000000==

Error

17-04-24 16:13:44 ERROR (MainThread) [homeassistant.components.light] Error while setting up platform avion
Traceback (most recent call last):
  File "/srv/homeassistant/homeassistant_venv/lib/python3.4/site-packages/homeassistant/helpers/entity_component.py", line 155, in _async_setup_platform
entity_platform.schedule_add_entities, discovery_info
  File "/usr/lib/python3.4/asyncio/futures.py", line 388, in __iter__
yield self  # This tells Task to wait for completion.
  File "/usr/lib/python3.4/asyncio/tasks.py", line 286, in _wakeup
value = future.result()
  File "/usr/lib/python3.4/asyncio/futures.py", line 277, 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 "/srv/homeassistant/homeassistant_venv/lib/python3.4/site-packages/homeassistant/components/light/avion.py", line 41, in setup_platform
light = AvionLight(device)
  File "/srv/homeassistant/homeassistant_venv/lib/python3.4/site-packages/homeassistant/components/light/avion.py", line 61, in __init__
self._switch = avion.avion(self._address, self._key)
  File "/home/homeassistant/.homeassistant/deps/avion/__init__.py", line 38, in __init__
self.password = csrmesh.network_key(password)

AttributeError: 'module' object has no attribute 'network_key'

Should be fixed in 0.44 once it’s out. Sorry, my fault for not making sure the dependencies were correct.

I tried it again. I’m now on 0.46.0 and here is the error I receive now

2017-06-06 15:27:33 ERROR (MainThread) [homeassistant.components.light] Error while setting up platform avion
Traceback (most recent call last):
File "/srv/homeassistant/homeassistant_venv/lib/python3.4/site-packages/homeassistant/helpers/entity_component.py", line 160, in _async_setup_platform
SLOW_SETUP_MAX_WAIT, loop=self.hass.loop)
File "/usr/lib/python3.4/asyncio/tasks.py", line 372, in wait_for
return fut.result()
File "/usr/lib/python3.4/asyncio/futures.py", line 277, 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 "/srv/homeassistant/homeassistant_venv/lib/python3.4/site-packages/homeassistant/components/light/avion.py", line 41, in setup_platform
light = AvionLight(device)
File "/srv/homeassistant/homeassistant_venv/lib/python3.4/site-packages/homeassistant/components/light/avion.py", line 62, in __init__
self._switch.connect()
File "/home/homeassistant/.homeassistant/deps/avion/__init__.py", line 40, in connect
self.device = btle.Peripheral(self.mac, addrType=btle.ADDR_TYPE_PUBLIC)
File "/home/homeassistant/.homeassistant/deps/bluepy/btle.py", line 318, in __init__
self.connect(deviceAddr, addrType, iface)
File "/home/homeassistant/.homeassistant/deps/bluepy/btle.py", line 353, in connect
self._startHelper()
File "/home/homeassistant/.homeassistant/deps/bluepy/btle.py", line 210, in _startHelper
universal_newlines=True)
File "/usr/lib/python3.4/subprocess.py", line 859, in __init__
restore_signals, start_new_session)
File "/usr/lib/python3.4/subprocess.py", line 1457, in _execute_child
raise child_exception_type(errno_num, err_msg)
OSError: [Errno 8] Exec format error

Can we just say that this plugin doesn’t work an a raspberry pi 3? Tried multiple times previously. Tried again after I noticed there was an update to the avi-on stuff with 0.49.0 and get different errors now.

2017-07-18 09:27:08 ERROR (MainThread) [homeassistant.components.light] Error while setting up platform avion
Traceback (most recent call last):
File "/srv/homeassistant/homeassistant_venv/lib/python3.4/site-packages/homeassistant/helpers/entity_component.py", line 164, in _async_setup_platform
SLOW_SETUP_MAX_WAIT, loop=self.hass.loop)
File "/usr/lib/python3.4/asyncio/tasks.py", line 372, in wait_for
return fut.result()
File "/usr/lib/python3.4/asyncio/futures.py", line 277, 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 "/srv/homeassistant/homeassistant_venv/lib/python3.4/site-packages/homeassistant/components/light/avion.py", line 41, in setup_platform
import avion
File "/home/homeassistant/.homeassistant/deps/avion/__init__.py", line 12, in <module>
from bluepy import btle
File "/home/homeassistant/.homeassistant/deps/bluepy/__init__.py", line 2, in <module>
from . import btle
File "/home/homeassistant/.homeassistant/deps/bluepy/btle.py", line 711, in <module>
AssignedNumbers = _UUIDNameMap( get_json_uuid() )
File "/home/homeassistant/.homeassistant/deps/bluepy/btle.py", line 692, in __init__
for uuid in idList:
File "/home/homeassistant/.homeassistant/deps/bluepy/btle.py", line 707, in get_json_uuid
for number,cname,name in uuid_data[k]:
ValueError: need more than 2 values to unpack