Code Monkey home page Code Monkey logo

Comments (10)

vojtamolda avatar vojtamolda commented on June 24, 2024

Hello @keith721,

Your config.json is almost correct. All the "type" fields must match a HomeKit service/characteristic from HomeKitTypes.js. This config.json will consider the device to be a HomeKit switch:

"name": "GarageMate",
"address": "01:23:45:67:89:AB",
"services": [ {
    "name": "Garage Door",
    "type": "Switch",
    "UUID": "00001815-0000-1000-8000-00805f9b34fb",
    "characteristics": [ {
        "type": "On",
        "UUID": "00002a57-0000-1000-8000-00805f9b34fb"
      } ]
   } ]

You can find more details about these by reading the defintion of Service.Switch and it's only mandatory member Characteristic.On.

Try if this works and get back here. Characteristic.On is should support read, write and notify operations. If the GarageMate really triggers the door only by reading the characteristic, then get ready for a a lot of opening. The switch state is read every time you try to access it in the Home app on your iphone/ipad.

To be honest the plugin was never intended to be this general and allow BLE service to map onto a HomeKit service with some form of a translation happening in between. I like to push the boundaries and the change to the codebase of this plugin in order to incorporate this kind of general mapping is substantial, but it's definitely doable.

If you take a look at the examples, all of them have access to the source code running on the BLE peripheral and make the BLE services/characteristics match HomeKit. In this case I doubt GarageMate will release and open-source their firmware, so that's not an option.

from homebridge-bluetooth.

keith721 avatar keith721 commented on June 24, 2024

After reviewing Service.Switch and Characteristic.On, it appears the GarageMate device should be configured as Service.StatelessProgrammableSwitch instead of Service.Switch. Hopefully, this would avoid "a lot of opening".

I'll work with this when I return home this evening and have access to the GarageMate device. If all else fails, I can always attempt to implement similar behavior using an Arduino. Thank you!

from homebridge-bluetooth.

vojtamolda avatar vojtamolda commented on June 24, 2024

Yeah. You're right. The StatelessProgrammableSwitch seems like a better choice. To be honest, there's so many services in HomeKit I didn't even know this one existed... πŸ˜„

Good luck and have fun in the evening!

from homebridge-bluetooth.

keith721 avatar keith721 commented on June 24, 2024

from homebridge-bluetooth.

vojtamolda avatar vojtamolda commented on June 24, 2024

😊

from homebridge-bluetooth.

keith721 avatar keith721 commented on June 24, 2024

I got it configured and the config parsed and loaded successfully, but it's "not supported" in the Home app on my iPhone. :(

[3/13/2017, 6:58:07 PM] [Bluetooth] Started | poweredOn
[3/13/2017, 6:58:07 PM] [Bluetooth] [GarageMate] Connected | GarageMate (98:7B:F3:62:C1:43)
[3/13/2017, 6:58:08 PM] [Bluetooth] [GarageMate] [Information] Connected
[3/13/2017, 6:58:08 PM] [Bluetooth] [GarageMate] [Information] [Model] Connected
[3/13/2017, 6:58:08 PM] [Bluetooth] [GarageMate] [Information] [SerialNumber] Connected
[3/13/2017, 6:58:08 PM] [Bluetooth] [GarageMate] [Information] [Manufacturer] Connected
[3/13/2017, 6:58:12 PM] [Bluetooth] [GarageMate] [Information] [Manufacturer] Disconnected
[3/13/2017, 6:58:12 PM] [Bluetooth] [GarageMate] [Information] [Model] Disconnected
[3/13/2017, 6:58:12 PM] [Bluetooth] [GarageMate] [Information] [SerialNumber] Disconnected
[3/13/2017, 6:58:12 PM] [Bluetooth] [GarageMate] Disconnected
[3/13/2017, 6:58:13 PM] [Bluetooth] [GarageMate] Connected | GarageMate (98:7B:F3:62:C1:43)
[3/13/2017, 6:58:13 PM] [Bluetooth] [GarageMate] [Information] Connected
[3/13/2017, 6:58:13 PM] [Bluetooth] [GarageMate] [Information] [Model] Connected
[3/13/2017, 6:58:13 PM] [Bluetooth] [GarageMate] [Information] [SerialNumber] Connected
[3/13/2017, 6:58:13 PM] [Bluetooth] [GarageMate] [Information] [Manufacturer] Connected
[3/13/2017, 6:58:18 PM] [Bluetooth] [GarageMate] [Information] [Manufacturer] Disconnected
[3/13/2017, 6:58:18 PM] [Bluetooth] [GarageMate] [Information] [Model] Disconnected
[3/13/2017, 6:58:18 PM] [Bluetooth] [GarageMate] [Information] [SerialNumber] Disconnected
[3/13/2017, 6:58:18 PM] [Bluetooth] [GarageMate] Disconnected
[3/13/2017, 6:58:19 PM] [Bluetooth] [GarageMate] Connected | GarageMate (98:7B:F3:62:C1:43)
[3/13/2017, 6:58:19 PM] [Bluetooth] [GarageMate] [Information] Connected
[3/13/2017, 6:58:19 PM] [Bluetooth] [GarageMate] [Information] [Model] Connected
[3/13/2017, 6:58:19 PM] [Bluetooth] [GarageMate] [Information] [SerialNumber] Connected
[3/13/2017, 6:58:19 PM] [Bluetooth] [GarageMate] [Information] [Manufacturer] Connected
noble warning: unknown handle 64 disconnected!
noble: unknown peripheral d0034b1f24e5 connected!
noble: unknown peripheral d0034b1f24e5 disconnected!
[3/13/2017, 6:58:24 PM] [Bluetooth] [GarageMate] [Information] [Manufacturer] Disconnected
[3/13/2017, 6:58:24 PM] [Bluetooth] [GarageMate] [Information] [Model] Disconnected
[3/13/2017, 6:58:24 PM] [Bluetooth] [GarageMate] [Information] [SerialNumber] Disconnected
[3/13/2017, 6:58:24 PM] [Bluetooth] [GarageMate] Disconnected

