adizanni / ExportToHASS

Sweethome3D Plugin for Home Assistant Export
GNU General Public License v3.0
49 stars 5 forks source link

Does not save zip file #1

Closed thundergreen closed 3 years ago

thundergreen commented 3 years ago

I succesfully installed the plugin and it is well showing under tools --> export ... but the zip file will never be exported. I already restarte Sweet home 3d

adizanni commented 3 years ago

Hello Thundergreen, as I already told to others, I'm moving in an uncharted territory with this plugin. I'm not a Java developer and plugin working depends on many external factors. So please be patient. Try to run Sweethome from the cmd line first (cmd in windows, terminal in Linux). If the zip is not generarated it means there is an error. The stack trace of the error will appear in the cmd console. Please copy paste here the stack trace. If there is no stack trace I suggest to send me your model via file share. I'm going to be off a few days but when back I will fix the issue. The problem is that I discover every day new model object types that have to be managed for the export to work well. This morning I have released a patch to manage Levels....

jesserockz commented 3 years ago

Here you go:

As soon as I hit the save button it closes the dialog and nothing else happens.

Arch Linux Sweet home 3D 6.5 OpenJDK version 16.0.1

Exception in thread "AWT-EventQueue-0" java.lang.NullPointerException: Cannot invoke "com.eteks.sweethome3d.model.Content.openStream()" because "<parameter1>" is null
    at com.eteks.sweethome3d.tools.TemporaryURLContent.copyToTemporaryURLContent(Unknown Source)
    at com.eteks.sweethome3d.j3d.ModelManager.loadModel(Unknown Source)
    at com.eteks.sweethome3d.j3d.ModelManager.loadModel(Unknown Source)
    at com.eteks.sweethome3d.j3d.HomePieceOfFurniture3D.loadPieceOfFurnitureModel(Unknown Source)
    at com.eteks.sweethome3d.j3d.HomePieceOfFurniture3D.createPieceOfFurnitureNode(Unknown Source)
    at com.eteks.sweethome3d.j3d.HomePieceOfFurniture3D.<init>(Unknown Source)
    at com.eteks.sweethome3d.j3d.Object3DBranchFactory.createObject3D(Unknown Source)
    at com.eteks.sweethome3d.plugin.exporthass.ExportHass$ExportHassAction.exportHomeStructure(ExportHass.java:145)
    at com.eteks.sweethome3d.plugin.exporthass.ExportHass$ExportHassAction.execute(ExportHass.java:103)
    at com.eteks.sweethome3d.swing.HomePane$ActionAdapter.actionPerformed(Unknown Source)
    at com.eteks.sweethome3d.swing.ResourceAction$AbstractDecoratedAction.actionPerformed(Unknown Source)
    at java.desktop/javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:1972)
    at java.desktop/javax.swing.AbstractButton$Handler.actionPerformed(AbstractButton.java:2313)
    at java.desktop/javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:405)
    at java.desktop/javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:262)
    at java.desktop/javax.swing.AbstractButton.doClick(AbstractButton.java:374)
    at java.desktop/javax.swing.plaf.basic.BasicMenuItemUI.doClick(BasicMenuItemUI.java:1022)
    at java.desktop/javax.swing.plaf.basic.BasicMenuItemUI$Handler.mouseReleased(BasicMenuItemUI.java:1066)
    at java.desktop/java.awt.Component.processMouseEvent(Component.java:6617)
    at java.desktop/javax.swing.JComponent.processMouseEvent(JComponent.java:3342)
    at java.desktop/java.awt.Component.processEvent(Component.java:6382)
    at java.desktop/java.awt.Container.processEvent(Container.java:2264)
    at java.desktop/java.awt.Component.dispatchEventImpl(Component.java:4993)
    at java.desktop/java.awt.Container.dispatchEventImpl(Container.java:2322)
    at java.desktop/java.awt.Component.dispatchEvent(Component.java:4825)
    at java.desktop/java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4934)
    at java.desktop/java.awt.LightweightDispatcher.processMouseEvent(Container.java:4563)
    at java.desktop/java.awt.LightweightDispatcher.dispatchEvent(Container.java:4504)
    at java.desktop/java.awt.Container.dispatchEventImpl(Container.java:2308)
    at java.desktop/java.awt.Window.dispatchEventImpl(Window.java:2773)
    at java.desktop/java.awt.Component.dispatchEvent(Component.java:4825)
    at java.desktop/java.awt.EventQueue.dispatchEventImpl(EventQueue.java:772)
    at java.desktop/java.awt.EventQueue$4.run(EventQueue.java:721)
    at java.desktop/java.awt.EventQueue$4.run(EventQueue.java:715)
    at java.base/java.security.AccessController.doPrivileged(AccessController.java:391)
    at java.base/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:85)
    at java.base/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:95)
    at java.desktop/java.awt.EventQueue$5.run(EventQueue.java:745)
    at java.desktop/java.awt.EventQueue$5.run(EventQueue.java:743)
    at java.base/java.security.AccessController.doPrivileged(AccessController.java:391)
    at java.base/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:85)
    at java.desktop/java.awt.EventQueue.dispatchEvent(EventQueue.java:742)
    at java.desktop/java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:203)
    at java.desktop/java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:124)
    at java.desktop/java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:113)
    at java.desktop/java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:109)
    at java.desktop/java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:101)
    at java.desktop/java.awt.EventDispatchThread.run(EventDispatchThread.java:90)
