Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Triggered event to turn stuff off
#11
zra Wrote:Dean,

Does the event server have access to global variables? Can i test for values in the action area of the event server?

The event server has it's own global variable space, shared by the triggered and scheduled events. So actions set by one action will be seen by another. You do have to be careful not to make assumptions though because multiple actions can be running at once.
Dean Roddey
Explorans limites defectum
Reply
#12
Thanks,

That was what i was doing wrong last week. I was trying to call up the value of a global variable from within the event server and it wasnt liking it.

Made some local variables within the event server and initialized them from my variables driver and wallah.
Reply
#13
zra Wrote:Thanks,

That was what i was doing wrong last week. I was trying to call up the value of a global variable from within the event server and it wasnt liking it.

Made some local variables within the event server and initialized them from my variables driver and wallah.

I think you may have a terminology issue. The variables driver isn't providing 'global variables'. They are just fields that one can use as variables (i.e. the only hold whatever you write to them.) If anything, they are 'system variables' in that they are available system wide.

Variables are either global (to whatever program the variable is created by) or local (limited to the action that created it.)

So the event server has a global variables scope that any scheduled or triggered actions can see. Any fields are also available to any action, anywhere, so any variable driver fields are definitely available, but they are fields, not variables, so you have to access them as fields, i.e.:

$(moniker.field)

not:

%(moniker.field)

$() is for getting the values of fields, and %() is for getting the values of variables, and other standard tokens like runtime values or action parameters, which are really just sort of special variables created for you automatically.

So you can certainly access variable fields within your triggered or scheduled events if you want. If you are going to access a field value multiple times in the same action, and you aren't worried about it changing in between accesses (or what to make sure you only see the initial value), then you can grab the value of the field and put it into a local variable and use that for the rest of the action. That will be more efficient since you aren't going to back over the network multiple times to get the same field within the scope of a single action.
Dean Roddey
Explorans limites defectum
Reply
#14
Followup question.

Per your suggestion I created a countdown timer that sends an event when its value = 0. Since that value is, presumably zero, at all times except for when i start it counting down is it constantly sending events to the event server? Should I be concerned with that? If so, can you suggest a better way to handle it?

On a second, perhaps, related note, I had a few executions of the code when i wasnt expecting it, so I created an override switch, using a variables driver field. Now the code in the triggered event server only executes based on the value of that override.
Reply
#15
Events are only triggered on change to, and not while equal. So you will only get one event trigger on your timer.

Are you sure it was the TE that ran and not something else somewhere?

Mick
Mykel Koblenz
Illawarra Smart Home
Reply
#16
im pretty sure Mick. By the way, I have it set to send when isequal to 0.
Reply
#17
yeah isequal is still only a single triggered event

i.e.

value changes from 1 to 0 - trigger sent (value now equals 0)

while the value is at 0 there are no triggers sent. This has been a bug bear to some of us becase we want to trigger to be sent (eg you want a triggered action when you change to CD, but CD is already selected) but no trigger is sent.

Hence the question, you wont get re-triggers unless the value is changing and going back to 0.

Similarly, if you have say isLsThanEq, and a value of 5, it would only trigger 6 times (assuming 1 second resolution), 5, 4, 3, 2, 1 & 0 on a countdown, and only when the value changes, not while it was constant.

Mick
Mykel Koblenz
Illawarra Smart Home
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Status of Scheduled and Triggered Events gReatAutomation 4 1,491 04-21-2020, 12:58 PM
Last Post: gReatAutomation
  event and subsequent countdown timer question dogman 9 5,052 05-03-2018, 06:36 PM
Last Post: dogman
  your sched/triggered/tasker/IFTTT events IVB 17 9,262 01-18-2018, 07:41 AM
Last Post: RichardU
  Idea for a different kind of event processing mechanism Dean Roddey 0 1,593 03-20-2017, 09:29 AM
Last Post: Dean Roddey
  Best Way to Handle Wait Times within a Triggered Event kblagron 9 4,874 06-25-2016, 06:03 PM
Last Post: Dean Roddey
  Thingspeak event monitor potts.mike 5 3,560 05-09-2015, 06:11 PM
Last Post: wuench
  Overlay in an Overlay triggered by Widget Deane Johnson 4 3,772 11-09-2014, 10:29 AM
Last Post: Deane Johnson
  event scheduler ellisr63 8 4,113 04-11-2014, 02:43 PM
Last Post: ellisr63
  CQC & Event Ghost Read current state jdmevo123 3 2,799 12-05-2013, 06:49 PM
Last Post: wuench
  EmailURLImg in Triggered Events TurboSam 6 3,606 11-23-2013, 01:50 PM
Last Post: Dean Roddey

Forum Jump:


Users browsing this thread: 1 Guest(s)