New Homebridge Plug-in via MakerAPI

Hi how are you able to control xiaomi devices paired to the Aquara hub with HE?

You need Homebridge for HE of course, then you need the HomeKiit version of the Aqara Hub (There is a Homebridge plugin for the regular Aqara and Mijia hubs, but it looks really hacky. I wouldn't want to have to maintain that connection). Lastley you need an iPad that can run the latest iOS, or a HomePod or an Apple TV 4 or later HomeKit automations.

Once you have those going, you use HomeKit automations to link devices. For example, I have my Xiaomi door sensors on the Aqara Hub so it can use them to trigger its alarm, but those same sensors show up in HomeKit. So I just created HomeKit automations that turn on HE virtual switches that I exposed to HomeKit via this Homebridge MakeAPI app. When the Xiaomi sensors close, a second automation for each turns off the virtual switch. So my HE rules that previously looked at the contact sensor directly, now trigger off the virtual switches that are linked to the Xiaomi sensors via HomeKit automations. Without the speed of the Homebridge MakerAPI app, this would be flakey and get out of sync. I know this from previous experience. But now, it's unnoticeable that the sensors are not directly connected to HE.

I don't have anything paired to the Aqara Hub at the moment that is an actuator, but I do use this same type of HomeKit automation with virtual switches to control the light on the Aqara Hub and its Arm/Disarm states, as well as the doorbell function.

Whenever I remove devices with this homekit integration they don't seem to magically disappear like they used to.
I wonder what has changed...

I'll take a look. Do you see any log output within 5 minutes of removing the device?
The plugin scans every 5 minutes if there are any changes and should remove the device from Homekit. I wonder if you see anything in the log.

These devices survived a reboot too.
I did update the plug-in on Homebridge not too long ago.
The logs are pretty quiet about it at least in HE.

[app:2370](https://XXXXXXXXXXXXX/logs#app2370)2019-07-17 11:45:49.149 am [debug](https://XXXXXXXXXXXXXX/installedapp/configure/2370)Testing URL is http://XXXXXXXXXXXX/apps/api/2370/devices?access_token=XXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

[app:2370](https://XXXXXXXXXXXX/logs#app2370)2019-07-17 11:45:49.144 am [debug](https://XXXXXXXXXXXXXX/installedapp/configure/2370)Initialize called

:stuck_out_tongue_winking_eye:

You won't see anything on Hubitat, you need to look at the Homebridge output. You should see something like this:

[2019-7-17 11:47:51] [Hubitat ZWave hhm:0.2.14] Refreshing All Device Data
[2019-7-17 11:47:51] [Hubitat ZWave hhm:0.2.14] Received All Device Data
[2019-7-17 11:47:51] [Hubitat ZWave hhm:0.2.14] Loading HSM
[2019-7-17 11:47:51] [Hubitat ZWave hhm:0.2.14] Processing HSM
[2019-7-17 11:47:51] [Hubitat ZWave hhm:0.2.14] Device Removed - Name Office Computer, ID 1474
1 Like

I'm experiencing the same issue as @keithcroshaw. My devices also survived a reboot. I'm happy to provide some logs, though I'm not entirely sure how. If you give me some instructions, I'm happy to provide them. Thanks!

How do you start Homebridge? Systemd, pm2, batch, manually? That really determines on how to get to the output.

I'm using pm2.

Ok, pm2 does this for you.

If you go into the folder cd ~/.pm2/logs/ you'll see log files for all of your services that are started with pm2. I need the one for homebridge that either includes the time when you removed the device from MakerApi or when you restarted homebridge.

This is the first entry in homebridge-out.log after I restarted the Raspberry Pi on Tuesday night. The final two lines say "...Configuration of cached accessories not done, wait for a bit... 1" That line is repeated thousands of times, repeatin every second since 9:45:04 pm Tuesday night.

FWIW, I can use homebridge to turn lights on and off.

[2019-7-16 21:44:01] Loaded config.json with 0 accessories and 1 platforms.
[2019-7-16 21:44:01] ---
[2019-7-16 21:44:01] Loaded plugin: homebridge-hubitat-makerapi
Homebridge Version: 2.4
Plugin Version: 0.2.14
[2019-7-16 21:44:01] Registering platform 'homebridge-hubitat-makerapi.Hubitat-MakerAPI'
[2019-7-16 21:44:01] ---
[2019-7-16 21:44:01] Loading 1 platforms...
[2019-7-16 21:44:01] [Hubitat] Initializing Hubitat-MakerAPI platform...
[2019-7-16 21:44:01] [Hubitat hhm:0.2.14] Setting "local_ip" not set in config, tried to determine it and found 192.168.1.32 -> I hope this is correct
Setup Payload:
X-HM://0023ISYWY1COI
Scan this code with your HomeKit app on your iOS device to pair with Homebridge:
e...
Or enter this code with your HomeKit app on your iOS device to pair with Homebridge:
                       
    β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”     
    β”‚ 031-45-154 β”‚     
    β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜     
                       
[2019-7-16 21:44:01] [Hubitat hhm:0.2.14] Configuration of cached accessories not done, wait for a bit... 19
[2019-7-16 21:44:01] Homebridge is running on port 51826.
[2019-7-16 21:44:02] [Hubitat hhm:0.2.14] latest version on npmjs is 0.2.14
[2019-7-16 21:44:02] [Hubitat hhm:0.2.14] your version of the plugin is up2date
[2019-7-16 21:44:02] [Hubitat hhm:0.2.14] Device Added (Cache) - Name Mode - Day, ID Day Hubitat
[2019-7-16 21:44:02] [Hubitat hhm:0.2.14] Device Added (Cache) - Name Mode - Night, ID Night Hubitat
[2019-7-16 21:44:02] [Hubitat hhm:0.2.14] Device Added (Cache) - Name Mode - Away, ID Away Hubitat
[2019-7-16 21:44:02] [Hubitat hhm:0.2.14] Device Added (Cache) - Name Mode - Bedtime, ID Bedtime Hubitat
[2019-7-16 21:44:02] [Hubitat hhm:0.2.14] Device Added (Cache) - Name Mode - Evening, ID Evening Hubitat
[2019-7-16 21:44:02] [Hubitat hhm:0.2.14] Configuration of cached accessories not done, wait for a bit... 14
[2019-7-16 21:44:03] [Hubitat hhm:0.2.14] Device Added (Cache) - Name Anne’s Lamp, ID 1
[2019-7-16 21:44:03] [Hubitat hhm:0.2.14] Device Added (Cache) - Name Night Scene, ID 418
[2019-7-16 21:44:03] [Hubitat hhm:0.2.14] Device Added (Cache) - Name Steve’s Lamp, ID 2
[2019-7-16 21:44:03] [Hubitat hhm:0.2.14] Device Added (Cache) - Name Living Room Lamp, ID 259
[2019-7-16 21:44:03] [Hubitat hhm:0.2.14] Device Added (Cache) - Name Day Scene, ID 417
[2019-7-16 21:44:03] [Hubitat hhm:0.2.14] Device Added (Cache) - Name Movie Scene, ID 385
[2019-7-16 21:44:03] [Hubitat hhm:0.2.14] Device Added (Cache) - Name Nursery Lamp, ID 97
[2019-7-16 21:44:03] [Hubitat hhm:0.2.14] Device Added (Cache) - Name Night Mode, ID 419
[2019-7-16 21:44:03] [Hubitat hhm:0.2.14] Device Added (Cache) - Name Bedtime Scene, ID 353
[2019-7-16 21:44:03] [Hubitat hhm:0.2.14] Device Added (Cache) - Name Gentle Bedtime, ID 359
[2019-7-16 21:44:03] [Hubitat hhm:0.2.14] Configuration of cached accessories not done, wait for a bit... 4
[2019-7-16 21:44:03] [Hubitat hhm:0.2.14] Device Added (Cache) - Name Front Door Light, ID 260
[2019-7-16 21:44:03] [Hubitat hhm:0.2.14] Device Added (Cache) - Name Bathroom Sink Light, ID 205
[2019-7-16 21:44:03] [Hubitat hhm:0.2.14] Device Added (Cache) - Name Nursery Floor Lamp, ID 257
[2019-7-16 21:44:04] [Hubitat hhm:0.2.14] Configuration of cached accessories not done, wait for a bit... 1
[2019-7-16 21:44:05] [Hubitat hhm:0.2.14] Configuration of cached accessories not done, wait for a bit... 1
[2019-7-16 21:44:06] [Hubitat hhm:0.2.14] Configuration of cached accessories not done, wait for a bit... 1

Below is the homebridge-error.log around the same time. Before this point, the only errors are: "[Hubitat hhm:0.2.14] HSM not configured, skipping" which appear pretty consistently every five minutes since I setup homebridge back in May.

[2019-7-16 20:24:12] [Hubitat hhm:0.2.14] HSM not configured, skipping
[2019-7-16 20:29:12] [Hubitat hhm:0.2.14] HSM not configured, skipping
ReferenceError: resp is not defined
    at /usr/lib/node_modules/homebridge-hubitat-makerapi/lib/util_http.js:109:97
    at <anonymous>
    at process._tickCallback (internal/process/next_tick.js:189:7)
[2019-7-16 20:39:12] [Hubitat hhm:0.2.14] HSM not configured, skipping
[2019-7-16 20:44:12] [Hubitat hhm:0.2.14] HSM not configured, skipping
[2019-7-16 20:49:12] [Hubitat hhm:0.2.14] HSM not configured, skipping
[2019-7-16 20:54:12] [Hubitat hhm:0.2.14] HSM not configured, skipping
[2019-7-16 20:59:17] [Hubitat hhm:0.2.14] HSM not configured, skipping
[2019-7-16 21:04:12] [Hubitat hhm:0.2.14] HSM not configured, skipping
[2019-7-16 21:09:13] [Hubitat hhm:0.2.14] HSM not configured, skipping
[2019-7-16 21:14:12] [Hubitat hhm:0.2.14] HSM not configured, skipping
[2019-7-16 21:19:12] [Hubitat hhm:0.2.14] HSM not configured, skipping
[2019-7-16 21:24:12] [Hubitat hhm:0.2.14] HSM not configured, skipping
[2019-7-16 21:29:12] [Hubitat hhm:0.2.14] HSM not configured, skipping
[2019-7-16 21:34:12] [Hubitat hhm:0.2.14] HSM not configured, skipping
[2019-7-16 21:39:12] [Hubitat hhm:0.2.14] HSM not configured, skipping
ReferenceError: resp is not defined
    at /usr/lib/node_modules/homebridge-hubitat-makerapi/lib/util_http.js:109:97
    at <anonymous>
    at process._tickCallback (internal/process/next_tick.js:189:7)
ReferenceError: resp is not defined
    at /usr/lib/node_modules/homebridge-hubitat-makerapi/lib/util_http.js:109:97
    at <anonymous>
    at process._tickCallback (internal/process/next_tick.js:189:7)

I think I know what the issue is. I made a change that I am testing at the moment and will post an update as soon as I am done with my testing

1 Like

I just uploaded a new plugin that should fix the issue of devices not disappearing. You can update to version 0.2.15 by running a

npm - g homebridge-hubitat-makerapi

In addition, I added an ability for the plugin to write a log file as it can be confusing on how to get the log entries.

The new settings are defined in the platform parameters with the following structure:

"logFile": {
   "enabled": true,
   "path": "",
   "file": "",
   "compress": true,
   "keep": 5,
   "size": "10m"
}

Here is a description of the parameters:

  • 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

And as often requested, here is full (simple) config.json that has the new logging settings set:

{  
   "mdns":{  
      "interface":"192.168.10.61"
   },
   "bridge":{  
      "name":"Homebridge Dev",
      "username":"AA:BB:CC:DD:EE:FF",
      "port":51826,
      "pin":"123-45-678"
   },
   "platforms":[  
      {  
         "platform":"Hubitat-MakerAPI",
         "name":"Hubitat",
         "app_url":"http://192.168.10.169/apps/api/YOUR_APPS_ID/",
         "access_token":"THIS-SHOULD-BE-YOUR-TOKEN",
         "logFile":{  
            "enabled":true,
            "path":"",
            "file":"",
            "compress":true,
            "keep":5,
            "size":"10m"
         }
      }
   ]
}
4 Likes

Worked like a charm @dan.t. Thanks!

1 Like

All my devices work fine, but when I set my thermostat in Auto mode (where there’s a hot and cold temp) it says β€œaccessory not responding” and sets the temp to some arbitrary number.

Anything I can check?

I am going to take a look at it. I’ll let you know if I need anything from you.

Thanks, let me know if you need anything!

Fixed my issues. Thanks @dan.t

I just uploaded a new version of the plugin to fix your issue with the thermostats in auto mode. There was a rounding issue that made the http call to MakerAPI fail

Give it a shot