New Homebridge Plug-in via MakerAPI

This new plugin does not rely on the "Homebridge App" in Hubitat and utilizes the MakerAPI and it's event stream to communicate with Hubitat.

A few caveats upfront:

  • You will have to redo all of your room assignments in the Home App on your phone

Installation:

1. Hubitat MakerAPI App Configuration

  • Under the Hubitat Web Interface, Click on Apps in the left side menu.
  • Click on the button +Add Built-In App
  • Select Maker API from the list of apps
  • Enable Allow Access via Local IP Address
  • Tap Done and you are finished with the App configuration.
  • Go into the newly added Maker API app
  • Select the devices you would like to have available via HomeKit
  • Enable Include Location Events to support HSM and chaning of modes

2. Homebridge Plugin Installation:

  1. Install homebridge using: sudo npm i -g homebridge (For Homebridge Install: Homebridge Instructions)
  2. Install Hubitat plugin using: sudo npm i -g homebridge-hubitat-makerapi
  3. Create your config.json configuration file. The config.json file has to be stored in the folder ~/.homebridge
  4. To help creating your inital configuration file, click here for some assistance.
  5. Start homebridge using the command: homebridge

Configuration File Parameters

Example of all settings. Not all settings are required. Read the breakdown below

{
   "platform": "Hubitat-MakerAPI",
   "name": "Hubitat",
   "app_url": "http://192.168.10.169/apps/api/YOUR_APPS_ID/",
   "access_token": "THIS-SHOULD-BE-YOUR-TOKEN",
   "local_ip": "10.0.0.70",
   "local_port": 20010,
   "polling_seconds": 300,
   "temperature_unit": "F",
   "mode_switches": true,
   "hsm": true,   
   "debug": false,
   "programmable_buttons": [
    "97",
    "98"
   ],
   "excluded_capabilities": {
      "HUBITAT-DEVICE-ID-1": [ "Switch", "TemperatureMeasurement" ]
   },
   "excluded_attributes": {
      "HUBITAT-DEVICE-ID-1": [ "power", "humidity" ]
   },
   "logFile": { "enabled": true, "path": "", "file": "", "compress": true, "keep": 5, "size": "10m"
   }
}
  • platform & name Required
    This information is used by homebridge to identify the plugin and should be the settings above.
  • app_url & access_token Required
    This is the base URL and access token for MakerAPI, check step 1 of the installation instructions on how to obtain the value Notice: The app_url in the example above may be different for you.
  • local_ip Optional
    Defaults to first available IP on your computer
    Most installations won't need this, but if for any reason it can't identify your ip address correctly, use this setting to force the IP presented to Hubitat for the hub to send to.
  • local_port Optional
    Defaults to 20010
    This is the port that homebridge-hubitat-makerapi plugin will listen on for events from your hub. Make sure your firewall allows incoming traffic on this port from your hub's IP address.
  • polling_seconds Optional
    Configures the how often (in seconds) the plugin should check if devices were removed or added from/to the selection in MakerAPI. Default is every 300 seconds. Almost no need to restart homebridge anymore! Name changes and changing a device driver still requires a restart.
  • excluded_capabilities Optional
    Defaults to None
    Specify the Hubitat device by ID and the associated capabilities you want the plugin to ignore
    This prevents a Hubitat device from creating unwanted or redundant HomeKit accessories
  • excluded_attributes Optional
    Defaults to None
    Specify the Hubitat device by ID and the associated attributes you want homebridge-hubitat-makerapi to ignore. This prevents a Hubitat device from creating unwanted or redundant HomeKit accessories
  • programmable_buttons Optional
    Defaults to None
    By default, pressing Buttons in Homekit trigger a "pushed" event for button number 1 in Hubitat. The setting "programmable_buttons" allows Hubitat to trigger HomeKit specific scenes. You can assign scenes to three types of events: Pushed, Held and DoubleTapped. This can be helpful to interact with Homekit only devices. E.g. a button press in HE can trigger a HomeKit only lock to lock. Note: there is no feedback if the Homekit scene was executed successfully or not. Specify the Hubitat device by ID in this setting to create a programmable button.
  • temperature_unit Optional
    Default to F
    Ability to configure between Celsius and Fahrenheit. Possible values: "F" or "C"
  • mode_switches Optional
    Default to false
    Create switches for modes and ability to switch modes by enabling such switches Possible values: true or false
    Requires HE fimrware 2.0.9 or newer
  • hsm Optional
    Default to false
    Integrates HSM into Home app and allow to arm/disarm the hsm and receive notifications on intrusions
    Requires HE firmware 2.0.9 or newer
  • debug Optional
    Default to false
    Enables debugging of HTTP calls to MakerAPI to troubleshoot issues
  • logFile Optional
    Settings to enable logging to file. Uses winston logging facility
    • enabled Optional
      Enable logging to file. Default is false. Set to true to enable file logging
    • path Optional
      Path to store log files. Defaults to path where config.json is stored - Only applicable if logFile -> enable is set to true
    • file Optional
      Filename of log file. Default is homebridge-hubitat.log - Only applicable if logFile -> enable is set to true
    • compress Optional
      Compress log files when they rotate. Default is true - Only applicable if logFile -> enable is set to true
    • keep Optional
      Number of log files to keep before deleting old log files. Default is 5 - Only applicable if logFile -> enable is set to true
    • size Optional
      Maximum size of log file. Default is 10m - Only applicable if logFile -> enable is set to true

Capability Filtering

