juanboro / cync2mqtt

Bridge Cync bluetooth mesh to mqtt
41 stars 7 forks source link

KeyError: 'bulbs' #24

Open CaptainN opened 2 months ago

CaptainN commented 2 months ago

Hi! I followed the guides for both venv and docker, and both lead me to the same error. Any idea what's up?

kevin@ha:~$ ~/venv/cync2mqtt/bin/cync2mqtt  ~/cync_mesh.yaml
Process Process-1:
Traceback (most recent call last):
  File "/usr/lib/python3.9/multiprocessing/process.py", line 315, in _bootstrap
    self.run()
  File "/usr/lib/python3.9/multiprocessing/process.py", line 108, in run
    self._target(*self._args, **self._kwargs)
  File "/home/kevin/venv/cync2mqtt/bin/cync2mqtt", line 378, in run_in_subprocess
    asyncio.run(cm.run_mqtt(),debug=(args.log_level.upper()=='DEBUG'))
  File "/usr/lib/python3.9/asyncio/runners.py", line 44, in run
    return loop.run_until_complete(main)
  File "/usr/lib/python3.9/asyncio/base_events.py", line 642, in run_until_complete
    return future.result()
  File "/home/kevin/venv/cync2mqtt/bin/cync2mqtt", line 288, in run_mqtt
    self.meshnetworks.populate_from_configdict(self.configdict)
  File "/home/kevin/venv/cync2mqtt/lib/python3.9/site-packages/acync/__init__.py", line 140, in populate_from_configdict
    for bulb in mesh['bulbs'].values():
KeyError: 'bulbs'

I appreciate any help!

juanboro commented 2 months ago

Can you send the content of cync_mesh.yaml (with the MAC addresses/and keys XX out)?

I'll take a look.

CaptainN commented 2 months ago

Here is is:

meshconfig:
  1226357509:
    access_key: 777
    mac: XXXXXXX
    name: XXXXXXX
  1286718809:
    access_key: 777
    mac: XXXXXXX
    name: XXXXXXX
  1333061485:
    access_key: 777
    mac: XXXXXXX
    name: XXXXXXX
  1409876883:
    access_key: 777
    mac: XXXXXXX
    name: XXXXXXX
  1601122146:
    access_key: 777
    mac: XXXXXXX
    name: XXXXXXX
  1613912743:
    access_key: XXXXXXX
    bulbs:
      1:
        mac: XXXXXXX
        name: Bathroom Light North East
        supports_rgb: true
        supports_temperature: true
      2:
        mac: XXXXXXX
        name: Basement Light Stairs
        supports_rgb: true
        supports_temperature: true
      3:
        mac: XXXXXXX
        name: Basement Light 3
        supports_rgb: true
        supports_temperature: true
      4:
        mac: XXXXXXX
        name: Basement Light Sout East
        supports_rgb: true
        supports_temperature: true
      5:
        mac: XXXXXXX
        name: Kitchen Floodlight 2
        supports_temperature: true
      6:
        mac: XXXXXXX
        name: Kitchen Floodlight 1
        supports_temperature: true
      7:
        mac:XXXXXXX
        name: Basement Light 5
        supports_rgb: true
        supports_temperature: true
    mac: XXXXXXX
    name: Home
  1808127672:
    access_key: 777
    mac: XXXXXXX
    name: XXXXXXX
  1912083427:
    access_key: 777
    mac: XXXXXXX
    name: XXXXXXX
mqtt_url: mqtt://kevin:password@127.0.0.1:1883/

Thanks again!

CaptainN commented 2 months ago

I edited out the stuff that doesn't look like anything your example, and then got a different message - simply, unable to connect to mesh.

acync.mesh - INFO - Unable to connect to mesh mac:

Bummer.

The updated config:

meshconfig:
  1613912743:
    access_key: XXXXXXX
    bulbs:
      1:
        mac: XXXXXXX
        name: Bathroom Light North East
        supports_rgb: true
        supports_temperature: true
      2:
        mac: XXXXXXX
        name: Basement Light Stairs
        supports_rgb: true
        supports_temperature: true
      3:
        mac: XXXXXXX
        name: Basement Light 3
        supports_rgb: true
        supports_temperature: true
      4:
        mac: XXXXXXX
        name: Basement Light Sout East
        supports_rgb: true
        supports_temperature: true
      5:
        mac: XXXXXXX
        name: Kitchen Floodlight 2
        supports_temperature: true
      6:
        mac: XXXXXXX
        name: Kitchen Floodlight 1
        supports_temperature: true
      7:
        mac:XXXXXXX
        name: Basement Light 5
        supports_rgb: true
        supports_temperature: true
    mac: XXXXXXX
    name: Home
mqtt_url: mqtt://kevin:password@127.0.0.1:1883/
juanboro commented 2 months ago

Yeah - that seems like it should have worked. I plan to do a bunch of updates hopefully soon to add more robust connection options. One thing to try is see if adding usebtlib: bluepy to the yaml makes a difference.

CaptainN commented 2 months ago

I did try bluepy, it doesn't seem to make a difference. I ordered an outdated G by CE bulb from ebay - hoping that'll make connecting to the mesh a bit easier. Will let you know how it goes!

CaptainN commented 1 month ago

I got the old bulb, still can't connect. I wonder if my bluetooth dongle is the issue.

wearrrrr commented 1 month ago

I'm getting the same error, here is my yaml, seems pretty identical. I'm using Intel BT if that helps at all!

meshconfig:
  316356668:
    access_key: XXXXX
    mac: XXXXX
    name: XXXXX
  441483036:
    access_key: XXXXX
    mac: XXXXX
    name: XXXXX
  1364391871:
    access_key: XXXXX
    bulbs:
      1:
        mac: XXXXX
        name: Ceiling Fan 1
        supports_rgb: true
        supports_temperature: true
      2:
        mac: XXXXX
        name: Ceiling Fan 2
        supports_rgb: true
        supports_temperature: true
      3:
        mac: XXXXX
        name: Ceiling Fan 3
        supports_rgb: true
        supports_temperature: true
    mac: XXXXX
    name: Home
  1882501669:
    access_key: XXXXX
    mac: XXXXX
    name: XXXXX
mqtt_url: mqtt://127.0.0.1:1883/

Adding usebtlib: bluepy didn't help also, definitely a strange error.

wearrrrr commented 1 month ago

If it helps, I'm using a "Full Color Direct Connect Smart Bulb (A19)" on firmware version 1.0.372