Author Topic: Timed scenes triggering more than once?  (Read 3757 times)

Offline akbooer

  • Moderator
  • Master Member
  • *****
  • Posts: 6386
  • Karma: +290/-70
  • "Less is more"
Re: Timed scenes triggering more than once?
« Reply #30 on: May 11, 2017, 05:39:46 am »
need to validate

That would be very helpful.  I think this is the nub of the problem.

Quote
either a wget call or/and an external os.execute ...

os.execute() ?  Yes, that could do it.  I always try and avoid these.  If it's for a file-related operations you are much better off using the luafilesystem (lfs) module.  Of course, there are times when you have to spawn an external process.
3x Vera Lite-UI5/Edge-UI7, 25x Fibaro, 23x TKB, 9x MiniMote, 2x NorthQ Power, 2x Netatmo, 1x Foscam FI9831P, 9x Philips Hue,
Razberry, MySensors Arduino, HomeWave, AltUI, AltHue, DataYours, Grafana, openLuup, ZWay, ZeroBrane Studio.

Offline akbooer

  • Moderator
  • Master Member
  • *****
  • Posts: 6386
  • Karma: +290/-70
  • "Less is more"
Re: Timed scenes triggering more than once?
« Reply #31 on: May 23, 2017, 05:42:40 am »
I have updated the GitHub testing branch with a new version (2017.05.23) which has a number of fixes including an attempt to nail this timing error.

So type testing into the Update box and then click the Update button to give it a whirl.

Note: this IS on the testing branch, not development, because it's been hard for me to duplicate some of the reported problems with scene timing, and I do need your help in trying this out.  Everything else should work just fine...

(This also includes luup.job.set() and luup.job.setting() implementation)
3x Vera Lite-UI5/Edge-UI7, 25x Fibaro, 23x TKB, 9x MiniMote, 2x NorthQ Power, 2x Netatmo, 1x Foscam FI9831P, 9x Philips Hue,
Razberry, MySensors Arduino, HomeWave, AltUI, AltHue, DataYours, Grafana, openLuup, ZWay, ZeroBrane Studio.

Offline DesT

  • Sr. Member
  • ****
  • Posts: 364
  • Karma: +5/-1
Re: Timed scenes triggering more than once?
« Reply #32 on: May 23, 2017, 08:06:51 am »
AK,

My os.execute it's to run a Shell script...
Vera Edge-UI7/Plus-UI7 (2), DSC Partition (5 ) + Zones Sensors(31), Nest thermostat (1) & Protect Fire/CO (3), GE Sw (8 ), GE Dimr (14), FGMS-001 (2), ZW100 (2), RZCS4 (1), AL-DSC11 (1), Aeon HEM 2nd Edition (1), Aeon SSE (5), YRD220-ZW (1), SONOS (6), MyQ Chamberlain (1)
PINE64/openLuup/ALTUI/Rules

Offline DesT

  • Sr. Member
  • ****
  • Posts: 364
  • Karma: +5/-1
Re: Timed scenes triggering more than once?
« Reply #33 on: May 23, 2017, 08:14:21 am »
AK,

Not sure if it's related to "testing" repo... but in Startup jobs... I have

Code: [Select]
23  2017-05-23 08:12:52        67     Abort  job#23 :plugin openWeather [string "[67] I_openWeather.xml"]:176: parameter #2 should be type number but is string
Vera Edge-UI7/Plus-UI7 (2), DSC Partition (5 ) + Zones Sensors(31), Nest thermostat (1) & Protect Fire/CO (3), GE Sw (8 ), GE Dimr (14), FGMS-001 (2), ZW100 (2), RZCS4 (1), AL-DSC11 (1), Aeon HEM 2nd Edition (1), Aeon SSE (5), YRD220-ZW (1), SONOS (6), MyQ Chamberlain (1)
PINE64/openLuup/ALTUI/Rules

Offline akbooer

  • Moderator
  • Master Member
  • *****
  • Posts: 6386
  • Karma: +290/-70
  • "Less is more"
Re: Timed scenes triggering more than once?
« Reply #34 on: May 23, 2017, 08:37:16 am »
Ah, that's too stringent type checking.  I blame the person who suggested this in the first place  ;)
3x Vera Lite-UI5/Edge-UI7, 25x Fibaro, 23x TKB, 9x MiniMote, 2x NorthQ Power, 2x Netatmo, 1x Foscam FI9831P, 9x Philips Hue,
Razberry, MySensors Arduino, HomeWave, AltUI, AltHue, DataYours, Grafana, openLuup, ZWay, ZeroBrane Studio.

Offline akbooer

  • Moderator
  • Master Member
  • *****
  • Posts: 6386
  • Karma: +290/-70
  • "Less is more"
