New Homebridge Plug-in via MakerAPI

Hey Folks,

Iā€™m just getting started with transitioning from Wink to Hubitat and things are going great with supported devices. I need to add functionality for Insteon, Chamberlain MyQ, and Homekit, I chose HomeKit and MakerAPI and have been struggling with it for almost a week.

Iā€™m using a MacBook Pro mid-2010 as my media server/home automation server running OS Sierra. I have Homebridge running and have HomeKit attached to Homebridge;. I have MakerAPI configured as well as Config-UI and have validated my config Jason with jsonlint. The problem is nothing is being moved from
Hubitat to HomeKit.

I have a few questions to get started.

  1. What the heck is my apps_id and where the heck do I find it?

  2. Do I need to have every device I want to include in HomeKit listed in my json?

  3. If they do need to be included in the json are they included under the accessories platform of the json?

  4. What exactly is an accessory? I see a drag and drop icon under the Accessories tab in Config-UI but donā€™t understand what accessories its talking about or where to drag them from.

  5. I have launchctl configured for Homebridge. Do I need to have it configured for MakerAPI, Config-UI, Node.js, etc...? To have everything restart automatically on restart?

{
"bridge": {
"name": "Homebridge",
"username": "CB:22:3D:E2:CE:31",
"port": 51826,
"pin": "033-44-254"
},
"accessories": [],
"platforms": [
{
"platform": "Hubitat-MakerAPI",
"name": "Hubitat",
"app_url": "http://IP_ADDR/apps/api/65/devices/all",
"access_token": "My_Token"
},
{
"name": "Config",
"port": 8581,
"auth": "form",
"theme": "auto",
"tempUnits": "f",
"platform": "config"
}
]
}

Sorry if I sound a little irked. I am extremely frustrated. There is a huge amount of knowledge in the community but I feel like you have to have a certain base of knowledge that I donā€™t have. I can find plenty of info but nothing that ties it all together so if you have a definitive document that addresses A to Z configuration help I would be very interested.

Thanks in Advance for all your help and knowledge!

Don

first, visit:

https://dantapps.github.io/

Where @dan.t has created a lovely tool to create the Config you need for either the MakerAPI version (your excellent choice) or the HubConnect version, (my particular choice.)

I think the result answers most of your questions such as "every device" = no,
and where to find your app_id instructions are included.

Take special note of the yellow on RED text. If you have never had a working Hiomebridge, use the username & pin randomly created. IF you have a working Homebridge config, RETAIN your username and pin.

Thanks @csteele,

That helped and I was able to see progress. I can now see my devices in MakerAPI. They havenā€™t shown up in HomeKit yet but I assume theyā€™ll show up eventually. I am getting an error and message that Homebridge is being shutdown which is odd. Iā€™ve attached the log hoping that you may be able to tell me something.

Thanks,