adizanni commented 3 years ago

Do you confirm you put the file into a knonw folder and your file name (zip) is not empty ?

firstchair commented 3 years ago

At first, great that you're creating this! Are there logs saved somewhere during the export? Note: the solution for me was to remove a group of objects

adizanni commented 3 years ago

No not yet, I will do a release this week-end to be sure I can have better troubleshooting. Of course to share your sh3d model file with the faulty objects can help. There are a lot of object types I'm not yet managing and they may cause unhandled exceptions. Please be patient.....

adizanni commented 3 years ago

I think it would help to send me the sh3d file with the objects that were causing errors, there are so many cases and I have to manage them all for the export to work fine, the more I have examples the more the plugin will be stable

squirrel289 commented 3 years ago

Here you go:

As soon as I hit the save button it closes the dialog and nothing else happens.

Arch Linux Sweet home 3D 6.5 OpenJDK version 16.0.1

Exception in thread "AWT-EventQueue-0" java.lang.NullPointerException: Cannot invoke "com.eteks.sweethome3d.model.Content.openStream()" because "<parameter1>" is null
  at com.eteks.sweethome3d.tools.TemporaryURLContent.copyToTemporaryURLContent(Unknown Source)
  at com.eteks.sweethome3d.j3d.ModelManager.loadModel(Unknown Source)
  at com.eteks.sweethome3d.j3d.ModelManager.loadModel(Unknown Source)
  at com.eteks.sweethome3d.j3d.HomePieceOfFurniture3D.loadPieceOfFurnitureModel(Unknown Source)
  at com.eteks.sweethome3d.j3d.HomePieceOfFurniture3D.createPieceOfFurnitureNode(Unknown Source)
  at com.eteks.sweethome3d.j3d.HomePieceOfFurniture3D.<init>(Unknown Source)
  at com.eteks.sweethome3d.j3d.Object3DBranchFactory.createObject3D(Unknown Source)
  at com.eteks.sweethome3d.plugin.exporthass.ExportHass$ExportHassAction.exportHomeStructure(ExportHass.java:145)
  at com.eteks.sweethome3d.plugin.exporthass.ExportHass$ExportHassAction.execute(ExportHass.java:103)
  at com.eteks.sweethome3d.swing.HomePane$ActionAdapter.actionPerformed(Unknown Source)
  at com.eteks.sweethome3d.swing.ResourceAction$AbstractDecoratedAction.actionPerformed(Unknown Source)
  at java.desktop/javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:1972)
  at java.desktop/javax.swing.AbstractButton$Handler.actionPerformed(AbstractButton.java:2313)
  at java.desktop/javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:405)
  at java.desktop/javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:262)
  at java.desktop/javax.swing.AbstractButton.doClick(AbstractButton.java:374)
  at java.desktop/javax.swing.plaf.basic.BasicMenuItemUI.doClick(BasicMenuItemUI.java:1022)
  at java.desktop/javax.swing.plaf.basic.BasicMenuItemUI$Handler.mouseReleased(BasicMenuItemUI.java:1066)
  at java.desktop/java.awt.Component.processMouseEvent(Component.java:6617)
  at java.desktop/javax.swing.JComponent.processMouseEvent(JComponent.java:3342)
  at java.desktop/java.awt.Component.processEvent(Component.java:6382)
  at java.desktop/java.awt.Container.processEvent(Container.java:2264)
  at java.desktop/java.awt.Component.dispatchEventImpl(Component.java:4993)
  at java.desktop/java.awt.Container.dispatchEventImpl(Container.java:2322)
  at java.desktop/java.awt.Component.dispatchEvent(Component.java:4825)
  at java.desktop/java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4934)
  at java.desktop/java.awt.LightweightDispatcher.processMouseEvent(Container.java:4563)
  at java.desktop/java.awt.LightweightDispatcher.dispatchEvent(Container.java:4504)
  at java.desktop/java.awt.Container.dispatchEventImpl(Container.java:2308)
  at java.desktop/java.awt.Window.dispatchEventImpl(Window.java:2773)
  at java.desktop/java.awt.Component.dispatchEvent(Component.java:4825)
  at java.desktop/java.awt.EventQueue.dispatchEventImpl(EventQueue.java:772)
  at java.desktop/java.awt.EventQueue$4.run(EventQueue.java:721)
  at java.desktop/java.awt.EventQueue$4.run(EventQueue.java:715)
  at java.base/java.security.AccessController.doPrivileged(AccessController.java:391)
  at java.base/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:85)
  at java.base/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:95)
  at java.desktop/java.awt.EventQueue$5.run(EventQueue.java:745)
  at java.desktop/java.awt.EventQueue$5.run(EventQueue.java:743)
  at java.base/java.security.AccessController.doPrivileged(AccessController.java:391)
  at java.base/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:85)
  at java.desktop/java.awt.EventQueue.dispatchEvent(EventQueue.java:742)
  at java.desktop/java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:203)
  at java.desktop/java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:124)
  at java.desktop/java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:113)
  at java.desktop/java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:109)
  at java.desktop/java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:101)
  at java.desktop/java.awt.EventDispatchThread.run(EventDispatchThread.java:90)

