Creating New Device Type Causes an Error

@johnconstantelo I am trying to use your My MIMOlite - Garage Car Door v3 code. When I try to create a new device type “from code” and paste in the code form Github I get the error:

Org.springframework.dao.DuplicateKeyException: a different object with the same identifier value was already associated with the session: [physicalgraph.device.CapabilityDeviceType#physicalgraph.device.CapabilityDeviceType : (unsaved)]; nested exception is org.hibernate.NonUniqueObjectException: a different object with the same identifier value was already associated with the session: [physicalgraph.device.CapabilityDeviceType#physicalgraph.device.CapabilityDeviceType : (unsaved)]

I’m not sure what to look for. I used your v2 device type code and it worked fine. Can you offer any suggestions what I might need to change?

Thanks!

that means the same device type exists in your account. go look at your device types

I don’t have any device types like this yet. I also deleted all my device types and still received the error.

I saw this come in yesterday thorugh support. That device has a “capability garageDoorControl” which cannot compile because that capability doesn’t exist. So remove that and it will work. :smile:

The other garage door control capability is the correct one and will compile.

Thanks, Tim. That was the ticket.

interestingly enough, I had this trouble yesterday as well… Though I had actually had this exact code in a device type and removed it yesterday. - I did find, however that after removing the different garage door capabilities, I could create the device type… and then I updated the device type with the capabilities that I removed… and it saved OK. Weirdness!!

So you added back the garagedoorcontrol line after it saved?

Yeah, it did. But if @slagle says it’s not needed, then I’m still confused, as the exact same device type code did not throw the error when I set it up initially last month. (long story, but I removed the existing device type I had yesterday during some troubleshooting)