I have been using a C8 Pro (currently running 2.4.4.155) happily for over a year now. I am trying to solve a "presence" problem in our garage, and am struggling a bit.
We have a total of five Aqara presence sensors in our garage...2 FP2s, 3 FP300s. They're currently slaves to Homekit via an Aqara M3 hub. I'd like to use a virtual device (or a hub variable linked to a virtual device) to represent aggregate garage "presence". The cleanest way (in my mind) is to have each sensor set/clear a bit in a value on presence/absence. If the value is non-zero, then one of them is detecting presence. I am fine with setting up local end points in per-sensor rules in Hubitat to do the setting and clearing. Will want to expose the result to Homekit, which suggests a virtual device.
Is this possible? Do I need to write my own driver for a such a virtual device, or is there some lower-pain way to go about this? I've already doctored up a driver for another task, so have had some exposure to Groovy, but it ain't much. Coming from Vera, this was pretty small potatoes in Lua.
Currently the presence sensors are HK visible only.
Would (for this) prefer to keep the automation on the HK side. If HK had a way to represent/maintain state, I could leave HE out of this. One thing I could do (and am not fond of this) is have the HK devices on presence/absence hit a house workhorse server with URL requests to set/clear bits there. It's a bit more overhead (and yet more Rube Goldberg) that inflicting it on HE, but with either CGI or PHP, I can twiddle bits until the cows come home.
At the end of the line, what I want this all to do is control garage lighting. It's expected that lights come on quickly when they should, but I am fine if turning them off is more leisurely. I am partially heading down this path because I'd prefer that the main garage overheads don't wink out when we're working in one of the side bays, which they do. And I'd like to add some controlled delay on that, even so...the FP300s have config for that, the FP2s, not so much.
If any presence sensor (2 FP2’s and 3 FP300’s) is present then “turn on/make present” a virtual device.
If all presence sensors (2 FP2’s and 3 FP300’s) are not present then “turn off/make not present” a virtual device.
Yes, that's the gist of it. And I guess a fairly simple way to do this is possible entirely in HK. Have any of the sensors turn on their respective bay lights and the main overheads on presence. Have them do nothing directly to the main overheads on absence. And have an automation that runs every five minutes that checks them all, and if they're all showing absence, turn off the mains. The problem I have been fighting is that I have absence detection turning off lights...and wanted that to be a group decision. Kicking that part down the road makes this pretty simple.
You could also use Maker API, and let Hubitat be the server you hit. Have a virtual motion sensor in Hubitat for each real one on the HomeKit side, and set them to active or inactive with api calls to Maker API. Then use Rule Machine or Webcore to set a another virtual device to the aggregate motion state.
You could even skip Maker API by using Webcore directly, as you can call a piston with a web url and send it data, then that piston alone can keep track of the sensor state, and set a single virtual motion sensor to the aggregate state every time one of the devices changes and HK calls the piston with the new state.
You get the url of the piston from within the piston, and use that to call it and send it data. It will be a Hubitat cloud url. ..../execute/your_piston_id?motion1=active
Example with two sensors:
Edit: Note, you don't need to use the cloud api, you can replace the cloud portion of the url with your local hub IP and the piston app ID found in the apps list on Hubitat: http://x.x.x.x/apps/api/piston-app-id/execute/
I don't have a pro, but wouldn't this just be a case to use the HomeKit bridge, to bring those devices into Hubitat? I also don't use Homekit, so correct me if I am wrong, or why you can't do that.