[1/11/2020, 4:48:06 PM] [Hubitat MakerAPI hhm:0.4.10] Configuration of cached accessories not done, wait for a bit... 10
uncaughtException: listen EADDRINUSE: address already in use :::51826
[1/11/2020, 4:48:06 PM] Error: listen EADDRINUSE: address already in use :::51826
at Server.setupListenHandle [as _listen2] (net.js:1301:14)
at listenInCluster (net.js:1349:12)
at Server.listen (net.js:1437:7)
at EventedHTTPServer.listen (/usr/local/lib/node_modules/homebridge/node_modules/hap-nodejs/lib/util/eventedhttp.js:60:19)
at HAPServer.listen (/usr/local/lib/node_modules/homebridge/node_modules/hap-nodejs/lib/HAPServer.js:158:20)
at Bridge.Accessory.publish (/usr/local/lib/node_modules/homebridge/node_modules/hap-nodejs/lib/Accessory.js:616:16)
at Server._publish (/usr/local/lib/node_modules/homebridge/lib/server.js:132:16)
at Server.run (/usr/local/lib/node_modules/homebridge/lib/server.js:101:10)
at module.exports (/usr/local/lib/node_modules/homebridge/lib/cli.js:59:10)
at Object. (/usr/local/lib/node_modules/homebridge/bin/homebridge:17:22)
at Module._compile (internal/modules/cjs/loader.js:959:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:995:10)
at Module.load (internal/modules/cjs/loader.js:815:32)
at Function.Module._load (internal/modules/cjs/loader.js:727:14)
at Function.Module.runMain (internal/modules/cjs/loader.js:1047:10)
at internal/main/run_main_module.js:17:11
uncaughtException: listen EADDRINUSE: address already in use :::51826
[1/11/2020, 4:48:06 PM] Got SIGTERM, shutting down Homebridge...
[1/11/2020, 4:48:06 PM] [Hubitat MakerAPI hhm:0.4.10] latest version on npmjs is 0.4.10
[1/11/2020, 4:48:06 PM] [Hubitat MakerAPI hhm:0.4.10] your version of the plugin is up2date
[1/11/2020, 4:48:06 PM] [Hubitat MakerAPI hhm:0.4.10] Device Added (Cache) - Name Kitchen, ID 37
[1/11/2020, 4:48:06 PM] [Hubitat MakerAPI hhm:0.4.10] Device Added (Cache) - Name Patio, ID 47
[1/11/2020, 4:48:06 PM] [Hubitat MakerAPI hhm:0.4.10] Device Added (Cache) - Name Den 2, ID 67
[1/11/2020, 4:48:06 PM] [Hubitat MakerAPI hhm:0.4.10] Device Added (Cache) - Name DR1, ID 65
[1/11/2020, 4:48:06 PM] [Hubitat MakerAPI hhm:0.4.10] Device Added (Cache) - Name DR2, ID 66
[1/11/2020, 4:48:06 PM] [Hubitat MakerAPI hhm:0.4.10] Device Added (Cache) - Name Ceiling Lights, ID 39
[1/11/2020, 4:48:07 PM] [Hubitat MakerAPI hhm:0.4.10] Device Added (Cache) - Name GR2, ID 34
[1/11/2020, 4:48:07 PM] [Hubitat MakerAPI hhm:0.4.10] Device Added (Cache) - Name GR1, ID 35
[1/11/2020, 4:48:07 PM] [Hubitat MakerAPI hhm:0.4.10] Device Added (Cache) - Name Den 1, ID 42
[1/11/2020, 4:48:07 PM] [Hubitat MakerAPI hhm:0.4.10] Device Added (Cache) - Name Lamp, ID 38
[1/11/2020, 4:48:07 PM] [Hubitat MakerAPI hhm:0.4.10] Fetching Hubitat-MakerAPI devices. This can take a while depending on the number of devices configured!
[1/11/2020, 4:48:07 PM] [Hubitat MakerAPI hhm:0.4.10] Refreshing All Device Data
[1/11/2020, 4:48:07 PM] [Hubitat MakerAPI hhm:0.4.10] Received All Device Data
[1/11/2020, 4:48:07 PM] [Hubitat MakerAPI hhm:0.4.10] Starting receiver
[1/11/2020, 4:48:07 PM] [Hubitat MakerAPI hhm:0.4.10] Set communcation_broken to false
[1/11/2020, 4:48:07 PM] [Hubitat MakerAPI hhm:0.4.10] Setting MakerAPI post URL to http://192.168.1.47:20011/event at http://192.168.1.4/apps/api/65
[1/11/2020, 4:48:07 PM] [Hubitat MakerAPI hhm:0.4.10] homebridge-hubitat-makerapi server listening on 20011
[1/11/2020, 4:48:08 PM] [Hubitat MakerAPI hhm:0.4.10] MakerAPI postURL successfully activated
[1/11/2020, 4:48:11 PM] [HB Supervisor] Homebridge Process Ended. Code: 143, Signal: null

Obviously @dan.t knows his log messages better than I do.. I'm seeing port 20011 and yet I remember 20009 as a default. I'm certain it's changeable because that's needed in a multi instance case.

Homebridge listens to port 51826 to communicate with HomeKit and it looks like that some other program is already running and using that port. That makes homebridge fail. It could be that there is already a homebridge process running and you are tying to start a second instance that is failing. You could take a look in MacOS ActivityMonitor and see if there is already a homebridge process running. If not, I would suggest to change you config file and change the homebridge port from 51826 to 51827 and try again.

