Binary_sensor using last_changed attribute

Binary_sensor using last_changed attribute

entities:

  • entity: binary_sensor.door_window_sensor_158d0002027f13
  • entity: binary_sensor.motion_sensor_158d0002236c25
  • entity: binary_sensor.washmachine
    secondary_info: last-changed`

Any ideas on how to show secondary_info: last-changed only when binary_sensor.washmachine is switched on.

useful links

Binary_sensor value template using last_changed attribute not updated
https://github.com/home-assistant/core/issues/29275

Use two conditional rows — one if the sensor is off without the secondary info, the other if on with the info.