Your Home Digital Twin: Interactive floor 3d plan

Hello uss, I do agree about setting goals.
Here what we are trying to achieve is the following:

  1. Preserve the name of the objects across multiple export of the same models;
  2. Still be able to bind objects to entities to visualize state or trigger actions

It will be impossible to achieve both without touching the OBJWriter class you pointed me to.
Sweethome3D is not natively exporting O tags and the G tags are built diregarding the pesistency of the names. As far as I could test, the O tag are not searchable by name in the Three.js library.
The light is not a problem, I create it by setting a point light at the center of the box containing the object. That is working in all contexts. Actions on objects can be achieved easily (I can do it by clicking on the object representing the light or by creating a new switch object that can be positioned somewhere else). What I propose is to redesign the OBJWriter (unfortunately we will loose forward compatibility): thanks to your help I’m getting some knowledge on the Plugin development. Not yet there but I’m definetly progressing

Hey, So i’ve been playing around with this today and wondering how I can hide a complex object?

This is what I have for hiding a garage door object:

**  - entity: cover.garage_door
    type3d: hide
    object_id: Door_47
    hide:
      state: closed
  - entity: cover.garage_door
    type3d: hide
    object_id: Grooves_46
    hide:
      state: closed
  - entity: cover.garage_door
    type3d: hide
    object_id: Handle_44
    hide:
      state: closed

I also have a car object that is far more complex and it would balloon my card code. Is there a way to select a single object id and it hide any object nested in it / associated to it?

1 Like

Unfortunately the Export to OBJ function in Sweethome3D does not group together the elements of an object. I’m checking how we can improve the export by building a specific Export to HASS plugin. See above discussion with uss. Not an easy one. You can always edit the obj file but it is a tedious activity…

Ah right. Fingers crossed for that then!

Is it possible to change the anchor point when panning / tilting / zooming etc?

As a workaround could you change object_id to a list of multiple object?

I can suggest you a dirty workaround, waiting for a better solution.
In Sweethome3D put your car in a new model (only the car), click on Export to OBJ format.
Retrieve the file.obj. Open it in an advanced editor such as Visual Studio Code.
Then follow these steps:

  1. In place of the first "g " tag put something like “g_your_car_name”
  2. Cmd-F to open find.
  3. Paste the string "g "
  4. Alt-Enter to select all of the instances of the string on the page.
  5. Cmd-L to broaden the selection to the entire line of each instance on the page.
  6. Delete/Backspace to remove those lines.
  7. change the first g line to “g your_car_name”

Save your file as car.obj and reimport it as furniture (from the menu, Furniture, Import Furniture) give it a new name and insert it into your catalog of objects.
Satrting from your car will be made of only one object when adding it to your home model.

1 Like

Hmmm. I must have messed it up somehow because after having followed the instructions and importing back into SH3D the id’s have just been swapped by my new one followed by some numbers :confused:

It also changed some of the models colours. Going to have to revisit this one. Thanks though!

That is normal after the export of the full home containing your new car, the car gets renamed to something like your_car_name_1_1, but you now have only one object representing your car.
You just have to change your hide element to the object_id your_car_name_1_1…

1 Like

Added v0.9.6 (actionable objects) works only with mouse double click when in non-editing mode.

Let me try to be clearer:

If you have already done a lot of binding based on a model you exported, any change to the model (especially removing objects) generates new objects_id that have to be bound back inside the card configuration (I know this is an annoying limit, but I am trying to overcome it based on our disucssion thread with uss above).

I gave you a dirty (yet working) way to overcome the other problem you raised. Complex objects are not grouped together with one object_id. This means that to make a complex object disappear you need to create as many hide bindings as the number of composing objects. If you follow my procedure you should change the obj file from:

g winshield
v …x…
v …y…
g trunk
v …w…
v…z…
g …
v …

to:

g car
v …x…
v …y…
v …w…
v…z…
v …

of course by removing your old car object and put your new car ojbect, you get into the first problem, objects_id get re-organized.

So my suggestion is: for all the objects that needs to be grouped, do my “export change import” trick. Only after, build the final version of the plan putting all your new objects and do the card binding inside Home Assistant. In other words stabilize your plan before binding 100s of objects…

Hope it helps.

1 Like

Release 0.9.7 is out:

I wanted to get out as much new features as possible even with crappy code. I will take care of cleaning during summer if the adoption rate grows

Release 0.9.10 is out: added object groups to apply entities bindings to multiple objects at the same time.

Dear @adizanni Thanks for this project. I followed your tutorial but get this result:

My model looks like:

I can open it in 3d viewe of windows … any idea what’s wrong here? my files are located here: :

/config/www/3d-floorplan/… I don’t have any jpeg files when exporting with Sweet home 3D.

EDIT: Works now but it looks a bit strange:

Do I have to color differently?

I also have this strange 1/2 message, how did you get it working?

1 Like

add a front_slash behind /local/home/ <<<<< like this :slight_smile:

1 Like

I’m having trouble with using object_groups:

My Yaml

type: custom:floor3d-card
entities:
  - entity: light.garage_light
    type3d: light
    object_id: Light_Fluorescent_Light_Fluorescent_Fluorescent_2133
    light:
      lumens: 500
  - entity: binary_sensor.garage_kiosk_motion
    type3d: hide
    object_id: Object01_1259_2341
    hide:
      state: 'off'
  - entity: binary_sensor.garage_kiosk_motion
    type3d: hide
    object_id: Object01_2340
    hide:
      state: 'off'
  - entity: binary_sensor.garage_kiosk_motion
    type3d: hide
    object_id: Object01_4419_2342
    hide:
      state: 'off'
  - entity: cover.garage_door
    type3d: hide
    object_id: Door_47
    hide:
      state: open
  - entity: cover.garage_door
    type3d: hide
    object_id: Grooves_46
    hide:
      state: open
  - entity: cover.garage_door
    type3d: hide
    object_id: Handle_30_45
    hide:
      state: open
  - entity: cover.garage_door
    type3d: hide
    object_id: Handle_44
    hide:
      state: open
  - entity: sensor.car_charger_sensor
    type3d: hide
    show:
      state: Charging
object_groups:
  - object_group: sensor.car_charger_sensor
    objects:
      - object_id: '2330'
      - object_id: '2331'
      - object_id: '2332'
      - object_id: '2333'
      - object_id: '2334'
path: /local/floorplan/garage/
objfile: garage-3D.obj?rtuy
mtlfile: garage-3D.mtl?ruty
backgroundColor: '#202020'
globalLightPower: 0.4
name: Garage

The Result:

The Error:

Yes, I’ve still the problem of the final “/” in the path.

I suggest your put some textures / colors on the wall and floors, but the rendering is strange it is like it is losing some elements

Hello Jamper,
the object_group solutions is not the easiest to understand:

This is the way to make it work:

entities:
  - entity: sensor.car_charger_sensor
    type3d: hide
    object_id: <car>
    show:
      state: Charging
object_groups:
  - object_group: car
    objects:
      - object_id: '2330'
      - object_id: '2331'
      - object_id: '2332'
      - object_id: '2333'
      - object_id: '2334'

you need to put an object_id in the entity configuration but you can now reference and object_group by enclosing the object_group name into <>. It is not very intuitive but I’ve tried a solution to have object groups without impacting those who are not using them.

1 Like

I did put some textures / colors on walls floor etc but no change :frowning: It won’t show it…

That’s my model

Perhaps you have the same issue I had, I had to have the sh3d file in the folder also.