Trigger channels and a thought - how can I know what the trigger outputs?

Hey everyone, quick question - when dealing with trigger channels what do you do to know what the trigger output actually is?
For example, for the Astro binding the sunset/sunrise trigger outputs “START”.
But if I’m reading the GitHub correctly for the OpenUV binding I believe the channel trigger outputs nothing?

If I’m adding a new thing, and it comes with a trigger channel how can I know what it will output, without going into a GitHub or creating a string item and wait for it to do something, which may take days or weeks (home connect binding uses trigger channels for things like the dryer lint filter cleaning reminder, as an example.)

The contents of the trigger event should be explained in the readme for the add-on. If it’s not that’s a “Bug” in the docs.

The data published as the event can be any string so if it’s not in the docs you have to look a the source code or somehow force the trigger to occur and log it out or link it to a String Item with the profile that lets you link an event channel to a String Item (normally event channels can only be used to trigger rules).

Yeah I figured.. i did the linking of a string item but just my luck the OpenUV binding seems to output nothing, so my string item was empty and that left me very confused..
The Astro binding is very clear from my perspective:

But the openUV binding channel documentation seems incomplete even:

Binding channels:


Thing openuv:uvreport:4616eb8dde:local "Local UV Report" (openuv:openuvapi:4616eb8dde) [refresh=60, location="removed"] {
	Channels:
		Type UVIndex : UVIndex "UV Index"
		Type Alert : Alert "UV Alert"
		Type UVColor : UVColor "Alert Color"
		Type UVMax : UVMax "UV Max"
		Type timestamp : UVMaxTime "UV Max Time"
		Type UVMaxEvent : UVMaxEvent "UV Max Event"
		Type Ozone : Ozone "Ozone"
		Type timestamp : OzoneTime "Ozone Observation Time"
		Type timestamp : UVTime "Report Timestamp"
		Type SafeExposure : SafeExposure "Safe Exposure" [index="II"]
		Type elevation : elevation "Elevation"
}

Or am i misunderstanding something somewhere??

The documentation doesn’t mention anything about UVMaxEvent trigger - so this needs to be updated.

Looking at the code, the binding merely sends a trigger with no data (empty string) .

It simply triggers the instant the UV Max time occurred. There’s no Start / End range like in astro.

FYI, you can create a channel trigger event that would trigger when any event is sent to that channel. You can then find out the actual event in the event trigger data.

A hypothetical example here - because digging out a concrete one would take even more time and I don’t have one off the top of my head: a keypad Thing can send a “PIN entered” event with the actual PIN number as the event. You won’t be able to trigger on a “static” event because you’d have to change your rule every time you changed the pin and you may be maintaining thousands of pins for a building security system.

Here’s an example (ruby) code to illustrate

rule "PIN Entered" do
  channel "somebinding:thing:pinpad:PINEntered"
  run do |event| 
    pin = event.event
    # Lookup the pin in the database
    if pin_is_valid(pin)
      logger.info "Access granted"
    else
      logger.warn "Someone entered an invalid PIN: #{pin}"
    end
  end
end

If on the other hand you only allow ONE particular PIN and you don’t mind using a static hard coded pin, then you can write your rule like this:

rule "PIN Entered" do
  channel "somebinding:thing:pinpad:PINEntered", triggered: "1234"
  run do 
    logger.info "Access granted"
  end
end

Of course in the case of UVMaxTime you simply disregard the event string, because it’s irrelevant and the binding sends an empty string anyway.

Excellent! thank you both, I have a good grasp of the topic now :slight_smile: