dzVents error on os.time  [SOLVED]

Moderator: leecollings

Post Reply
User avatar
felix63
Posts: 244
Joined: Monday 07 December 2015 9:30
Target OS: Raspberry Pi / ODroid
Domoticz version: 2020.1
Location: Gouda
Contact:

dzVents error on os.time

Post 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?
User avatar
waaren
Posts: 6028
Joined: Tuesday 03 January 2017 14:18
Target OS: Linux
Domoticz version: Beta
Location: Netherlands
Contact:

Re: dzVents error on os.time

Post 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
}
Debian buster, bullseye on RPI-4, Intel NUC.
dz Beta, Z-Wave, RFLink, RFXtrx433e, P1, Youless, Hue, Yeelight, Xiaomi, MQTT
==>> dzVents wiki
User avatar
felix63
Posts: 244
Joined: Monday 07 December 2015 9:30
Target OS: Raspberry Pi / ODroid
Domoticz version: 2020.1
Location: Gouda
Contact:

Re: dzVents error on os.time

Post 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
User avatar
waaren
Posts: 6028
Joined: Tuesday 03 January 2017 14:18
Target OS: Linux
Domoticz version: Beta
Location: Netherlands
Contact:

Re: dzVents error on os.time  [SOLVED]

Post 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
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