Page 1 of 1

sDate was invalid

Posted: Thursday 02 April 2020 16:38
by geert56
I have made a dzVents script to control my mechanical ventilation. I want to use the time the ventilators were switched high (RvhoogStartTijd) for later runs of the script.
The script is doing what is has to do, however, a error is generated:
2020-04-02 16:19:00.223 Error: dzVents: Error: (3.0.1) sDate was invalid. Reset to 2020-4-2 16:19:0.41
I delete most lines of the script to the script below. This script is stil generating the error.
Does somebody knows what is happening?

Code: Select all

return {
    on = 
    {
        timer = {'every minute'},
    },

    data = 
    {
        RVhoogStartTijd = {initial = '2020-1-1 0:0.000' },
    },

    execute = function(dz)
        local Time = require('Time')
        dz.data.RVhoogStartTijd = tostring(dz.time.raw)
        local verschil = Time'dz.time.raw'.compare(Time(dz.data.RVhoogStartTijd)).seconds
        dz.log(' verschil =  ' .. verschil )

    end  
}

Re: sDate was invalid

Posted: Thursday 02 April 2020 17:19
by waaren
geert56 wrote: Thursday 02 April 2020 16:38
2020-04-02 16:19:00.223 Error: dzVents: Error: (3.0.1) sDate was invalid. Reset to 2020-4-2 16:19:0.41
Does somebody knows what is happening?
The initial time format in dz.data.RVhoogStartTijd is wrong.

Code: Select all

return 
{
    on = 
    {
        timer = 
        {
            'every minute',
        },
    },

    data = 
    {
        RVhoogStartTijd = 
        { 
            initial = '2020-1-1 0:0:0' ,
        },
    },

    execute = function(dz)
        local Time = require('Time')
        
        local verschil = Time(dz.time.raw).compare(Time(dz.data.RVhoogStartTijd)).seconds
        dz.log(' verschil =  ' .. verschil ) -- Guess..  I would say around 60                           :-)
          
        dz.data.RVhoogStartTijd = dz.time.raw
        
    end  
}

Re: sDate was invalid

Posted: Friday 10 April 2020 22:46
by geert56
Waaren,

I think you mean:
I used: Time'dz.time.raw'... this must be replaced by Time(dz.time.raw)...
I changed it and the script run without errors.

Do you know the meaning of sDate is invaild?

Re: sDate was invalid

Posted: Friday 10 April 2020 23:00
by waaren
geert56 wrote: Friday 10 April 2020 22:46 I think you mean:
I used: Time'dz.time.raw'... this must be replaced by Time(dz.time.raw)...
I changed it and the script run without errors.
No that is not what I meant. The modified script I posted has been tested and is correct.

In your script you used

Code: Select all

RVhoogStartTijd = {initial = '2020-1-1 0:0.000' },
and '2020-1-1 0:0.000' is not a correct time format for dzVents

The error message you posted is telling you that one of the times you used in your comparison is invalid and that was caused by the wrong initial value of RVhoogStartTijd