Unix time covert ,plese help


I was able to get from the sensors
like “time: 1666832988562”

      - name: toyota engine status
        unique_id: "toyota_engine_status"
        state: >-
         {% if as_timestamp(now()) | int > (state.sensor.toyota_torque,'time') | int +60) %}
           OFF
         {% else %}
           ON
         {% endif %}

The timestamp may not match

      - name: toyota engine status
        unique_id: "toyota_engine_status"
        state: >-
           {% if as_timestamp(now()) > 
           (state_attr('sensor.toyota_torque', 'time') | int(0) / 1000) + 60 %}
             OFF
           {% else %}
             ON
           {% endif %}
1 Like

thanks help
but states Is not correct ,like this
Is it timestamp format?

Sorry about that, I didn’t count digits… your timestamp is in milliseconds and now() return seconds. I have corrected the template in the post above.

1 Like

thank you very much,It’s working very well now