Hi,
I got sensors and gives the value in seconds for last seen. I
With zigbee2tasmota, the value for last seen is triggered and send over mqtt to homeassistant.
How do I convert the seconds into (for example 30 sec ago, and more as 60 seconds, 1 min ago, more than 60m , 1 hour ago), just like the last changed value works in homeassistant
I get the value in seconds with this
- platform: mqtt
name: "Rookmelder lastseen"
state_topic: "tele/z2t/6F40/SENSOR"
value_template: >
{% if '0x6F40' in value_json.ZbReceived and 'LastSeen' in value_json.ZbReceived['0x6F40'] %}
{{ value_json.ZbReceived['0x6F40'].LastSeen }}
{% else %}
{{ states('sensor.rookmelder_lastseen') }}
{% endif %}
unit_of_measurement: "s"
availability_topic: "tele/z2t/LWT"
payload_available: "Online"
payload_not_available: "Offline"