2 Likes

I donā€™t recommend HomeKit for Insteon unless you have the HomeKit Insteon hub. Once youā€™re sorted with HomeKit, head over to this thread. This is what I use and itā€™s right up there with Homebridge for stability (e.g. VERY stable)

Itā€™s breathing guys, still seeing wierdness in the log below. Error 404 Hubitat says MakerAPI isnā€™t available.

BTW: I changed the listening port to 51587 and that fixed that issue so thanks for that one!!

[1/11/2020, 5:46:09 PM] [Hubitat hhm:0.4.10] Hubitat tells me that the MakerAPI instance you have configured is not available (code 404).
[1/11/2020, 5:46:09 PM] [Hubitat hhm:0.4.10] I am stopping my reload here and hope eveything fixes themselves (e.g. a firmware update of HE is rebooting the hub
[1/11/2020, 5:47:05 PM] [Hubitat hhm:0.4.10] HE websocket sending keepalive ping
[1/11/2020, 5:47:05 PM] [Hubitat hhm:0.4.10] HE got pong
[1/11/2020, 5:48:06 PM] [Hubitat hhm:0.4.10] HE websocket sending keepalive ping
[1/11/2020, 5:48:06 PM] [Hubitat hhm:0.4.10] HE got pong
[1/11/2020, 5:48:56 PM] [Hubitat MakerAPI hhm:0.4.10] Refreshing All Device Data
[1/11/2020, 5:48:57 PM] [Hubitat MakerAPI hhm:0.4.10] Received All Device Data
[1/11/2020, 5:49:06 PM] [Hubitat hhm:0.4.10] HE websocket sending keepalive ping
[1/11/2020, 5:49:06 PM] [Hubitat hhm:0.4.10] HE got pong

Can I not configure HomeKit (MakerAPI) and the Insteon plug-in under HomeBridge at the same time?

Thanks

Accessory is what Apple calls slaves-to-homekit -- devices that feed devices into the Apple HomeKit universe. You can have a large number of Accessories and each can have a bunch of devices. There was a 100 device limit, but some people say they are seeing more than..

Homebridge is ONE Accessory. You can have multiple copies of Homebridge, each is its own Accessory as far as Apple is concerned.

Did you hub up address change or did you remove MakerAPI and installed it again?

You had communication before and the plugin was using the following url to communicate with MakerAPI

http://192.168.1.4/apps/api/65

What happens when you enter this URL in a browser?

In my past experience, itā€™s very slow and gets out of sync easily. That was the impetus for creating the Insteon maker API application and drivers. It addresses Insteon capabilities specifically.

I get an XML error 49 was assigned with the first install. I reinstalled yesterday and it assigned 65 to the URL. Itā€™s 65 in the JSON and something else thats weird. I was able to configure and see all my devices in HomeKit. Problem is they keep disappearing and reappearing.

Are you sure that you donā€™t have Homebridge running multiple times?

No, how would I tell and shutdown the extras?

You can either type
ps
In a terminal window and check the output or check it with the MacOS Activity Monitor

ps
PID TTY TIME CMD
4242 ttys000 0:00.19 -bash

Checking MAC log now.

I do have two running. Any way to tell which one is which and shut it down?

Not really, I would stop both and start it cleanly.

@dan.t I have updated to the latest release and firmware and am getting more frequent errors:
java.lang.NumberFormatException: null on line 626 (listDevices)

Do you know how to solve this or should I pursue opening a support ticket? Patrick had mentioned a long while ago that it may be querying for a value that is null thus throwing the error but unsure how to even determine which device out of the many would cause this. I cannot reproduce this by just using the Get All Devices or Get All Devices with Full Details URLs so unsure what additional Homebridge may be calling.

The MakerAPI logging is not really helpful. I wish it would at least spit out the request URL that failed or the device ID it failed on....
Do you see any errors or warnings in the Homebridge logs? That could give us an indication which device is causing it