Post

Replies

Boosts

Views

Activity

Reply to Missing entitlement for API HomeKit error
Thanks again!! Oh sigh. If the response is local-only, it could have been synchronous just as well I guess. Well never mind. Looks like virtual switches is the way to go (lucky me I use homebridge as well, for far as I know, HomeKit does not support those either :) Well perhaps with shortcuts it does, but shortcuts are private API :( ) Is there any — even partial/temporary — solution for the “would need to know what actually happened” problem as outlined above? I'd bet if you use shortcuts heavily, you need something like that even more desperately than I do with just “plain” events+predicates, don't you? Thanks a lot for all the insight and advices.
Topic: App & System Services SubTopic: Core OS Tags:
1w
Reply to Missing entitlement for API HomeKit error
Hmmm, meantime, I've been able to track one of the problems “manually“. Seems disabling a trigger programmatically (and of course waiting until the completion handler returns no error) does not really disable it. That seems to take some extra time. I understand it must take extra time until the change gets to the hub and an acknowlegde back, but that's precisely why the service is async with a completion handler (I naïvely thought). I've got a trigger which runs upon a light off. Now, I need occasionally to switch the light off without firing the trigger; the solution is obvious — disable the trigger (wait for ack), switch off the light (wait for ack), re-enable the trigger. Only it does not work. The trigger happily fires, regardless (should be) disabled. Here's my code (for better readablility error checking and logs removed; those are there all right, never any error occurred during my testing, and when the trigger should be disabled, trigger.enabled always returns NO. Only it's a lie :( ) [trigger enable:NO completionHandler:^(NSError * _Nullable error) { [NSThread sleepForTimeInterval:7]; [light writeValue:@0 completionHandler:^(NSError * _Nullable error) { [trigger enable:YES completionHandler:^(NSError * _Nullable error) { }]; }]; }];Note please the sleep. Without it it simply never works (ie, the light goes off all right, and then the trigger always fires). With 7 (seven!) seconds it seems to be sorta reliable. With 6, it still fired pretty often. How the darn do I determine that a trigger is really disabled?
Topic: App & System Services SubTopic: Core OS Tags:
1w
Reply to Missing entitlement for API HomeKit error
I've again bumped into the debugging problem (compare please above). My application, of course, (usually) sees all right that a characteristic value changed. Occasionally though, I would need to know why that happened. Something like there is no known reason, presumably the device decided by itself; or: it was set up through writeValue:completionHandler: from the “Eve” application (bundle-id) at a device named “New Minipad” (vendor-id); or: it was a result of scene “X” being activated, which itself was a result of trigger “Y” being fired... ... and so forth. Is there any way to get to this kind of information? Even through a private API, whose usage would immediately throw the app from AppStore (but would help on my own device when run from Xcode) or something like that? Thanks!
Topic: App & System Services SubTopic: Core OS Tags:
1w
Reply to Missing entitlement for API HomeKit error
Hmmm... after all, the “LaunchServices has returned error -54” problem looks like a “simple” Xcode (or perhaps Keychain, not sure of that) bug, not some deep HomeKit mystery. It occurred a number of times meantime, and so far (fingers crossed that it holds in future), I've found one completely reliable fix: quit and re-launch Xcode. Occasionally after re-launch I am asked to allow an access to a keychain item (incindentally, I always select “Always”, but the next time it asks anyway — at the very least this part feels like a Keychain bug), often not even that. Always after the Xcode re-launch my application builds and launches all right without a -54.
Topic: App & System Services SubTopic: Core OS Tags:
1w
Reply to Looks like the Home application breaks non-trivial predicates?
Thanks again! Just to quickly fix the loose ends, not that it is important anyhow :) Have you looked at HMCalendarEvent? Thanks, I do use those elsewhere (and so far, I haste to add, they work without a glitch). In this particular case though the problem was that these triggers happen to have more complicated events to fire on; they just should be skipped/ignored unless on one of a set of particular dates. Meantime, I've found another solution (essentially, my HK application checks daily the current state, and changes the triggers programmatically when one of the important dates is less than a week in future; this way, recurrence can be used instead of a predicate, and the danger of my app not being able to check/fix the triggers at least once in the week is very low). ... For example, what should happen if an event fires “every two hours” when daylight saving time starts and stops? Similarly, scheduling yearly events in terms of day counts means that leap years shift the day every four years ... HomeKit handles the firing of these events by periodically processing the entire event set, determining what will fire “in the future,” and then triggering when the time arrives ... That's why I don't speak of calendar (nor any other) events, but just of the calendar-based predicates. Whilst the former indeed might affect a pretty complex logic of determining when to fire and when not, the latter seem to me very easy to implement, and without any potential drawback: when the trigger does fire (as determined through its events, as they are, without any potential extension), only then the current timestamp is checked against the calendar predicate. It fits all the fields, the scene is run (and end events are activated). It does not fit one of the fields, the scene is not run (and end events are ignored). Nothing else needed; especially there is absolutely no need to check the predicate anyhow unless/until the event actually fires. And here I really can't see why and how checking all the date component fields (even including those rarely used ones like the era; but at the very least also the year, month, and day) could be really more difficult or processing-heavy than checking just the hour and minute, as happens now. I am willing to bet that checking the characteristic-based predicates is both implementation- and runtime-wise very considerably harder. Do I blindly overlook something of importance here? Anyway, thanks again a lot!
1w
Reply to Looks like the Home application breaks non-trivial predicates?
Thanks again for further insight, and sorry for the “why on earth?!?” part; I just was letting out some steam from the frustration that such a nicely designed and potentially highly useable and handy API[2] does not work by far as well as it could and should :( Is there, at the very least, somewhere a reasonably complete and reliable documentation, even if a form of developer notes or something like that? Lately I've bumped into (and lost non-trivial time over) the problem that predicateForEvaluatingTriggerOccurringOnDateWithComponents: seems to support hours and minutes only. I've particularly needed to limit a trigger to a couple of specific dates (something like “just on Christmas and the 4th of July“), and found the hard way it does not work, sigh. I can't see any mention of such a limitation neither here nor there [1] :( Also, frankly, I can't see any reason why such a limitation should be added; seems to me completely gratuitous, for checking simply all the non-empty DC fields one-by-other against the current date is a programmer's work for about ten minutes (nor it adds any heavy computational complexity, especially on a device which is able to interpret as complex things as shortcuts). [1] Unlike e.g., recurrence, whose limitation actually happens to be documented all right. [2] Incidentally — not that it is of any importance, of course — the existence and (then perceived) flexibility of that API was one of main reasons I've chosen HomeKit years ago for my home automations: other options either have no API at all, or at best they are programmed in a by-far not as-nice API and in a by-far uglier language that the nice and convenient Objective C. Thanks!
1w
Reply to Looks like the Home application breaks non-trivial predicates?
As always, thanks a lot for a detailed insight! When I have more time, I shall try to create a reasonable bug-report. As for to avoid modifying complex automation outside of the app that created them absolutely, I do heed that advice. Nevertheless I did not modify anything in the slightest; I've just renamed it. Consider if you renamed a file in Finder and it changed its contents anyhow! In this case, Home very definitely should do nothing else than -[HMTrigger updateName:completionHandler:]. As for it's entirely possible for one user to create an automation that another user couldn't display/edit without paying money for an entirely new app quite, that's a reasonable approach, provided (a) it happens only upon edit, not just renaming (or ena/disabling)[1]; (b) it is accompanied with a warning dialogue roughly of kind “This automation contains parts unsupported by Home; do you want to edit it anyway (in which case the result might differ from the original)? [Yes][No]“ [1] Edit: due to the HomeKit API structure, the trigger contents should be also completely impervious to adding/removing scenes (possibly but for trigger-owned ones, whose API is private — why on earth?!? — and thus unknown to me).
2w
Reply to Develop DriverKit extensions locally with a Free Developer Account
I hope it is not too rude to add a comment in others threads, but I can see the primary problem here is essentially the same one I keep bumping into with my HomeKit application: to cut long story short, whilst privacy and security concerns are immensely important with a 3rd party code, I believe Apple should not limit anyhow what we do with our own devices. Correct me please if I am wrong, but I believe, through iCloud, Apple must have a list of my devices anyway, has it not? What then if you simply added a switch “private project” into Xcode. If the developer (with any kind of account, especially including the free personal one) switches it on, Xcode would then generate such a profile that the result would never run on any other device than my own ones; at the same moment though, it would not be limited at all in there and would be allowed anything on these devices. Can you see any potential harm with that? I can't, but of course, as always, I might be overlooking something of importance. And it would solve a very big number of problems, like this one, or the one of mine, or about zillion similar other ones.
Topic: App & System Services SubTopic: Drivers Tags:
2w
Reply to Missing entitlement for API HomeKit error
I just have successfully integrated my security panel to HomeKit, which leads to a new question (though I fear I know the answer, most probably): is there somewhere an access to the “Activity” list which I could use in my own application, or is that another Apple-only private API?
Topic: App & System Services SubTopic: Core OS Tags:
Replies
Boosts
Views
Activity
2d
Reply to Missing entitlement for API HomeKit error
Thanks again!! Oh sigh. If the response is local-only, it could have been synchronous just as well I guess. Well never mind. Looks like virtual switches is the way to go (lucky me I use homebridge as well, for far as I know, HomeKit does not support those either :) Well perhaps with shortcuts it does, but shortcuts are private API :( ) Is there any — even partial/temporary — solution for the “would need to know what actually happened” problem as outlined above? I'd bet if you use shortcuts heavily, you need something like that even more desperately than I do with just “plain” events+predicates, don't you? Thanks a lot for all the insight and advices.
Topic: App & System Services SubTopic: Core OS Tags:
Replies
Boosts
Views
Activity
1w
Reply to Missing entitlement for API HomeKit error
Hmmm, meantime, I've been able to track one of the problems “manually“. Seems disabling a trigger programmatically (and of course waiting until the completion handler returns no error) does not really disable it. That seems to take some extra time. I understand it must take extra time until the change gets to the hub and an acknowlegde back, but that's precisely why the service is async with a completion handler (I naïvely thought). I've got a trigger which runs upon a light off. Now, I need occasionally to switch the light off without firing the trigger; the solution is obvious — disable the trigger (wait for ack), switch off the light (wait for ack), re-enable the trigger. Only it does not work. The trigger happily fires, regardless (should be) disabled. Here's my code (for better readablility error checking and logs removed; those are there all right, never any error occurred during my testing, and when the trigger should be disabled, trigger.enabled always returns NO. Only it's a lie :( ) [trigger enable:NO completionHandler:^(NSError * _Nullable error) { [NSThread sleepForTimeInterval:7]; [light writeValue:@0 completionHandler:^(NSError * _Nullable error) { [trigger enable:YES completionHandler:^(NSError * _Nullable error) { }]; }]; }];Note please the sleep. Without it it simply never works (ie, the light goes off all right, and then the trigger always fires). With 7 (seven!) seconds it seems to be sorta reliable. With 6, it still fired pretty often. How the darn do I determine that a trigger is really disabled?
Topic: App & System Services SubTopic: Core OS Tags:
Replies
Boosts
Views
Activity
1w
Reply to Missing entitlement for API HomeKit error
I've again bumped into the debugging problem (compare please above). My application, of course, (usually) sees all right that a characteristic value changed. Occasionally though, I would need to know why that happened. Something like there is no known reason, presumably the device decided by itself; or: it was set up through writeValue:completionHandler: from the “Eve” application (bundle-id) at a device named “New Minipad” (vendor-id); or: it was a result of scene “X” being activated, which itself was a result of trigger “Y” being fired... ... and so forth. Is there any way to get to this kind of information? Even through a private API, whose usage would immediately throw the app from AppStore (but would help on my own device when run from Xcode) or something like that? Thanks!
Topic: App & System Services SubTopic: Core OS Tags:
Replies
Boosts
Views
Activity
1w
Reply to Missing entitlement for API HomeKit error
Hmmm... after all, the “LaunchServices has returned error -54” problem looks like a “simple” Xcode (or perhaps Keychain, not sure of that) bug, not some deep HomeKit mystery. It occurred a number of times meantime, and so far (fingers crossed that it holds in future), I've found one completely reliable fix: quit and re-launch Xcode. Occasionally after re-launch I am asked to allow an access to a keychain item (incindentally, I always select “Always”, but the next time it asks anyway — at the very least this part feels like a Keychain bug), often not even that. Always after the Xcode re-launch my application builds and launches all right without a -54.
Topic: App & System Services SubTopic: Core OS Tags:
Replies
Boosts
Views
Activity
1w
Reply to Looks like the Home application breaks non-trivial predicates?
Thanks again! Just to quickly fix the loose ends, not that it is important anyhow :) Have you looked at HMCalendarEvent? Thanks, I do use those elsewhere (and so far, I haste to add, they work without a glitch). In this particular case though the problem was that these triggers happen to have more complicated events to fire on; they just should be skipped/ignored unless on one of a set of particular dates. Meantime, I've found another solution (essentially, my HK application checks daily the current state, and changes the triggers programmatically when one of the important dates is less than a week in future; this way, recurrence can be used instead of a predicate, and the danger of my app not being able to check/fix the triggers at least once in the week is very low). ... For example, what should happen if an event fires “every two hours” when daylight saving time starts and stops? Similarly, scheduling yearly events in terms of day counts means that leap years shift the day every four years ... HomeKit handles the firing of these events by periodically processing the entire event set, determining what will fire “in the future,” and then triggering when the time arrives ... That's why I don't speak of calendar (nor any other) events, but just of the calendar-based predicates. Whilst the former indeed might affect a pretty complex logic of determining when to fire and when not, the latter seem to me very easy to implement, and without any potential drawback: when the trigger does fire (as determined through its events, as they are, without any potential extension), only then the current timestamp is checked against the calendar predicate. It fits all the fields, the scene is run (and end events are activated). It does not fit one of the fields, the scene is not run (and end events are ignored). Nothing else needed; especially there is absolutely no need to check the predicate anyhow unless/until the event actually fires. And here I really can't see why and how checking all the date component fields (even including those rarely used ones like the era; but at the very least also the year, month, and day) could be really more difficult or processing-heavy than checking just the hour and minute, as happens now. I am willing to bet that checking the characteristic-based predicates is both implementation- and runtime-wise very considerably harder. Do I blindly overlook something of importance here? Anyway, thanks again a lot!
Replies
Boosts
Views
Activity
1w
Reply to Looks like the Home application breaks non-trivial predicates?
Thanks again for further insight, and sorry for the “why on earth?!?” part; I just was letting out some steam from the frustration that such a nicely designed and potentially highly useable and handy API[2] does not work by far as well as it could and should :( Is there, at the very least, somewhere a reasonably complete and reliable documentation, even if a form of developer notes or something like that? Lately I've bumped into (and lost non-trivial time over) the problem that predicateForEvaluatingTriggerOccurringOnDateWithComponents: seems to support hours and minutes only. I've particularly needed to limit a trigger to a couple of specific dates (something like “just on Christmas and the 4th of July“), and found the hard way it does not work, sigh. I can't see any mention of such a limitation neither here nor there [1] :( Also, frankly, I can't see any reason why such a limitation should be added; seems to me completely gratuitous, for checking simply all the non-empty DC fields one-by-other against the current date is a programmer's work for about ten minutes (nor it adds any heavy computational complexity, especially on a device which is able to interpret as complex things as shortcuts). [1] Unlike e.g., recurrence, whose limitation actually happens to be documented all right. [2] Incidentally — not that it is of any importance, of course — the existence and (then perceived) flexibility of that API was one of main reasons I've chosen HomeKit years ago for my home automations: other options either have no API at all, or at best they are programmed in a by-far not as-nice API and in a by-far uglier language that the nice and convenient Objective C. Thanks!
Replies
Boosts
Views
Activity
1w
Reply to Looks like the Home application breaks non-trivial predicates?
As always, thanks a lot for a detailed insight! When I have more time, I shall try to create a reasonable bug-report. As for to avoid modifying complex automation outside of the app that created them absolutely, I do heed that advice. Nevertheless I did not modify anything in the slightest; I've just renamed it. Consider if you renamed a file in Finder and it changed its contents anyhow! In this case, Home very definitely should do nothing else than -[HMTrigger updateName:completionHandler:]. As for it's entirely possible for one user to create an automation that another user couldn't display/edit without paying money for an entirely new app quite, that's a reasonable approach, provided (a) it happens only upon edit, not just renaming (or ena/disabling)[1]; (b) it is accompanied with a warning dialogue roughly of kind “This automation contains parts unsupported by Home; do you want to edit it anyway (in which case the result might differ from the original)? [Yes][No]“ [1] Edit: due to the HomeKit API structure, the trigger contents should be also completely impervious to adding/removing scenes (possibly but for trigger-owned ones, whose API is private — why on earth?!? — and thus unknown to me).
Replies
Boosts
Views
Activity
2w
Reply to Develop DriverKit extensions locally with a Free Developer Account
I hope it is not too rude to add a comment in others threads, but I can see the primary problem here is essentially the same one I keep bumping into with my HomeKit application: to cut long story short, whilst privacy and security concerns are immensely important with a 3rd party code, I believe Apple should not limit anyhow what we do with our own devices. Correct me please if I am wrong, but I believe, through iCloud, Apple must have a list of my devices anyway, has it not? What then if you simply added a switch “private project” into Xcode. If the developer (with any kind of account, especially including the free personal one) switches it on, Xcode would then generate such a profile that the result would never run on any other device than my own ones; at the same moment though, it would not be limited at all in there and would be allowed anything on these devices. Can you see any potential harm with that? I can't, but of course, as always, I might be overlooking something of importance. And it would solve a very big number of problems, like this one, or the one of mine, or about zillion similar other ones.
Topic: App & System Services SubTopic: Drivers Tags:
Replies
Boosts
Views
Activity
2w