sDate was invalid

Easy to use, 100% Lua-based event scripting framework.

Moderator: leecollings

Post Reply
User avatar
geert56
Posts: 4
Joined: Friday 20 July 2018 20:41
Target OS: Raspberry Pi / ODroid
Domoticz version: 2020.1
Contact:

sDate was invalid

Post 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  
}
  • Domoticz Version: 2020.1 (build 11835)
  • Raspberry Pi 3 Model B+ (2018)
  • RFXCOM - RFXtrx433
User avatar
waaren
Posts: 6028
Joined: Tuesday 03 January 2017 14:18
Target OS: Linux
Domoticz version: Beta
Location: Netherlands
Contact:

Re: sDate was invalid

Post 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  
}
Debian buster, bullseye on RPI-4, Intel NUC.
dz Beta, Z-Wave, RFLink, RFXtrx433e, P1, Youless, Hue, Yeelight, Xiaomi, MQTT
==>> dzVents wiki
User avatar
geert56
Posts: 4
Joined: Friday 20 July 2018 20:41
Target OS: Raspberry Pi / ODroid
Domoticz version: 2020.1
Contact:

Re: sDate was invalid

Post 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?
  • Domoticz Version: 2020.1 (build 11835)
  • Raspberry Pi 3 Model B+ (2018)
  • RFXCOM - RFXtrx433
User avatar
waaren
Posts: 6028
Joined: Tuesday 03 January 2017 14:18
Target OS: Linux
Domoticz version: Beta
Location: Netherlands
Contact:

Re: sDate was invalid

Post 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
Debian buster, bullseye on RPI-4, Intel NUC.
dz Beta, Z-Wave, RFLink, RFXtrx433e, P1, Youless, Hue, Yeelight, Xiaomi, MQTT
==>> dzVents wiki
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest