[OBSOLETE] [BETA MILESTONE 1] CoRE (Community's own Rules Engine)

Where do I add that line of code, in the CoRE app?

It’s in the hub (C2C) device handler… find that block I showed and just add that extra line. Save and publish, start an activity, watch the logs…

I just looked at the Device in the IDE and it actually gives you this info right there on the device page:

[
{
“id”: “13391217”,
“name”: “CABLE”,
“type”: 1
},
{
“id”: “13395813”,
“name”: “APPLE-TV”,
“type”: 9
},
{
“id”: “off”,
“name”: “Activity OFF”,
“type”: “0”
}
]

Hmmmm… weird… so try 13391217 ??! Is that a function? Can you give me the whole function body?

That’s all the info it gives on the Device page. Tried 13391217 and it worked! Who knew…

When you say “device page”… do you mean the settings? state?

SmartThings IDE > My Devices > Logitech Harmony Hub C2C > ‘device page’

In the ‘Current States’ row of the table on the device page it gives me ‘activities’, which is where I found that above code, and ‘current activity’.

Can u do a snapshot? I need to know the “attribute” name that has that value… thanks

PS Is it “activities” ?

Yes ‘activities’

If all the templates would be available, would make life so much easier! There is an app called Logitech Harmony Trigger. That’s what you need but the source code is nowhere to be found. Not in templates not in Github…

It’s pretty simple actually. Get the “activities” attribute from the device, use the “name” for display, then “translate” to “id”. The question is, do all media controllers act like this? Or do some just take strings?

1 Like

Those ID’s are how harmony lists activities. I used to use EventGhost to push commands to it and those were required for the virtual buttons I used with Domoticz, and some other harmony app thing, was a real mess, this is SO much easier!

All ID’s are listed under their virtual switches if you have the Harmony SmartApp create them, as well.

I have a feeling this is how Harmony implemented it. But other Media controllers may just list names in the activiities attribute. For example: [“CABLE”, “TV”, “SOMETHING ELSE”]

That’s where it gets tricky… How do I support all? :slight_smile:

1 Like

From the 3 or 4 programs I’ve used to talk to my hubs, they all used the ID. I think it’s the only thing that actually allows the hubs to activate something. I vaguely recall sending the activity name directly to the hub at first and not having any success. Curl the ID and bam it just worked.

Edit: Sorry sorta misread, I guess what I’m saying is you can’t support all like that, but, can you extract info from an existing device? Do something where you select Harmony Device, then CoRE finds anything matching harmony-xxxxxxx-xxxxxxx and pull the last bits, tied to the name so it’s user friendly?

2 Likes

One at a time?

New question. I was about to create a second piston very similar to an existing piston. I have two activities, Turn On Cable and Turn on Apple TV. I need both of them to turn on/off a bunch of lights, lock doors, set thermostats, etc. The only difference between them is that depending on the switch that is pressed to trigger the piston, either the Cable or Apple TV needs to be turned on. All the other stuff happens regardless of which of the two switches is pressed.

Is there a way to build this into one piston? If not, is there at least a way to duplicate the first piston so I don’t need to recreate the whole thing from scratch?

The only way right now is via individual actions.You need to enable Expert Mode for that. Then you can say something like:

IF
    (
        Button #1 is pushed >>> when true > turn on cable
        OR
        Button #2 is pushed >>> when true > turn on apple tv
    )
THEN
>>> all the other common tasks go here.

Once you enable expert mode, you’ll find an “Individual actions” option under each condition or condition group. Create a group, add two conditions to it, one for one button, the other one for the second button, make the grouping OR between them and add individual tasks to the two conditions in the OR group.

There may be a variable restriction in the Actions in the future, along with the Mode restriction, Alarm restriction… So you can filter actions down by variables. But not there yet.

OK thanks I’ll give it a try. Cheers.

@ady624 Adrian, the dashboard is amazingly cool. It lets me look at what I’ve done and say to myself “What were you thinking, bonehead?” So, for that, thanks.

I am looking for something that I thought was there, but can’t find: How to have Condition/Groups under both a THEN clause and the corresponding ELSE clause, like:

IF condition1 IF ( Time == Day >>>> when true > set mode X1 Time == Night >>>> when true > set mode X2 ) ELSE IF ( Time == Day >>>> when true > set mode Y1 Time == Night >>>> when true > set mode Y2 )

I can get the first IF block with no problems, using all the varieties of the piston types; where I am stumped is entering the second block. After the primary ELSE, it only gives me the option for entering an ACTION not a CONDITION (which, in turn would permit a new group).

I doubt it’s a bug, more likely by design. Given the non-optimized nature of the condition evaluation, is it possible to have independent condition evaluations under both the THEN and ELSE clauses?

1 Like

Are you looking for the Else-If piston?

Simple piston: IF (conditions) THEN (actions) ELSE (actions)
Else-If piston: IF (conditions) THEN (actions) ELSE IF (conditions) ELSE (actions)

Has anyone noticed you can take a snapshot of the piston in the dashboard? It opens an image in a new tab, you can then save that to your Photos and post it here :slight_smile: No more multiple screen snapshots… :slight_smile:

3 Likes