Display attribute of a sensor

I have a sensor that gives me the time a bus leaves from a station. Showing this in HADashboard works fine, but I would like to add a second line showing the current delay (which is an attribute of the original sensor).

bus:
    widget_type: sensor
    title: "139 leaving in"
    units: "min"
    precision: 0
    entity: sensor.bus_139_test

From my understanding this should work with the sub_entity, but I cant get it to work and also cant find an example for a similar case.

Any idea how to do this ?

sometimes @aimc really throws suprises at me :slight_smile:
i didnt know he has added this feature at all, so i never tried it out myselve.
so i looked it up in the docs.

im having a bit of a hard time understanding it also, so i read it several times.
i hope i understand it correctly now and i hope that andrew confirms that.

you can show 2 sensor values in 1 widget (entity and sub-entity)
if you like you can use an attribute from a sensor at the place from 1 of the entities.
entity shows first and sub entity second so that why you can use the main sensor as entity or as sub_entity
when you want to use an attribute from a sensor at the place from 1 of the 2 entity places you need to use the entity_to_sub_entity_attribute or sub_entity_to_entity_attribute option.

so far the theory, now lets get it to work.
i think in your case it should be:

bus:
    widget_type: sensor
    title: "139 leaving in"
    units: "min"
    precision: 0
    entity: sensor.bus_139_test 
    sub_entity: sensor.bus_139_test  
    entity_to_sub_entity_attribute: delay

i hope that i understood it right, but if so the naming from the options are a little confusing.
i would expect it to be called attribute_to_entity or attribute_to_sub_entity.

I can change it - that functionality was contributed so I didn’t do much work on it other than test it.

you did test it, so i did understand it correct?

I think so :wink:

lol. hmm guess i need to test it myself then to be sure :wink:
are there any more features you did hide from me? :stuck_out_tongue:

Everything is in the history - it’s not my fault you never read it!!

1 Like

i never knew we had a history :stuck_out_tongue:but i guess thats about yesterday and before :wink:

1 Like

In case you want to take a look, it’s here:

http://appdaemon.readthedocs.io/en/latest/HISTORY.html

That change went in in 3.0 beta 1.

1 Like