The homebridge-hubitat-makerapi creates Homekit devices based on the attributes of devices. See Attribute Filtering below. To allow backwards compatibilty to tonesto7's plugin, the homebridge-hubitat-makerapi plugin still allows filtering by capability. Capabilities are going to be matched to Hubitat's listed capabilities at Driver Capability List and the associated attributes are going to be removed.

Attribute Filtering

The homebridge-hubitat-makerapi creates Homekit devices based on the attributes of devices. The following attributes are currently being handled:

Attribute HomeKit Devices
thermostatOperatingState Thermostat
switch and (level or hue or saturation) Light Bulb
switch Switch
motion Motion Sensor
presence Occupancy Sensor
lock Lock Mechanism
temperature (and not a thermostat) Temperature Sensor
contact Contact Sensor
door Garage Door Opener
smoke Smoke Sensor
carbonMonoxide Carbon Monoxide Sensor
carbonDioxideMeasurement Carbon Dioxide Sensor
water Leak Sensor
humidity Humidity Sensor
illuminance Light Sensor
battery Battery Service
position Window Covering
speed Fan Controller
valve Valve

The homebridge-hubitat-makerapi plugin does not discriminate! The plugin will create multiple devices in Homekit if a device has multiple of these attributes. Let's take a window shade as an example. A window shade might have the attributes "switch" and "position" and would create two Homekit devices, one as a switch and one as window covering. This might not be the desired behavior and you might want to only have one Homekit devices that sets the position of the shade. The plugin allows you to filter out the "switch" attribute and won't create a Homekit device for that attribute. To do so, you would add the following configuration to your config.json:

"excluded_attributes": { "HUBITAT-DEVICE-ID": [ "switch" ] }

Troubleshooting

With version v0.4.5 a plugin dashboard is available to help troubeshooting. The dashboard is a website that can be reached while homebridge and the plugin are running. To reach the dashboard, you can follow these steps:

  1. In Hubitat, go open your MakerAPI Instance
  2. Scroll down to find your "URL to send device events to by POST"alt text
  3. Copy the URL and enter the URL in a new browser window
  4. You will see a view like this, showing you the logging output of the plugin, the ability to download the log-file to your computer, enablign, disabling debug mode and see your current configuration alt text
23 Likes

I started using your add-on to HubConnect the last few days and have been happy with the results vs. the Homebridge app. I don't, however, have any plans to fire-up my old ST or wink hubs. What would be the pros/cons of using your MakerAPI version vs. the HubConnect version (other than HubConnect allowing connections to other hubs)?

1 Like

It's really a users choice:

  • The HubConnect implementation is the better choice if you have multiple hubs or want to bridge SmartThings and Hubitat
  • The MakerAPI is for the people that don't live in a multiple hub environment or rather want to stick to "Built-In" apps. HubConnect still requires a community app to be installed and configured.

Again, it is a users choice. I have both running at the same time :slight_smile: and the good news is that I don't see any slowdowns of my Hubitat anymore!

2 Likes

I will implement this today!!

Question 1: did you do a npm remove of the tonesto7 Homebridge plugin?

Question 2: does this delete your cache and device resulting in setting up your iPhone pairing again?

Answer: No, I did not. They "could" live side-by-side for no apparent reason. It will load the new plugin once you change your config.json to the new platform name

Answer: Yes, you will have to redo the device assignments and room setups as each device will get a new internal ID. You shouldn't have to re-add the homebridge bridge and the devices should just show up as long as you don't change the "bridge" information in your config.json

1 Like

Does anyone have a dummies guide to installing homebridge on a pi?
I've attempted it many times, all without success, I cant understand where its going wrong :expressionless:

Have you tried the instructions here: homebridge/README.md at latest · homebridge/homebridge · GitHub

1 Like

This is the best how-to article:

2 Likes

That guide pointed to by @dan.t seems most correct. I followed another and ran into problems and ultimately found advice to use --unsafe-perm, which fixed my problem(s). This guide suggests:

sudo npm install -g --unsafe-perm homebridge

1 Like

Yeah, followed this in that page.

Note: If you're running on a Raspberry Pi, you should have a look at the Wiki.

Hi can anyone tell me how do I go by using the new homebridge with Hubconnect? or point me to the correct thread for that. thanks

Take a look here:

1 Like

There seems to be a typo in your config.json example

the app url on my system needs to be of the format

"app_url": "http://192.168.0.232/apps/api/103/",

1 Like

You might consider including in the caveats that now events from all your devices are "shared" with HomeKit. One advantage of the old homebridge app, it could be argued, was that you would select which devices you wanted to port over to HomeKit. Im not sure how I feel about this yet. Is there any way to filter out only the specific HE devices you want to have on HomeKit? For me its only a couple of virtual presence switches, for example.

Thanks, I corrected it in my post

That is not entirely correct. The homebridge plugin listens to the eventsocket and the homebridge plugin filters out the events that are not meant for devices that are actually configured in the MakerAPI. HomeKit will never see those

Ah right, my bad on that. I do have nearly all my devices enabled in MakerAPI already, for use with node-red and influxdb. Can I run a second instance of MakerAPI with only select devices enabled just for home bridge?

Yes, that is what I do. In the next HE updated you will be able to give more meaning full names to each MakerAPI instance

1 Like

Great work on this Dan...So far so good on my setup. Will report back if I encounter any issues.

Also for others who have an issue with the first caveat, just create a few virtual switches for modes/HSM and setup a few Rule Machine rules until Hubitat updates the MakerAPI to have this capability.

Feature request: It would be great down the road as you improve your plugin to be able to exclude capabilities like the old plugin had. Not a huge deal but would be nice as I have several multi-sensors that I would rather not have all the measurements showing up in Homekit.

1 Like

Great thank you, I will take a look at that post