Resetting Time Counter on Inputs



  • Hello all!

    What is the best practice for resetting the "time" field on an input. For example, my /rest/di/1 page displays:

    {"value": 0, "debounce": 0, "circuit": "1", "dev": "input", "time": 313550791}
    
    

    If I wanted to send a command to evok to reset the field, how would I do so, for example, to make it display "time"; 0 and start the counting over?

    Thanks in advance,
    Chris



  • Hello all!

    What is the best practice for resetting the "time" field on an input. For example, my /rest/di/1 page displays:

    {"value": 0, "debounce": 0, "circuit": "1", "dev": "input", "time": 313550791}
    
    

    If I wanted to send a command to evok to reset the field, how would I do so, for example, to make it display "time"; 0 and start the counting over?

    Thanks in advance,
    Chris



  • Hello Chris,

    the time parameter is not a counter, it is the number of second since epoch - the linux time representation. To count the number of pulses, you have to use other sw solution on top of evok. For example a simple websocket client that will take care of counting the signals (see the nodered example on our wiki)

    Br,
    Tomas



  • Hi Tomas,

    there is something wrong with "time". It cannot be the number of second since epoch. Look at conversion back to date what results I get when trying to convert "time" back to human readable format

    petr@raspberrypi2:~# date
    Čt čen 16 08:57:40 CEST 2016
    petr@raspberrypi2:~# date –date='@1187716472'
    Út srp 21 19:14:32 CEST 2007
    petr@raspberrypi2:~# date
    Čt čen 16 08:58:03 CEST 2016
    petr@raspberrypi2:~# date --date='@1202551130'
    So úno 9 10:58:50 CET 2008

    Where could be a problem? Is it a bug in Evok? If not what really represents "time"?

    Thank you