XKNX / xknxproject

ETS project parser written in python
GNU General Public License v2.0
84 stars 17 forks source link

knxproj import error: ModuleInstance not found for ComObjectInstanceRef #477

Open t3g opened 2 weeks ago

t3g commented 2 weeks ago

Hi xknx team,

at first I have 2 say: you do an awesome job!!! Since february, I am not able to import knxproj files any more. At first, I thought, I did sth. wrong (in ETS), but afterwards, I saw others having problems... But I waited... I tried getting useful error messages, but had no luck.

I have the following setting: ETS: 6.2.2, HASSOS: 13.1 (Linux VM in Unraid); HA Core: 2024.10.1

NOW, from V 2024.10. on, I can see the following error message: "ModuleInstance not found for ComObjectInstanceRef self.ref_id='MD-2_M-22_MI-1_O-2-31_R-3' self.text='Kanal E / F: 1 EG-2 Wohnzimmer Raff-beweg' of application M-0083A-00C0-40-438F" image

Here comes a screenshot, of the ETS communication object bindings: image

I also have renamed the knxproj file to *.zip, checked the xml files, but also had no luck to dig into the problem...

At first I thought it has sth. to do with upload limits, nginx and so on...

If you need more Info, like the project file, pls let me know!

farmio commented 2 weeks ago

Thanks for reporting! This seems to be the same issue as https://github.com/home-assistant/core/issues/124920 Meanwhile I do already have a project that raises the same error. But haven't had the time to solve it properly.

PS. if you encounter a bug, better report early - we can't fix what we don't know. And there may be ways to get detailed log messages for some cases.

t3g commented 2 weeks ago

Thanks for the hint, in future I will report earlier!

It is possible that it comes from the output, that is created by the mdt device, like in the other issue. The parsing error is produced in this case with a "MDT AKU-2416.03" with the latest firmware.

farmio commented 2 weeks ago

Yes, M-0083 is the manufacturer code for MDT.

t3g commented 2 weeks ago

Now I am a big step ahead: I replaced the AKU (like andynolle did in the other issue) from the catalogue in Version 4.0 with the one that is 4.1. (firmware version on the device itself is 5.6)

And now the import worked!

The main difference, I saw while transferring my bunch of addresses and settings, was this value: 4.0 (integer and string of the unit mixed): image 4.1 (integer only; unit behind the input field): image

After recreating everything, I deleted all GAs of the "old" device and resetted the channel functions and then, I tried to delete it - but ETS threw an error:

