Can HE get Homekit devices status?


I have Homebridge 2.0 installed, so my Apple Homekit can get all the devices status from Hubitat. I am wondering if there's any app or hack to add and update Homekit native devices? Can anyone please give me a pointer?


You can create some Hubitat virtual devices, expose those to HomeKit, and then use HK automations to update the HE virtual devices when the native HK devices are updated, and vice versa. It’s not pretty, but you did ask for any workarounds! :wink::sunglasses:


Thanks for the tips. But what about temperature sensor? Virtual devices can't pass temperature readings to HE, can they?

Well.... :thinking:

The one possible way would be to use an iOS Shortcut, that is somehow triggered when a HomeKit Temperature sensor changes its value. Then, in the Shortcut, make an http call to the Hubitat hub's Maker API app, which exposes a virtual temperature sensor.

I have never done the above, so it is just a theory at this point.


I think this is possible, but will require a separate shortcut for every temperature value (maybe even two shortcuts).


If you need temperature-triggered automations in Hubitat, wouldn't it simpler to start with a Hubitat-compatible temperature sensor, which you could optionally expose to HomeBridge for use in Apple Home.


Very interested if someone has got this working … even with the extra shortcuts required

Hmmm…this is an actual CPU temp that my Homebridge plugin updates in a Raspberry pi. I was hoping I could pass this CPU temp updates to HE and displays in my ActionTiles dashboard.

Now this is MUCH easier, and doesn't even need HomeBridge!

On your Raspberry Pi, the CPU temperature is located at:

So you can setup a cron job to periodically do:
expr `cat /sys/class/thermal/thermal_zone0/temp` / 1000

This will give the CPU temp in Centigrade. You can also use expr to convert it to Fahrenheit if you wish.

Then use wget or curl to send the temperature to a Hubitat virtual temperature sensor using MakerAPI.

Edit -

I had a little bit of time, so I have created a rudimentary shell script that can be used on your Raspberry Pi. To use it, do the following:

  1. Create a virtual temperature sensor on Hubitat, and note it's device-id
  2. Add this virtual temperature sensor to MakerAPI (or create a new MakerAPI instance). Note the app-id and access-token for the instance of MakerAPI that you are using for this virtual temperature sensor.

Create a new shell script on your RPi using the contents of the script pasted below. Replace the items noted as such (ipaddr, appID deviceID, token). Make the shell script executable (chmod +x). Run it and make sure it updates the temperature on the virtual temperature sensor you've created.

If all that works, setup a cron job that runs this script as frequently as you desire (I'd suggest every 5-10 minutes).

cputemp=`cat /sys/class/thermal/thermal_zone0/temp`
cputempF=`echo "scale=2; 1.8*$cputemp/1000 + 32" | bc -l`
ipaddr=                 # replace with your Hubitat's IP address
appID=1522                          # replace with your MakerAPI app-id
deviceID=2902                       # replace with your virtual temp sensor device-id
token=xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx # replace with your MakerAPI access_token
wget http://$ipaddr/apps/api/$appID/devices/$deviceID/setTemperature/$cputempF?access_token=$token >/dev/null 2>&1

Oh wow. You are so amazing and kind. Thank you.

1 Like

That is of course a much easier approach , and KISS is good, but I would still very much like to be able to retrieve from HomeKit a value or even some text like ‘rising’ and get that importable/pushed into the broader automation world.

Some of the external 3rd party logic applications for HomeKit do include enhanced capabilities here and so something that can trigger off a value - maybe a share price or something and post the result to say a web hook would be most useful. Or transferring ‘pressure rising’ status ….

1 Like

Hi, I got an error in the log. Looks like the script connected to the hub, but seems the script was waiting for HE hub to respond. I got the App ID and token ID correct. However, I am not sure if my device ID is correct, because I got a very long strings for deviceID. Or do I need to tell MakeAPI to " Allow Endpoint to Control These Devices" in the MakeAPI app setting?

--2022-09-04 23:12:09-- http://x.x.x.x/apps/api/937/devices/2a4cb6445-1196-44e8-8cf1-22754fedd/setTemperature/125.77?access_token=ff1420e-e7bd-43ac-b8ff-7e61d98
Connecting to x.x.x.x:80... connected.
HTTP request sent, awaiting response... 500 Server Error
2022-09-04 23:12:09 ERROR 500: Server Error.

You need to use the device id, and not the device network id (DNI). See below:

1 Like

It works!!! Thanks so much for your kind help and guidance! Thanks a million!!!! You are the best!!



MakerAPI really is the Swiss Army Knife of Hubitat apps!