Receiving identical issue in a very different operating environment: macOS 11.1 SweetHome3D 6.6a Oracle Java 1.8.0_291

EDIT: Upgraded to java 1.8.0_301 with same results.

Attached is the sh3d I am using. home.sh3d.zip

uspass commented 3 years ago

That's because your sh3d has 2 levels. The plugin can't do that. If you delete Level 1, it exports OK.

cheers, us

adizanni commented 3 years ago

Hello thanks uss.

Squirrel, I confirm, today I'm not supporting multiple level in the plugin. This may change in the future even though, the rendering of multiple floors is not really good for the card, it works better on single floors.

squirrel289 commented 3 years ago

Thank you for the info, that's helpful to know. Given that, I tried deleting the second level and still received the same error so I tried exporting new model using the 4BR demo house and still see the same.

I've attached the demo house for reference. Test.sh3d.zip

chrisvor commented 3 years ago

Hi. I also have a SH3D file containing two floors with multiple layers on each (some on same elevation, just to have lights and doors separately from the main house plan. Following this issue, I have copied all the objects on the ground floor into a new SH3D file that only has one layer, and used your tool to create the ZIP. All worked fine. However, when I repeated the same thing for the first floor, into a new SH3D file, the tool does not produce the ZIP file. Using windows 10. I tried starting the application from the command line, but I dont get any error log output

adizanni commented 3 years ago

Hello all, I'm able to reproduce the issue in Windows 10 but the linux version is working. I'm going to need a little time as debugging for windows ain't easy.

chrisvor commented 3 years ago

Hello all, I'm able to reproduce the issue in Windows 10 but the linux version is working. I'm going to need a little time as debugging for windows ain't easy.

Great! Thank you for your great work!

adizanni commented 3 years ago

Hello all, I'm back now, in fact my previous post is not correct. The plugin was not working because I was using a previous version. Instead of following my procedure in the readme (I will modify it) please follow these steps in windows:

  1. Close sweethome3d application
  2. Download the latest version of the plugin here
  3. Open the folder located here: "C:\Users\[your user name]\AppData\Roaming\eTeks\Sweet Home 3D\plugins" (replace [your user name] with your actual user name)
  4. Copy the file downloaded in step 2 to the folder identified in step 3
  5. Restart sweethome3d,

In this release I have added a final message box to show that the export was succesful. If you do not see the message box it means you have other problems. But now it will be more difficult for me to debug (until I will put some logs, but this plugin is really developed in best effort). Please try!!!

squirrel289 commented 3 years ago

Is there an equivalent change on directions on MacOS 11.1?

adizanni commented 3 years ago

I cannot test in MacOS but, as far as I know, it is really similar to Linux. Try to search for the file name ExportToHassPlugin.sh3p. In Linux this is located in /home/username/.eteks/sweethome3d/plugin. I have the impression that the double-click on the plugin file is not always working in windows (I cannot tell in MacOS and in Linux it has never worked so you need to copy the file manually).

adizanni commented 3 years ago

Wait a moment, your sh3d model is not working in my linux either. It may be a grouped object causing an exception. Try to start with a simple model and see if it is working,..... ..... No no correction I removed the roof an it is now working. So I confirm without the roof level the your model is working in both Linux and Windows; unfortunately I cannot test on MacOS

ahd71 commented 3 years ago

I can confirm that I can export a model until i group two objects, then it is not possible anymore. I use groups a lot for organization so would be great when this would be handled, and as others have said, I really appreciate the time you have put into this. keep up the good work!

chrisvor commented 3 years ago

Yes I just noticed that my "first floor" had a groupped object and it was not exporting. As soon as I ungrouped them, the export succeeded. So it's definitely an issue with the groups

adizanni commented 3 years ago

Hello Christos, yes I'm going to try to manage the groups this can even give some ideas to avoid the # feature (see the README) or the object grouping in the card

adizanni commented 3 years ago

Loaded a new version that should fix the group problem. The group itself is not exported but all its children furniture are correctly exported

adizanni commented 3 years ago

In absence of a feedback I close the issue. Re-open it if you still experience the issue

jesserockz commented 3 years ago

Working for me recently as I had a small concrete slab level under the house to raise the floor off ground =)

