Harmony Binding - Sequence order

OH 3 with Harmony binding runs on Synology. And there are some rules that updating an activity of Harmony hub leads to switch on some power sockets.
In principle it works, but always the power sockets are switched on after the sequence of the Harmony activity. And it doesn’t matter how big the delay before the Harmony sequences is. I’ve found this problem in this forum too, but some years ago with OH 2. If I try to address the command itself it doesn’t seem to work.

Here’s my rule:

triggers:
  - id: "1"
    configuration:
      itemName: HarmonyHubHubR_CurrentActivity
      state: Fire TV
    type: core.ItemStateUpdateTrigger
conditions: []
actions:
  - inputs: {}
    id: "2"
    configuration:
      itemName: EGPMSLANFireTV_Ausfuhrung
      command: ON
    type: core.ItemCommandAction

Hi @rockito,

I am doing the same thing on OH2.5.12. The item state of current activity only changes after the activity has fully started on the harmony hub.

Instead of triggering the item state changed event, you should use the activityStarted trigger provided by the binding.

This trigger fires when the activity gets started. In my instance I had to add a delay in the harmony sequence bridging the power up time of the TV.

Cheers
Jonathan

Yes, thanks!
I also tried the way you told me once before, but it didn’t work.
But the problem was the underscore. I don’t need it for the item, but for the channel trigger.
Now it’s fine!

And if I understand it correctly “activityStarting” should be faster than “…Started”. It really is fast now!

triggers:
  - id: "1"
    configuration:
      channelUID: harmonyhub:hub:HubR:activityStarting
      event: Fire_TV
    type: core.ChannelEventTrigger
conditions: []
actions:
  - inputs: {}
    id: "2"
    configuration:
      itemName: EGPMSLANFireTV_Ausfuhrung
      command: ON
    type: core.ItemCommandAction

Hi @rockito,

yes, I had to learn that too. The activities with blanks in their names will have the underscore regarding the Harmony API and thus in the Harmony Binding’s current activity item.

ActivityStarting: Trigger fires, wenn the activity starts (before the first part of the Harmony sequence)
ActivityStarted: Trigger fires, when the activity has finished starting (all parts of the Harmony sequence have been performed)

These are my rules in OH 2.5.12:

rule SteckdoseTvWandEin
when
    Channel "harmonyhub:hub:HarmonyHub:activityStarting" triggered
then
    val String logPrefix = 'Harmony - SteckdoseTvWandEin - '

    var strActivity = receivedEvent.toString().substringAfterLast(" ")
    if (strActivity !== "PowerOff")
    {
        if (EnableLog_HarmonyRules.state == ON) logInfo('harmony.rules', logPrefix + 'Eine Aktivität (' + strActivity + ') wurde gestartet, schalte Steckdose TV-Wand ein.')
        tplinksmarthome_hs100_8A5C49_switch.sendCommand("ON")
    }
end

rule SteckdoseTvWandAus
when
    Channel "harmonyhub:hub:HarmonyHub:activityStarted" triggered
then
    val String logPrefix = 'Harmony - SteckdoseTvWandAus - '

    var strActivity = receivedEvent.toString().substringAfterLast(" ")
    if (strActivity == "PowerOff")
    {
        if (EnableLog_HarmonyRules.state == ON) logInfo('harmony.rules', logPrefix + 'Aktivität ' + strActivity + ' wurde beendet, schalte Steckdose TV-Wand aus.')
        tplinksmarthome_hs100_8A5C49_switch.sendCommand("OFF")
    }
end

Cheers Jonathan