How can I access historical data from HomeKit sensors -- or alternatively log this data myself - homekit

I have an outside and inside temperature sensor on HomeKit.
Recently I ran into the problem that I wanted to check the temperatures a couple of days ago.
As far as I have been able to determine, there does not seem to be a way to get historical data from HomeKit.
As an alternative, would it be possible to log homekit data yourself?
I know that iOS apps can request access to HomeKit data, so that could be one way to go about it.
However I would prefer to do this also when my phone is switched off / without network. Is there a (web)API that I can call in order to get access to this data from (say) a Raspberry PI, so that I can log this data on regular intervals?

There is indeed no way to access historical data from Homekit devices (unless you're able to do so though the device-maker's cloud).
As far as I know there is NO way to get to HomeKit data if you're not an iOS/macOS device.
Four years ago Homekit opened up the devices-end so that third party devices could be used.
There does not seem to be a similar move on the controller/reader end.
iOS apps can only access data while they run in the foreground -- supposedly for security and privacy reasons (good reasons as far as I'm concerned :) ). So unless you have an iOS device lying around that you're willing to sacrifice for this, this is a no go.
Possibly you could get this to work on a mac that is running 24/7; I'm not sure what the restrictions are there.
There is something you can do if you want to log this data.
Using Shortcuts for Home, you can have a small Shortcut-program run on your home hub (usually Apple TV or HomePod).
You will have access to fewer commands than in full (iOS) Shortcuts, however thing you can do is read out the value for HomeKit devices, and make HTTPS (post) calls.
The iOS Home app unfortunately only allows you to schedule this shortcut to run once a day, however using the third party (free) Eve app you schedule it to run once every 5 minutes.
Just make sure you start with setting up the timer, and only then transform it into a shortcut -- because of bugs/limitations of the way Apple works, it doesn't seem to work the other way round.
I did a writeup of this whole process a couple of days ago, including a way to post the data to a Google Sheet, for a 100% free solution.

Related

Can a website directly interface with os? WebUSB? Access windows dism?

I am lucky and thankful to be home for the holidays, and I wish everyone who reads this the best! I have an annual habit of doing windows clean installs on many of my family members' pcs along with my own.
I use dism in cmd/PowerShell on windows to create custom images for certain pcs, like adding drivers, removing preinstalled windows apps, updating preinstalled programs, etc. I made a small little PowerShell script that helps in the process as it is very tedious. (I normally do this while watching TV or something else.)
That got me thinking. Google created Android Flash Tool that sends commands to android devices directly from a website. It even can download new android images/builds and flash them to the device. I also stumbled upon Simon Chan's WebADB.
Those two examples are pretty cool; massive kudos to the developers of both. I was just hoping for some rough ideas. Is running say dism.exe possible on the web? Like taking a cloud file (like Google's android images) and running dism to make some user-selected customizations?
This process would entail being like a web-based Rufus by formatting and putting files on a user-selected USB Stick. (This should be possible?) However, the next step would require "talking to windows" and accessing dism.exe directly on the local windows machine. Then mounting an ESD/wim file that was just put on the USB stick, then making changes to it using dism, and then unmounting and committing changes to the stick. Would this be possible?
This is just a very early stage idea and would honestly probably be more hassle than it is worth. But I could totally work on it during my spare time just to learn. Frankly, before I should have asked the above questions, I should have asked:
Can a website talk directly to "windows."
Can a website say tell windows to unzip a file locally or zip a bunch of files?
Create folders or simple tasks such as writing files directly to a directory (without chrome/file explorer holding its hand)?
I have built websites before, I have used npm/node, angular, and familiar with Google Firebase/GCP. However, this seems more complicated and out of my knowledge base. Hilariously, I am a computing security/networking engineer, and I can't even begin to fathom the sheer amount of security issues that would be possible with something like this. The site basically needs access to run cmd/terminals on the client machine. The thought of that gives me nightmares.
As computing and, namely, the web continues to evolve with the advent of new APIs, PWAs, etc., it is interesting what one can do with a "simple" website. If what I am describing is not possible now, I hope that someday it can be—in a fully secure way.
Thank you to whoever reads this and responds! I am looking for a "yes/no, your crazy" and hopefully a rough description of how/what. However, I am open to anything! Thank you again.

(OS X) Pure Data sort of freezes when selecting an aggregate device in the audio settings

OS X has this great functionality called "aggregate devices." It allows you to merge multiple sound cards into one virtual device. I want to use this functionality to send different sounds to different outputs, via Pure Data.
I actually did manage to get my aggregate device to work with Pure Data, last Thursday. Now, for some reason, it won't let me. In the Audio Settings of Pure Data, if I select my aggregate device, the settings window closes and it's impossible to open it again or open any patch. Even quitting the application doesn't work, I have to kill it by force.
I've already spent a big part of the night on this, so... if by any chance someone has even the beginning of an idea...
Thanks!

How can I show my app is not a keylogger?

I've created a simple Mac app that gives you statistics on your working behavior over time. For example, your average words per minute, what language you are typing in, usage of the delete key, etc. Interesting stuff! However, some test users have said they wouldn't use the app if they didn't know me personally, since it collects keystrokes like a keylogger.
Is there some certification I can get to show that I'm not doing anything nefarious? (I never keep more than one word in memory!) Or will it be enough to have my app signed? Or open-source that part of the code? (Other parts I know I cannot make open source.)
Distributing through the Mac App Store will help, since users can see that Apple has tried your application and found nothing nefarious in it. [Added:] Also, sandboxing your app means that your app is restricted to an explicit set of abilities, which technically-skilled users could inspect. Anything not listed, you're unable to do, so this would be an easy way to prove that you don't send anything back over the internet.
Another thing would be to save all data in user-readable files. No binary plists, no Core Data stores, etc. (Whether the XML variants of either of those should count as user-readable would be more arguable, but for this purpose, I think at least an XML plist would be readable enough. Not sure about Core Data.)
If the user can read all of the raw data you store using applications that they trust (such as TextEdit), and not just your usual fancy in-app presentation of it, then they can check for themselves, and eventually trust, that you're not storing anything they wouldn't want you to.
If any concerned potential users email you about whether you report their keystrokes to your own server via the internet, and assuming that you don't make any internet connections at all (not even an update check), you can recommend that they should install Little Snitch, which pops up a confirmation alert anytime any app tries to connect to something. When they don't see such an alert about your app, they know that you're not phoning home.
You might also, on your product webpage, include a link to a tech profile. Here's Jesper's article proposing them, and here's one example of such a document, for one of his products.
I would think that Gatekeeper would be adequate for most users. If it turns out an app is doing bad things, then Apple could pull the plug on a malware developer. So that and maybe some time live should establish your program as 'safe' to those who are not technically inclined (e.g. cannot understand your source).
Simply distributing it in your or your company's name can do a lot to build trust in an app (provided of course your other products/programs have not violated users' trust).
If you can get the application onto Apple's App Store, then that means they will have checked it for such problems. There's no way they'd knowingly allow a key-logging app on there. Also, signing the app with an Apple certificate ensures that if it has been downloaded from the App Store and later is found to be nefarious, they can black list it.
Open-sourcing code would also be a good idea. I assume you can't Open Source all of it because it doesn't belong to you? If so, then make it clear what technologies it uses and be as open and honest about what the application does and how it goes about doing it.

What could cause an Android app to run slow on an identical device to one which it runs fast on?

I, and a few other of my Android app users, run a Galaxy Nexus. Most of us find the app to be blazing fast, but a couple are reporting that it is unusably slow also on a Galaxy Nexus. I'm shocked to hear them tell me that the buttons, scrolling, etc. are all slow. The main view of the app is a ListView containing many images, textviews, etc. In fact, you can check out the app for free on Google Play if you feel like digging deeper. I'm trying to compile a checklist of what might cause this issue.
Here's what I have so far:
Low memory
Low disk space
Uncaught errors
Rooted device (?)
Any other ideas?
More importantly, is there any way to detect (or even adjust for!) potential problems?
Some other things:
CPU Usage (monitor via an app like WatchDog (it's free)); it mightn't be your app that's the problem
Android version.
Connection speed (Wi-Fi vs 4G vs 3G vs 1x)
Carrier (since they like to flash their own custom ROMs)
AFAIK Android version and connection speed are exposed by the SDK, not sure about CPU usage or carrier.
Of the errors you listed, I think that low memory would be the most likely factor.
If I were you, I'd create a function that would collect as much of this information as possible and send it to your email (or someplace). Then, have some way for the user to call this function (e.g. in the settings menu or someplace like that).
Granted this is all just intuition as an end-user, I have little experience debugging deployed apps from the coding side.

Cocoa get Power Adapter Status

I'm currently working on a Backup Application, and I have received a lot of requests for features to be added recently, and the top one of them is adding a checkbox like "Back Up when on Battery Power" like Time Machine has.
So, is there a way I can get the status of the Power Adapter (plugged in and plugged in)? I assume that if one had a Desktop Mac, like iMac, etc, I would probably just get Plugged In all the time. Therefore, I need means of detecting if the computer is a portable or not.
I assume IOKit would be a library to look at, but I simply could not find anything in the docs, that are barely existent anyways on that Framework. Then, since it is an older Carbon Framework, is there a way to register a callback that gets called when that power state changes? That way I can properly implement this checkbox's functionality.
I'd appreciate help in clarifying this subject.
IOPowerSources.h has the functions you need. Start with IOPSNotificationCreateRunLoopSource() to create a run loop source and in your callback interrogate the power source info starting with IOPSCopyPowerSourcesInfo() and working your way down. There may be better examples, but this file appears to be a reasonable demonstration of how it's done; enough to get you started.

Resources