Closed jphoke closed 12 months ago
Well that's odd. The crashing code is here:
module_list = data.get("module", [])
for module in module_list:
name = module["name"]
if name.startswith("ams/"):
index = int(name[4])
# Sometimes we get incomplete version data. We have to skip if that occurs since the serial number is
# requires as part of the home assistant device identity.
if not module['sn'] == '':
# May get data before info so create entry if necessary
if len(self.data) <= index:
received_ams_info = True
self.data.append(AMSInstance())
if self.data[index].serial != module['sn']: // FAILS HERE
received_ams_info = True
self.data[index].serial = module['sn']
But from the config data you provided has: { "hw_ver": "AMS08", "name": "ams/0", "sn": "REDACTED", "sw_ver": "00.00.06.40" }, { "hw_ver": "AMS08", "name": "ams/1", "sn": "REDACTED", "sw_ver": "00.00.06.40" },
So we'd get index = 0 initially while the length of the ams instance list is zero (empty). So we'd add an entry. At which point the failing line shouldn't get an index out of range error. And on the second loop through we'd have index == 1 and since 1 <= 1 we'd add another AMSInstance and then the failing line should succeed again. I don't see how it could be failing the way it clearly is.
Adrian -- hhmmmmm
This printer had 2 AMS connected, one is Dead waiting on RMA from BL ... It looks like it still sees it SHOULD be there but it is not physically attached... I'll run some more tests when I get back from work tonight ... maybe attaching it even if it is error coding will get it along....
That said -- if that is the case ... that would be odd that you cannot remove/add/swap AMS units but one thing at a time :)
I would expect that if the AMS isn't physically attached (vs attached but dead/misbehaving) that we'd see just a single AMS in the version data. We definitely should handle this without throwing an exception. Both AMSs are still listed in both the version data and the general state data that you provided.
I did, however, make a mistake early on and chose unique IDs for AMSs that mean we can't reliably handle AMSs being added/removed as they may change IDs when you do that. And I haven't yet worked out how to get HA to let me fix up device/entity naming mistakes without leaving everyone with dead devices/entities they have to manually delete.
Thanks -- Im working and away from the house until tonight (after 7p NY time) I'll see if I can run a few variations and update with the logs ...
I did look back at the pics I took of the X1C screen ... the 2nd AMS is listed on the device but not connected in any fashion -- may do a hard reset and see if its a BL bug too
I just got my X1C and had no issues adding it. I think what must have happened is that your AMS was in bad state such that the first one (ams/0) was missing from the version info list while the second one (ams/1) was still present. I can make a code change to be resilient to that. It's the only way I can see that particular code hitting that particular error. This is definitely not the case in your later logs though.
Describe the bug
Just moved over from the MQTT integration to the HACS path for ease of management ...
I have two printers, installed the HACS integration, all the other req's and have one printer all set and configured without issue. I am trying to add a printer via the Integration's Add Entry flow, and I enter the 2nd printer's Serial#, IP Address and LAN Code. It errors out as below every time
I have tried again with debug logging enabled (attached) home-assistant_bambu_lab_2023-11-16T22-46-47.793Z.log
To Reproduce
Navigate Settings > Devices & Services > Bambu Lab On Integration Entries Page Click "Add Entry" to add a second printer Follow prompts and input Serial Number, IP Address and LAN Code Hit Next Errors Out
Expected Behaviour
To configure and include 2nd printer into HA
What device are you using?
X1C
Diagnostic Output
Log Extracts
Other Information
No response