Re: Timed scenes triggering more than once?
« Reply #35 on: May 23, 2017, 08:45:32 am »
Not sure if it's related to "testing" repo... but in Startup jobs... I have

...now fixed in the testing branch, 2017.05.23b
3x Vera Lite-UI5/Edge-UI7, 25x Fibaro, 23x TKB, 9x MiniMote, 2x NorthQ Power, 2x Netatmo, 1x Foscam FI9831P, 9x Philips Hue,
Razberry, MySensors Arduino, HomeWave, AltUI, AltHue, DataYours, Grafana, openLuup, ZWay, ZeroBrane Studio.

Offline DesT

  • Sr. Member
  • ****
  • Posts: 364
  • Karma: +5/-1
Re: Timed scenes triggering more than once?
« Reply #36 on: May 23, 2017, 08:48:03 am »
Working now!

Will let you know if still having the scene running more than once!
Vera Edge-UI7/Plus-UI7 (2), DSC Partition (5 ) + Zones Sensors(31), Nest thermostat (1) & Protect Fire/CO (3), GE Sw (8 ), GE Dimr (14), FGMS-001 (2), ZW100 (2), RZCS4 (1), AL-DSC11 (1), Aeon HEM 2nd Edition (1), Aeon SSE (5), YRD220-ZW (1), SONOS (6), MyQ Chamberlain (1)
PINE64/openLuup/ALTUI/Rules

Offline akbooer

  • Moderator
  • Master Member
  • *****
  • Posts: 6386
  • Karma: +290/-70
  • "Less is more"
Re: Timed scenes triggering more than once?
« Reply #37 on: May 23, 2017, 01:11:36 pm »
My os.execute it's to run a Shell script...

You might care to investigate io.popen() see http://www.lua.org/manual/5.1/manual.html#pdf-io.popen

...not only can it spawn a process, but you could read intermediate results from it if you so chose.

I'm not saying it solves the problem, but just another way of doing this.
3x Vera Lite-UI5/Edge-UI7, 25x Fibaro, 23x TKB, 9x MiniMote, 2x NorthQ Power, 2x Netatmo, 1x Foscam FI9831P, 9x Philips Hue,
Razberry, MySensors Arduino, HomeWave, AltUI, AltHue, DataYours, Grafana, openLuup, ZWay, ZeroBrane Studio.

Offline DesT

  • Sr. Member
  • ****
  • Posts: 364
  • Karma: +5/-1
Re: Timed scenes triggering more than once?
« Reply #38 on: May 23, 2017, 01:18:55 pm »
I can try that too!  I don't really need to read the result or output, just need to run it!
Vera Edge-UI7/Plus-UI7 (2), DSC Partition (5 ) + Zones Sensors(31), Nest thermostat (1) & Protect Fire/CO (3), GE Sw (8 ), GE Dimr (14), FGMS-001 (2), ZW100 (2), RZCS4 (1), AL-DSC11 (1), Aeon HEM 2nd Edition (1), Aeon SSE (5), YRD220-ZW (1), SONOS (6), MyQ Chamberlain (1)
PINE64/openLuup/ALTUI/Rules

Offline a-lurker

  • Hero Member
  • *****
  • Posts: 872
  • Karma: +66/-8
Re: Timed scenes triggering more than once?
« Reply #39 on: May 23, 2017, 07:48:17 pm »
I'm a bit suspicious about the number being considered a string. GitHub shows this call for line 176:

https://github.com/999LV/openWeather-plugin-for-openLuup/search?utf8=%E2%9C%93&q=call_delay&type=

Code: [Select]
luup.call_delay ("Weather_delay_callback", WU["Period"])
And line 53 shows:   Period = 1800, -- data refresh interval in seconds     -- a number

So not sure why the error complains about a string?

Offline akbooer

  • Moderator
  • Master Member
  • *****
  • Posts: 6386
  • Karma: +290/-70
  • "Less is more"
Re: Timed scenes triggering more than once?
« Reply #40 on: May 24, 2017, 03:15:46 am »
...because its content is a number, but represented as a string type.



Edit: I think the preset subsequently gets over-written by a device variable string.
« Last Edit: May 24, 2017, 06:11:36 am by akbooer »
3x Vera Lite-UI5/Edge-UI7, 25x Fibaro, 23x TKB, 9x MiniMote, 2x NorthQ Power, 2x Netatmo, 1x Foscam FI9831P, 9x Philips Hue,
Razberry, MySensors Arduino, HomeWave, AltUI, AltHue, DataYours, Grafana, openLuup, ZWay, ZeroBrane Studio.

Offline DesT

  • Sr. Member
  • ****
  • Posts: 364
  • Karma: +5/-1
Re: Timed scenes triggering more than once?
« Reply #41 on: May 24, 2017, 06:34:54 am »
AK,

The latest "testing" version is not working properly in general!   Got a bunch of thing not working any more, like Rules Engine and also some "verabridge" thing!

