Author Topic: [resolved]Timer failed for midnight and plugin didn't work for next day timer  (Read 212 times)

Offline Deeps

  • Sr. Newbie
  • *
  • Posts: 33
  • Karma: +0/-0
Hi

I was checking following scenario.

In my application I take time from user, and on that time I daily switch on the lights.

So in startup I have called init() function and at the end of init()
    start  user based timers like
    luup.call_timer("onTimer",1,formattedOnTime,"",onTime);
    -----

    -- stop back tomorrow
   tomorrow = os.date("%Y-%m-%d 00:00:00",os.time()+86400)
   luup.log (TAG.." init: tomorrow: "..tomorrow);
   luup.call_timer("init", 4, tomorrow, "", LUL_DEVICE)

i have this code. So I was expecting that this tomorrow timer will get hit at 12am in night and it will again call init function and user timer will get start again for that day.

So to test this, yesterday I had set morning time. Then I switched ON my Vera dashboard and and laptop. And in morning I was waiting for bulbs to glow. But it didnt work.

So I have following queries regarding this
1. Is my logic correct for midnight timer? If you need any more explaination I can help
2. To run vera plugin do I need to keep my browser and vera controller page up and running?
3. Once I set timer and saved into my custom plugin.. can I shut down my browser and laptop?

Please let me know how to fix this. This logic works perfectly for same day.. timers get set and bulbs gets switched ON on specified time but didnt work for next day when my laptop is OFF

« Last Edit: July 30, 2018, 06:09:34 am by Sorin »

Offline Deeps

  • Sr. Newbie
  • *
  • Posts: 33
  • Karma: +0/-0
Re: Timer failed for midnight and plugin didn't work for next day timer
« Reply #1 on: July 12, 2018, 03:03:51 am »
When I checked the midnight logs they were as follow   GetLuaInterface can't find device type: 4/0x1057438 str: 45

45 is my device id of my plugin.

0 v:(nil)/NONE duplicate:1 <0x76edf520>
50      07/12/18 0:00:00.027    luup_log:45: *******************************************SPECTRUMLEDCONTROLLER: midnightTimer: 45 <0x760df520>
50      07/12/18 0:00:00.027    luup_log:45: *******************************************SPECTRUMLEDCONTROLLER:init45 <0x760df520>
50      07/12/18 0:00:00.028    luup_log:45: *******************************************SPECTRUMLEDCONTROLLER: updateLocalValues: 45 <0x760df520>
01      07/12/18 0:00:00.028    GetLuaInterface can't find device type: 4/0x1057438 str: 45 <0x760df520>
01      07/12/18 0:00:00.029    luup_variable_get interface 0x104f268 args 3 <0x760df520>
01      07/12/18 0:00:00.029    GetLuaInterface can't find device type: 4/0x1057438 str: 45 <0x760df520>
01      07/12/18 0:00:00.030    luup_variable_get interface 0x104f268 args 3 <0x760df520>
01      07/12/18 0:00:00.030    GetLuaInterface can't find device type: 4/0x1057438 str: 45 <0x760df520>
01      07/12/18 0:00:00.030    luup_variable_get interface 0x104f268 args 3 <0x760df520>
01      07/12/18 0:00:00.031    GetLuaInterface can't find device type: 4/0x1057438 str: 45 <0x760df520>
01      07/12/18 0:00:00.032    luup_variable_get interface 0x104f268 args 3 <0x760df520>
01      07/12/18 0:00:00.032    GetLuaInterface can't find device type: 4/0x1057438 str: 45 <0x760df520>
01      07/12/18 0:00:00.033    luup_variable_get interface 0x104f268 args 3 <0x760df520>
01      07/12/18 0:00:00.033    GetLuaInterface can't find device type: 4/0x1057438 str: 45 <0x760df520>
01      07/12/18 0:00:00.034    luup_variable_get interface 0x104f268 args 3 <0x760df520>
01      07/12/18 0:00:00.034    GetLuaInterface can't find device type: 4/0x1057438 str: 45 <0x760df520>
01      07/12/18 0:00:00.035    luup_variable_get interface 0x104f268 args 3 <0x760df520>
01      07/12/18 0:00:00.035    GetLuaInterface can't find device type: 4/0x1057438 str: 45 <0x760df520>
01      07/12/18 0:00:00.036    luup_variable_get interface 0x104f268 args 3 <0x760df520>
01      07/12/18 0:00:00.036    GetLuaInterface can't find device type: 4/0x1057438 str: 45 <0x760df520>
01      07/12/18 0:00:00.036    luup_variable_get interface 0x104f268 args 3 <0x760df520>
01      07/12/18 0:00:00.037    GetLuaInterface can't find device type: 4/0x1057438 str: 45 <0x760df520>
01      07/12/18 0:00:00.037    luup_variable_get interface 0x104f268 args 3 <0x760df520>
50      07/12/18 0:00:00.038   



Offline RichardTSchaefer

  • Master Member
  • *******
  • Posts: 10091
  • Karma: +763/-142
Re: Timer failed for midnight and plugin didn't work for next day timer
« Reply #2 on: July 26, 2018, 05:49:35 pm »
If Vera restarts you will loose any schedule timers.
And Vera's do restart more often than they should.

Countdown timer, PLEG, and PLTS have been designed so that their timers survive a Vera restart.

Offline Deeps

  • Sr. Newbie
  • *
  • Posts: 33
  • Karma: +0/-0
Re: Timer failed for midnight and plugin didn't work for next day timer
« Reply #3 on: July 27, 2018, 05:22:03 am »
I fixed it. Data passed to call back function was converted to string while passing. So I did tonumber() and it started working