Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Newbie Question: How do I get event data for triggered events?
#1
I have a single trigger setup to trigger on a CurItemName change for any of my players. In the actions I'd like to be able to get either the full field name or ideally just the driver name. How can I do this?
Reply
#2
Is my questions too basic for anyone to answer? Smile

In addition to this scenario above, I also need to have another one where I trigged on any change for a driver and am then able to figure out which field changed. I don't want to have to create a trigger for each field. I *assume* this is possible.
Reply
#3
sorry dude, i just created a different trigger for each field if i needed to know which one changed. maybe dean knows.
------------------------------------
Some of my devices: Sonos, Aeotec zWave, Nest, Rain8Net, Various H/T
What's next: CQC-Voice, Brultech GEM
My vlogs: https://www.youtube.com/c/IVBsHomeAutomation
Reply
#4
When you get a field change event, the source will include the field name. So you can ask for the source value from the event, cut off the common starting part of it, and what's left is the driver.moniker value.
Dean Roddey
Explorans limites defectum
Reply
#5
Dean Roddey Wrote:When you get a field change event, the source will include the field name. So you can ask for the source value from the event, cut off the common starting part of it, and what's left is the driver.moniker value.

I think I understood what you said, just not sure exactly how to get the Event information. Here is my code that does not work. No value is being assigned to the two LVars since they both stay at the J_Nothing value. Is this due to the driver? The event I'm trying to trap on is a change in the CurItemName on a Squeezebox.

Code:
//
// Get the Source info for the event
//
LocalVars::SetVariable
    P1=LVar:evType
    P2=J_NOTHING

LocalVars::SetVariable
    P1=LVar:evData
    P2=J_NOTHING

TrigEvent::GetEvField
    P1=/cqsl.actinfo/evtype
    P2=LVar:evType

TrigEvent::GetEvField
    P1=/cqsl.actinfo/evdata
    P2=LVar:evData

System::LogMsg
    P1=J_Debug
    P2=0
    P3=Got event type = %(LVar:evData)
    P4=Status

System::LogMsg
    P1=J_Debug
    P2=0
    P3=Got event data = %(LVar:evData)
    P4=Status
Reply
#6
You don't want those values. Those I think are only for user action events. You want to get the source event source. If you look in the Action Guide technical document, you'll see an example of what a field change event looks like. The source field is in the main event block at the top. It'll have a standard prefix, then if it's a field change event, it'll have the driver and field as part of that source value. You'll have to cut the leading fixed part of the source value off, leaving just the moniker and field.
Dean Roddey
Explorans limites defectum
Reply
#7
Let me ask it a dumber way since I can't seem to find any explicit examples or documentation.

Insead of
TrigEvent::GetEvField
P1=/cqsl.actinfo/evtype
P2=LVar:evType

What do I need to call toget the action info in to a variable?
Reply
#8
Actually, I told you wrong, what you want is in the Event System technical document. If you go to Appendix A, you'll see the format of a field change event. In the first block, there's a Source value, which will be something like:

Code:
source=cqsl.field:DevSim.Power

So you want to retrieve the event field:

/xap-header/Source

Then cut the 'cqsl.field:' part off. That'll leave you with the field that changed. So pass that /xap-header/Source to the GetEvField, and it'll put the value of that into the variable you indicate, so something like:

Code:
TrivEvent::GetEvField(/xap-header/Source, LVar:EvSource)
LocalVars::DelSubStr(LVar:EvSource, 0, 11)

I may have some typos, but basically that. That should leave the field name in the variable.
Dean Roddey
Explorans limites defectum
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  GPS Data from Traccar to MQTT simplextech 0 131 02-01-2020, 07:27 PM
Last Post: simplextech
  Timers or Waits in events? simplextech 18 1,251 01-08-2020, 02:01 PM
Last Post: Dean Roddey
  Server hardware question rhosch 3 530 10-02-2019, 11:19 AM
Last Post: rhosch
  Scheduled Events & Variables gReatAutomation 2 487 06-20-2019, 01:31 PM
Last Post: gReatAutomation
  Basic Z Wave/CQC Integration Question MikeW 6 1,378 12-05-2018, 01:12 PM
Last Post: MikeW
  event and subsequent countdown timer question dogman 9 2,933 05-03-2018, 06:36 PM
Last Post: dogman
  your sched/triggered/tasker/IFTTT events IVB 17 6,131 01-18-2018, 07:41 AM
Last Post: RichardU
  webriva template question lleo 21 7,449 01-08-2018, 08:53 AM
Last Post: Dean Roddey
  Idea for a different kind of event processing mechanism Dean Roddey 0 1,107 03-20-2017, 09:29 AM
Last Post: Dean Roddey
  Smart Handling of ISY Motion events Sendero 10 3,900 10-05-2016, 09:43 PM
Last Post: Dean Roddey

Forum Jump:


Users browsing this thread: 1 Guest(s)