Author Topic: norepeat (Luup events)  (Read 2780 times)

Offline Ap15e

  • Beta Testers
  • Hero Member
  • *****
  • Posts: 1998
  • Karma: +12/-0
norepeat (Luup events)
« on: March 19, 2011, 01:22:22 pm »
Code: [Select]
06      03/19/11 17:54:50.572   Device_Variable::m_szValue_set device: 16872 service: urn:upnp-ap15e-com:serviceId:DAD1 variable: EarthquakeMagnitude was: 1.4 now: 2.2 #hooks: 1 upnp: 0 v:0xaa3d68/NONE duplicate:0 <0x803>
06      03/19/11 17:54:51.336   Device_Variable::m_szValue_set device: 16872 service: urn:upnp-ap15e-com:serviceId:DAD1 variable: EarthquakeDistance was: 9087 now: 8944 #hooks: 1 upnp: 0 v:0xaa3308/NONE duplicate:0 <0x803>
06      03/19/11 17:59:51.553   Device_Variable::m_szValue_set device: 16872 service: urn:upnp-ap15e-com:serviceId:DAD1 variable: EarthquakeMagnitude was: 2.2 now: 2.2 #hooks: 1 upnp: 0 v:0xaa3d68/NONE duplicate:1 <0x803>
06      03/19/11 17:59:51.561   Device_Variable::m_szValue_set device: 16872 service: urn:upnp-ap15e-com:serviceId:DAD1 variable: EarthquakeDistance was: 8944 now: 8944 #hooks: 1 upnp: 0 v:0xaa3308/NONE duplicate:1 <0x803>[color=red]
06      03/19/11 18:04:51.320   Device_Variable::m_szValue_set device: 16872 service: urn:upnp-ap15e-com:serviceId:DAD1 variable: EarthquakeMagnitude was: 2.2 now: 2.2 #hooks: 1 upnp: 0 v:0xaa3d68/NONE duplicate:1 <0x803>[/color]
06      03/19/11 18:04:51.327   Device_Variable::m_szValue_set device: 16872 service: urn:upnp-ap15e-com:serviceId:DAD1 variable: EarthquakeDistance was: 8944 now: 8944 #hooks: 1 upnp: 0 v:0xaa3308/NONE duplicate:1 <0x803>

Excerpt from JSON file:

Code: [Select]
"event_10":{
                    "label"        : "Magnitude of earthquake is greater than",
                    "serviceId"    : "urn:upnp-ap15e-com:serviceId:DAD1",
                    "norepeat"     : "0",
                    "argumentList" :
                                     {
                                       "argument_1" :
                                         {
                                           "dataType"         : "number",
                                           "name": "EarthquakeMagnitude",
                                           "prefix": "" ,
                                           "comparisson": ">"             ,
                                           "suffix": ""
                                         }
                                     } 
                  }

Scene:
fire event, if magnitude > 1.5

Result:
Event fires once (03/19/11 17:54) for a magnitude > 1.5, but does not fire again (03/19/11 17:59; as long as the magnitude remains > 1.5?).

Does that mean that
Code: [Select]
"norepeat"     : "0",
doesn't work?

Offline mcvflorin

  • Administrator
  • Hero Member
  • *****
  • Posts: 1755
  • Karma: +11/-3
Re: norepeat (Luup events)
« Reply #1 on: March 21, 2011, 05:38:52 am »
norepeat must be 1 for an event to be triggered only once.

Offline Ap15e

  • Beta Testers
  • Hero Member
  • *****
  • Posts: 1998
  • Karma: +12/-0
Re: norepeat (Luup events)
« Reply #2 on: March 21, 2011, 05:40:40 am »
Only once and never again?

Even with norepeat 0 the event doesn't fire if the variable gets updated with the same value as before.

Offline mcvflorin

  • Administrator
  • Hero Member
  • *****
  • Posts: 1755
  • Karma: +11/-3
Re: norepeat (Luup events)
« Reply #3 on: March 21, 2011, 06:22:12 am »
Quote
Only once and never again?

There is a flag that is set when the condition evaluates to true. When this flag is set, the scene won't run again. The flag is reset when the condition evaluates to false. So, after it runs once, the scene won't run again as long as the event condition evaluates to true.

Quote
Even with norepeat 0 the event doesn't fire if the variable gets updated with the same value as before.

This is strange. Please enable verbose logging and look in the LuaUPnP.log file for lines that begin with Event::Evaluate or Event::IsEqual.