Page 1 of 1

dzVents error on os.time

Posted: Sunday 01 March 2020 21:35
by felix63
Running dzVents 3.0
Get an error 'time result cannot be represented in this installation' on the statement:

Code: Select all

            local convertedTimestamp = os.time({year = runyear, month = runmonth, day = runday})
Doesn't make sense to me... anyone?

Re: dzVents error on os.time

Posted: Sunday 01 March 2020 22:02
by waaren
felix63 wrote: Sunday 01 March 2020 21:35 Running dzVents 3.0
Get an error 'time result cannot be represented in this installation' on the statement:

Code: Select all

            local convertedTimestamp = os.time({year = runyear, month = runmonth, day = runday})
Doesn't make sense to me... anyone?
Kind of difficult to tell what the problem is without knowing what runyear, runmonth and runday are. This script works as expected.

Code: Select all

return 
{
	on = 
	{
		devices = 
		{
			'makeTimeStampTrigger',
		},
	},
	
	    
    logging =   
    {   
        level = domoticz.LOG_DEBUG,                        -- INFO, DEBUG or ERROR
        marker = 'makeTimeStamp' 
    },

	execute = function(dz)

        function string2Epoch(dateString) -- seconds from epoch based on stringdate (used by string2Date) -- Assuming a date pattern like: yyyy-mm-dd
    		local pattern = '(%d+)-(%d+)-(%d+)'
    		local runyear, runmonth, runday= dateString:match(pattern)
    		local convertedTimestamp = os.time({year = runyear, month = runmonth, day = runday})
    		return convertedTimestamp
    	end
		
		dz.log(string2Epoch('2020-03-01'),dz.LOG_DEBUG)
	end
}

Re: dzVents error on os.time

Posted: Sunday 01 March 2020 23:14
by felix63
2020-03-01 23:09:01.293 Error: dzVents: Error: (3.0.1) datestring:2099-12-31
2020-03-01 23:09:01.293 Error: dzVents: Error: (3.0.1) An error occurred when calling event handler status afval2
2020-03-01 23:09:01.293 Error: dzVents: Error: (3.0.1) ...ticz/scripts/dzVents/generated_scripts/status afval2.lua:61: time result cannot be represented in this installation

Re: dzVents error on os.time  [SOLVED]

Posted: Monday 02 March 2020 0:02
by waaren
felix63 wrote: Sunday 01 March 2020 23:14 datestring:2099-12-31
Probably too far in the future for your system.

If I try this date on my system, the return is 4102398000