HMPresenceEvent-based predicate woes

I can't find a way to create an event trigger with a presence-based predicate

  • ideally for a particular user at home;
  • or at least, for all users at home.

Just for the record, the rationale: I need to keep the heating on in the user's private room when he is at home, off when he is not. The idea is to have a trigger based on a low temperature event (I can do that and works all right), which would then check whether the user is at home through the predicate; if so, it would open the radiator valve (the action also tested and also working all right); if not, it would do nothing.

How to?

Since I could find no API to create an HMPresenceEvent for a particular user, I've set it up in the Home application, and tried to use it this way (I happen to have only one such at the moment in Home, so there's no need to check the attributes):

HMPresenceEvent *pevent;
for (HMEventTrigger *t in home.triggers) if ([t isKindOfClass:HMEventTrigger.class])
    for (HMPresenceEvent *e in t.events) if ([e isKindOfClass:HMPresenceEvent.class]) {
        pevent=[e copy];
        break;
    }
NSPredicate *p=[HMEventTrigger predicateForEvaluatingTriggerWithPresence:pevent];
HMEventTrigger *et=[[HMEventTrigger alloc] initWithName:@"TEST PRESENCE" events:... endEvents:nil recurrences:nil predicate:p];

alas, this raises the “NSInvalidArgumentException: Invalid parameter; (user info absent)” exception. Looks like copy loses this information somehow?!? Without appropriate public APIs one can't say :(

(Since I can set up these events in the Home application freely with any kinds of action, it seems to be patently absurd not to open these APIs for privacy reasons, but that's another question, not for this ticket.)

Anyway, I've tried to resort to checking for “all users at home” through

pevent=[[HMPresenceEvent alloc] initWithPresenceEventType:HMPresenceEventTypeAtHome presenceUserType:HMPresenceEventUserTypeHomeUsers];

where HMPresenceEventUserTypeHomeUsers is documented as “Presence of all home users”. Nevertheless, when I log out the result, I get just “any user“:

[Presence-Event: type: HMPresenceTypeAnyUserAtHome, mode: HMPresenceEventActivationGranularityHome]

That's unusable for me. I need to check for presence of all users (if checking for a particular one is really forbidden for some inexplicable reason).

Please help. How to properly set up a trigger predicate for (ideally) a given specific HMUser, or at the very least, for a presence of all registered home users. Thanks!