System.Collections.Generic.KeyNotFoundException: Der angegebene Schlüssel war nicht im Wörterbuch angegeben. bei System.Collections.Generic.SortedList2.get_Item(TKey key) bei Knx.Ets.ObjectModel.DomDictionaryWithIndexer.get_Item(Id key) bei Knx.Ets.ObjectModel.DomCollection.DynamicAndStaticListWrapper.get_Item(Id key) bei Knx.Ets.ObjectModel.DomCollection.ById[T](Id id) bei Knx.Ets.ObjectModel.Project.DeviceCollection.get_Item(Id id) bei Knx.Ets.ObjectModel.Extensions.GroupAddressExtensions.GetConnectedGroupObjects(IGroupAddress groupAddress) bei Knx.Ets.ObjectModel.Operations.KnxSecure.SecurityCfgFlagService.InternalExecute(GroupAddress groupAddress, IEnumerable1 excludedConnectors, IEnumerable1 excludedBusInterfaces, IEnumerable1 excludedDevices) bei Knx.Ets.ObjectModel.Operations.KnxSecure.SecurityCfgFlagService.Execute(GroupAddress groupAddress, IEnumerable1 excludedConnectors) bei Knx.Ets.ObjectModel.Operations.KnxSecure.DeleteSecurityValidator.SpecializedExecute() bei Knx.Ets.ObjectModel.Operations.KnxSecure.SecurityValidatorBase.ExecuteSecurityImpacts() bei Knx.Ets.ObjectModel.Operations.DeleteOperation.SpecializedExecute() bei Knx.Ets.ObjectModel.Operations.Devices.DeleteDeviceOperation.SpecializedExecute() bei Knx.Ets.ObjectModel.Operations.Operation.a() bei Knx.Ets.ObjectModel.WithTransaction.<>cDisplayClass0_0.b0() bei Knx.Ets.ObjectModel.OnTransaction.Do(Action action, String rootPath) bei Knx.Ets.ObjectModel.WithTransaction.Do(IEnlistmentNotification this, Action action, String rootPath) bei Knx.Ets.ObjectModel.Operations.Operation.b() bei Knx.Ets.ObjectModel.Operations.OperationExtensions.HandleOperationCancel(IOperation this, Action action, String description) bei Knx.Ets.ObjectModel.Operations.Operation.Execute() bei Knx.Ets.ViewModel.Application.Wizards.GenericWizardPageViewModel.ExecuteOperation(IOperation o) bei Knx.Ets.ViewModel.Application.Wizards.GenericWizardPageViewModel.<>cDisplayClass32_0.b3() bei Knx.Ets.ViewModel.Application.Wizards.ImportWizard.Commands.AsyncStep.OnExecute() bei System.Threading.Tasks.Task.InnerInvoke() bei System.Threading.Tasks.Task.Execute() --- Ende der Stapelüberwachung vom vorhergehenden Ort, an dem die Ausnahme ausgelöst wurde --- bei System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) bei System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) bei System.Runtime.CompilerServices.TaskAwaiter.GetResult() bei Knx.Ets.ViewModel.Tools.AsyncCpuBoundCommand.d__9.MoveNext()`

--> I was not able to delete this device and probably there is sth. wrong with it, that breaks your importer.

edit: If there are no GAs connected, I could change the Application proggram version from 4.0 to 4.1 (this screenshot is from my backup and the old devices' settings with connected GAs - that's why it is grayed out): image Afterwards, I was able to delete it! --> the more and more I think of it, I believe it has nothing to do with your parser...

farmio commented 2 weeks ago

Well, it would be nice if the parser was resilient enough to cope with whatever those Banana-software companies throw at us 🍌🙃

siftbo commented 1 week ago

I have exactly the same problem. I tested it outside of the Home Assistant with current version of the library and got the following exception:

 File "/Users/tobiasbaumgart/dev/knxproject-test/test.py", line 10, in <module>
    project: KNXProject = knxproj.parse()
                          ^^^^^^^^^^^^^^^
  File "/Users/tobiasbaumgart/dev/knxproject-test/.venv/lib/python3.12/site-packages/xknxproject/xknxproj.py", line 42, in parse
    project = XMLParser(knx_project_content).parse(self.language)
              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/tobiasbaumgart/dev/knxproject-test/.venv/lib/python3.12/site-packages/xknxproject/xml/parser.py", line 143, in parse
    self._load(language=language)
  File "/Users/tobiasbaumgart/dev/knxproject-test/.venv/lib/python3.12/site-packages/xknxproject/xml/parser.py", line 248, in _load
    device.merge_application_program_info(_application)
  File "/Users/tobiasbaumgart/dev/knxproject-test/.venv/lib/python3.12/site-packages/xknxproject/models/models.py", line 201, in merge_application_program_info
    com_instance.apply_module_base_number_argument(
  File "/Users/tobiasbaumgart/dev/knxproject-test/.venv/lib/python3.12/site-packages/xknxproject/models/models.py", line 543, in apply_module_base_number_argument
    raise UnexpectedDataError(
xknxproject.exceptions.exceptions.UnexpectedDataError: ModuleInstance not found for ComObjectInstanceRef self.ref_id='MD-4_M-37_MI-1_O-2-20_R-32' self.text='Kanal A / B: JAL Sitzfenster' of application M-0083_A-000F-32-EAAC_

if helpful I can also share the knxproj file, but not here within the issue tracker