Last night and this morning, a bunch of stuff related to Home Mode (Home vs. Night) stop working. 

In Rules Engine, got a couple of error like:
Code: [Select]
(RuleAction) #21-1.1(Action) of type 'action_function' - ./openLuup/server.lua:380: bad argument #1 to 'format' (number expected, got string)
Maybe it's related to the string format error we got before...
Vera Edge-UI7/Plus-UI7 (2), DSC Partition (5 ) + Zones Sensors(31), Nest thermostat (1) & Protect Fire/CO (3), GE Sw (8 ), GE Dimr (14), FGMS-001 (2), ZW100 (2), RZCS4 (1), AL-DSC11 (1), Aeon HEM 2nd Edition (1), Aeon SSE (5), YRD220-ZW (1), SONOS (6), MyQ Chamberlain (1)
PINE64/openLuup/ALTUI/Rules

Offline DesT

  • Sr. Member
  • ****
  • Posts: 364
  • Karma: +5/-1
Re: Timed scenes triggering more than once?
« Reply #42 on: May 28, 2017, 11:49:58 am »
AK,

I have a bunch of inet.wget call in my LUA, any suggestion on how to call them in background to avoid waiting the process to come back ?   I think that might speed up some scene!

EDIT:  Looks like the latest testing branch update works fine... will test it this week to make sure I don't have again the scene triggered more than once..
« Last Edit: May 28, 2017, 11:52:20 am by DesT »
Vera Edge-UI7/Plus-UI7 (2), DSC Partition (5 ) + Zones Sensors(31), Nest thermostat (1) & Protect Fire/CO (3), GE Sw (8 ), GE Dimr (14), FGMS-001 (2), ZW100 (2), RZCS4 (1), AL-DSC11 (1), Aeon HEM 2nd Edition (1), Aeon SSE (5), YRD220-ZW (1), SONOS (6), MyQ Chamberlain (1)
PINE64/openLuup/ALTUI/Rules

Offline akbooer

  • Moderator
  • Master Member
  • *****
  • Posts: 6386
  • Karma: +290/-70
  • "Less is more"
Re: Timed scenes triggering more than once?
« Reply #43 on: May 28, 2017, 01:45:33 pm »
I have a bunch of inet.wget call in my LUA, any suggestion on how to call them in background to avoid waiting the process to come back ?   I think that might speed up some scene!

Are you not concerned about the returns?  These are essentially just triggers/commands that you assume work OK?  We should be able to use asynchronous IO for that.  Although it will mean crafting an HTTP header manually, there are probably a few openLuup internal routines which may be of help.  I need to do exactly the same thing to VeraBridge to speed that up, although I've had it working fine with four bridged machines.

Quote
Looks like the latest testing branch update works fine... will test it this week to make sure I don't have again the scene triggered more than once..

That's good news... hope it continues that way!
3x Vera Lite-UI5/Edge-UI7, 25x Fibaro, 23x TKB, 9x MiniMote, 2x NorthQ Power, 2x Netatmo, 1x Foscam FI9831P, 9x Philips Hue,
Razberry, MySensors Arduino, HomeWave, AltUI, AltHue, DataYours, Grafana, openLuup, ZWay, ZeroBrane Studio.

Offline DesT

  • Sr. Member
  • ****
  • Posts: 364
  • Karma: +5/-1
Re: Timed scenes triggering more than once?
« Reply #44 on: May 28, 2017, 04:43:16 pm »
I have a bunch of inet.wget call in my LUA, any suggestion on how to call them in background to avoid waiting the process to come back ?   I think that might speed up some scene!
Quote
Are you not concerned about the returns?  These are essentially just triggers/commands that you assume work OK?  We should be able to use asynchronous IO for that.  Although it will mean crafting an HTTP header manually, there are probably a few openLuup internal routines which may be of help.  I need to do exactly the same thing to VeraBridge to speed that up, although I've had it working fine with four bridged machines.

I don't really care about the returns... but if last time you suggest me to use io.popen instead of os.execute,  is it because io.popen is asynchronous ?   if that's the case, I will just create a little shell script that call wget and use that instead of wget inside LUA!

Quote
Looks like the latest testing branch update works fine... will test it this week to make sure I don't have again the scene triggered more than once..

That's good news... hope it continues that way!
Vera Edge-UI7/Plus-UI7 (2), DSC Partition (5 ) + Zones Sensors(31), Nest thermostat (1) & Protect Fire/CO (3), GE Sw (8 ), GE Dimr (14), FGMS-001 (2), ZW100 (2), RZCS4 (1), AL-DSC11 (1), Aeon HEM 2nd Edition (1), Aeon SSE (5), YRD220-ZW (1), SONOS (6), MyQ Chamberlain (1)
PINE64/openLuup/ALTUI/Rules