adizanni / floor3d-card

Your Home Digital Twin: aka floor3d-card. Visualize Home Assistant state and perform actions using objects in a 3D home model based on Three.js.
https://github.com/adizanni/floor3d-card
MIT License
452 stars 65 forks source link

Using sensor 'attributes' #59

Closed wishie closed 2 years ago

wishie commented 2 years ago

I wish to be able to use an attribute of a sensor entity for the 'text' type..

I have a climate.air_con entity, and I wish to display its 'current_temperature' attribute on the wall in my 3D model. I can not see a way to access 'current_temperature' using your card. I am aware I could make a template sensor for this, but I believe it's overkill.

Can you provide a way to specify which attributes to use?

adizanni commented 2 years ago

Hello wishie, I was trying to make it work with the template parameter of an entity but it seems it is not working as expected. I'm afraid it will require a change in the code, which I'm not yet ready to do for lack of time. But let's keep this open.

jli113 commented 2 years ago

Live data representation +1

adizanni commented 2 years ago

Added support for the 'attribute' parameter for the text entity, In future releases, I will try to promote it to the entity level to make it work for all other entity types where it make sense

jli113 commented 2 years ago

Does it work like this: type: custom:floor3d-card entities:

adizanni commented 2 years ago

In the attribute parameter, you should put the name of the attribute you want to show not the name of the entity. As an exmple if you put a light entity called light.lvinig in the attribute you can put something like 'brightness'

jli113 commented 2 years ago

In the attribute parameter, you should put the name of the attribute you want to show not the name of the entity. As an exmple if you put a light entity called light.lvinig in the attribute you can put something like 'brightness'

Even so, it is only showing Black color. image

adizanni commented 2 years ago

Is atttibute "Power" (capital p) or power. The impression is that it does not find the attribute. Also the text is better suited for plane objects. I've never tested it in no plane objects

uspass commented 2 years ago

@wishie

If you want to get something like this

temp

I can share you the way I've done it.

Cheers, us

adizanni commented 2 years ago

There was a bug in the version I've loaded, nevertheless the text entities should be applied to plane objects (frames, tvs, laptop screens, walls, etc.) the result on curved object is unpredictable. I will load a fix in the next release

adizanni commented 2 years ago

Please test the behaviour in v1.1.5 (new), but please avoid the use of non-plane objects for the text entity

jli113 commented 2 years ago

Turns out that I didn't set attributes in the ESPhome device entity.

adizanni commented 2 years ago

So is it now working as expected ? Can we close the issue ?

jli113 commented 2 years ago

@uspass I'm totally interested, can you please share how you make it?

Luke888888 commented 2 years ago

Sorry for breaking into the thread.

In version 1.1.5 I can confirm this is working.

With pure sensor data

  - entity: sensor.car_soc
    type3d: text
    object_id: Box_Car1_Charge_2
    text:
      textfgcolor: black

image

With attribute

  - entity: climate.entre
    type3d: text
    object_id: Box_Car1_Charge_2
    text:
      textfgcolor: black
      attribute: current_temperature

image

With template

  - entity: sensor.car_soc
    type3d: text
    object_id: Box_Car1_Charge_2
    entity_template: '[[[ if ($entity > 50) { "OK" } else { "Charge me" } ]]]'
    text:
      textfgcolor: black

image

jli113 commented 2 years ago

@Luke888888 @adizanni Thanks, it works.

adizanni commented 2 years ago

Ok so closing as implemented.

Lee-View commented 2 years ago

@wishie

If you want to get something like this

temp

I can share you the way I've done it.

Cheers, us

It's not working for me even though I followed @Luke888888 examples. I have to mention that I'm using version 1.1.11. Is it possible that something changed in the meantime? Please find my code bellow:

pressurejets commented 9 months ago

Can someone help me, on text, my temp displays for a second them goes blurred ??? also only one place i can place it ??

adizanni commented 8 months ago

YHello @pressurejets, you need to create a frame object in sweethome3d and put your text on top of it using the text entity giving a background and foreground color. I ve never experienced blurry text unless you have some texture on the object you want to write text on .....