Here's the relevant portion of my config.json:

	    "platform" : "Bluetooth",
	    "name" : "Bluetooth",
	    "accessories" : [ {
		"name" : "GarageMate",
		"address" : "98:7B:F3:62:C1:43",
		"services" : [ {
		    "name" : "Garage Door",
		    "type" : "StatelessProgrammableSwitch",
		    "UUID" : "00001815-0000-1000-8000-00805f9b34fb",
		    "characteristics": [ {
			"type" : "ProgrammableSwitchEvent",
			"UUID" : "00002a57-0000-1000-8000-00805f9b34fb"
		    } ]
		} ]
	    } ]

from homebridge-bluetooth.

vojtamolda avatar vojtamolda commented on June 24, 2024

First, HomeKit is still being actively developed on all fronts and you're right that the current iOS (10.2) doesn't support the StatelessProgrammableSwitch service. However, according to this issue the support will be added in 10.3. And there's not much else one can do about this than to wait for Apple.

Second, even if iOS would support the switch I don't think it would work with the GarageMate. I tried googling to fill my knowledge gap about switches. StatelessProgrammableSwitch is a simple push button that returns back to it's original position after being pressed. It's meant as an event generator for the HomeKit ecosystem that can trigger other things. That's why it supports only READ and NOTIFY operations. There's a detailed (and loooong) discusion here.

Third, there's a very weird sequence of rapid BLE connect-disconnect events in your log. This shouldn't happen. Normally the plugin should connect only once and stay connected to the peripheral. I'm not sure why is this happening and the disconnect happens after reading the manufacturer string, which is quite innocent operation. Can you try running Homebridge in debug mode and posting the log here, please?

DEBUG=* homebridge

It's a shame the GarageMate doesn't work. Make this puzzle piece fit the rest of the HomeKit ecosystem is much harder nut to crack than I expected. So maybe going for the DIY solution and using the Arduino 101 or a similar board will get the door working for you faster...

from homebridge-bluetooth.

keith721 avatar keith721 commented on June 24, 2024

I also noticed the GarageMate did not provide the Device Information service 0x180A or its characteristics of Manufacturer Name 0x2A29, Model Number 0x2A24, and Serial Number 0x2A25. Because of this, I ordered an Arduino UNO, HM-10 BLE Bluetooth 4.0 module, and switch/relay board. I've already developed the Arduino sketch to emulate the GarageMate device. My hope is that using the more up-to-date CurieBLE library may resolve the disconnect/reconnect issues.

from homebridge-bluetooth.

vojtamolda avatar vojtamolda commented on June 24, 2024

Those services are not mandatory and the plugin can work fine without them. But anyway, I'll be happy to merge a pull request with a new example if you want to make it.

from homebridge-bluetooth.

keith721 avatar keith721 commented on June 24, 2024

It will be some weeks before my parts arrive. When I've had some opportunity to test the script and work out any bugs, I'll be happy to submit it here. Meanwhile, I believe I can close this question. Thanks again for your generous assistance!

from homebridge-bluetooth.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.