Vlastelin40 commented 3 years ago

It exports everything,but for some reason it does not load into HA

Vlastelin40 commented 3 years ago

Windows 7

adizanni commented 3 years ago

Hello Vlastelin, you need to give me more info:

console logs yaml config of the card obj/mtl file or sh3d file (if needed)

Vlastelin40 commented 3 years ago

Only the mtl file is loaded,the obj file is not loaded(50Mb) file size. HA is installed in VirtualBox.       С уважением, Владимир Марчуков @.***  

К этому письму приложены ссылки на следующие файлы:

  1. home.obj (58.3 Мб)

Ссылка для скачивания файлов: https://cloud.mail.ru/stock/8QVH87NLSoEem1tGMcypNx8T

Файлы будут храниться до 08.03.2022

Vlastelin40 commented 3 years ago

Good evening.I downloaded the files,now there is another problem.Shows only a gray screen. What could be wrong? All files in the www folder, the paths are spelled out(/hacsfiles/local/home. obj ,/hacsfiles/local/home. mtl ,/hacsfiles/local/home.json)(/hacsfiles/floor3d-card/floor3d-card.js?hacstag=361776538111)   С уважением, Владимир Марчуков @.***

adizanni commented 3 years ago

The right path for the obj and mtl files is /local/(www folder in config where you have copied the files). No hacsfiles

Vlastelin40 commented 3 years ago

      С уважением, Владимир Марчуков @.***  

Vlastelin40 commented 3 years ago

I figured it out, thank you. the path was not correct, I specified /local/ and everything went.   С уважением, Владимир Марчуков @.***

Abhome commented 2 years ago

Hello all, I'm back now, in fact my previous post is not correct. The plugin was not working because I was using a previous version. Instead of following my procedure in the readme (I will modify it) please follow these steps in windows:

  1. Close sweethome3d application
  2. Download the latest version of the plugin here
  3. Open the folder located here: "C:\Users[your user name]\AppData\Roaming\eTeks\Sweet Home 3D\plugins" (replace [your user name] with your actual user name)
  4. Copy the file downloaded in step 2 to the folder identified in step 3
  5. Restart sweethome3d,

In this release I have added a final message box to show that the export was succesful. If you do not see the message box it means you have other problems. But now it will be more difficult for me to debug (until I will put some logs, but this plugin is really developed in best effort). Please try!!!

thank you for your amazing work. I'm not able to get the plugin to work. can you help?

adizanni commented 2 years ago

Hello @Abhome do you see the plugin menu at least ? The plugin is very experimental and it works only when all the conditions are met, and still I do not know what are all the conditions :). Can you please tell me:

  1. Which Sweethome version are you using
  2. I guess it is Windows based
  3. Do you see the Export To Hass menu entry in the Tools menu of Sweethome
  4. Have you groups or levels in the model you are trying to export
  5. Any other info, screenshot you think is relevant.....
Abhome commented 2 years ago

Just update the sweet home to version 6.6a, and it solves the problem; thank you for your help.

Abhome commented 2 years ago

Sorry to bother you. My question is, can I bind an entity with the white light source? How can I find the object id of the white light source?

adizanni commented 2 years ago

The white light source has no effect for the export to home assistant . In SweetHome3D it is used just to do realistic rendering effect. In the floor3d-card you bind directly to the lamp object in order to render the light

Abhome commented 2 years ago

I'm using a white source light for my led strip. Do you have any solution for the led strip?

adizanni commented 2 years ago

I have not yet implemented this type of light from Three.js. It is not an easy coding. In the mean time I suggest you create a "fake" strip light by putting small objects (ex cubes) in a line in your model and in the card you create an object group that contains all the cubes. After you bind your strip ha light to the object group you will be able to do a stripe like effect. Of course this is consuming a lot of light sources: I remind you that, if you want realistic lights with shadows, the number of lights is limited by the max number of textures that your GPU can handle