juanboro / cync2mqtt

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

TypeError: 'int' object is not subscriptable #2

Closed zimmra closed 2 years ago

zimmra commented 2 years ago

@juanboro I am Running into this after putting in my user/OTP/password

Traceback (most recent call last):
  File "/home/pi/venv/cync2mqtt/bin/get_cync_config_from_cloud", line 30, in <module>
    main()
  File "/home/pi/venv/cync2mqtt/bin/get_cync_config_from_cloud", line 22, in main
    yaml.dump(acync.app_meshinfo_to_configdict(meshinfo),fp)
  File "/home/pi/venv/cync2mqtt/lib/python3.9/site-packages/acync/__init__.py", line 97, in app_meshinfo_to_configdict
    id = int(bulb['deviceID'][-3:])
TypeError: 'int' object is not subscriptable
zimmra commented 2 years ago

@juanboro As you can see here, I modified the id line to remove the [-3:] subscript, which successfully generated a config., so I got one step further but now I am unable to connect, which was somewhat expected.

~ $ sudo ~/venv/cync2mqtt/bin/cync2mqtt  ~/cync_mesh2.yaml
2021-12-14 11:45:47,411 - cync2mqtt - INFO - Unable to connect to mesh mac: B3:2A:54:38:C1:A4
2021-12-14 11:45:57,620 - cync2mqtt - INFO - Unable to connect to mesh mac: 05:BE:4C:38:C1:A4
2021-12-14 11:46:08,410 - cync2mqtt - INFO - Unable to connect to mesh mac: A1:5D:4C:38:C1:A4

Not exactly sure what needs to be modified with it. I have the generated config linked here

Not sure if something is incorrect from the modification I made or if I am running into something else here. You can also see that not all of the bulbs attributes loaded, all of these bulbs but one support temperature, and the one odd-ball supports rgb which also isn't shown. But I can cross that bridge once I can connect to them

juanboro commented 2 years ago

Taking

@juanboro As you can see here, I modified the id line to remove the [-3:] subscript, which successfully generated a config., so I got one step further but now I am unable to connect, which was somewhat expected.

~ $ sudo ~/venv/cync2mqtt/bin/cync2mqtt  ~/cync_mesh2.yaml
2021-12-14 11:45:47,411 - cync2mqtt - INFO - Unable to connect to mesh mac: B3:2A:54:38:C1:A4
2021-12-14 11:45:57,620 - cync2mqtt - INFO - Unable to connect to mesh mac: 05:BE:4C:38:C1:A4
2021-12-14 11:46:08,410 - cync2mqtt - INFO - Unable to connect to mesh mac: A1:5D:4C:38:C1:A4

Not exactly sure what needs to be modified with it. I have the generated config linked here

Not sure if something is incorrect from the modification I made or if I am running into something else here. You can also see that not all of the bulbs attributes loaded, all of these bulbs but one support temperature, and the one odd-ball supports rgb which also isn't shown. But I can cross that bridge once I can connect to them

Taking a look. The ID they use is the last three digits --- but it looks like it already was cast into a json integer now. You might try this for that line:

id = int(str(bulb['deviceID'])[-3:])

I'll update it now.

zimmra commented 2 years ago

This generates config properly now (as far as I can tell)