Templating in HADashboard custom widgets?

Hi all - I’m trying to create a custom widget for HADashboard that is essentially just a binary sensor, but also displays when the state last changed. (When the front door last opened or closed, for example.)

I looked at binary_sensor.yaml in the source, and created my own version called binary_sensor_since.yaml. My idea was to replace the state_text displayed at the bottom with something based on the entity’s last_updated - the thing that would be printed in normal templates by, for example:

{{ states.binary_sensor.front_door.last_updated }}

However, I haven’t had any luck putting anything similar into the custom_widget definition, and I’m not sure what data should be available there? I do know that some templating is possible is state_text, because I can put "{{title}}" there and it works.

What I’m really after is something like this:

widget_type: baseswitch
entity: "{{entity}}"
...
fields:
   ...
  state_text: "{{states[entity].last_updated}}"

Is this kind of thing possible?

Thanks in advance!

nope.

what it between {{ and }}
is what is set in the dashboard file

there is no templating involved.

but there are some topics on the forum how it is possible to have last_updated as state in a sensor widget though.