Comments (4)
Hello @TechFactory,
Thanks for posting the question and using the plugin. The problem here is that most of the examples provide sketches only for Arduino 101, which is a different board than you have. Some examples like the humidity/
and thermometer/
also contain a sketch for Bluefruit Micro. There's no special reason to use only these BLE boards. Any board when programmed correctly will work with this plugin. I just happened to have these two at home, so I used them.
Unfortunately, the sketches are generally not compatible between different boards and require changes. That's why you see the puzzling error messages about missing ble_protocol.h
file. The file really doesn't exist for your Bean, but it's needed to run on an Arduino 101.
Your Bean has a different set of functions that talk to the BLE subsystem. The best way to get started is these examples. Try to create a scratch characteristic, that turns on a LED, when you write 1
to it and turns the LED off when you write 0
. When you match the UUIDs with the config.json
from the lightbulb/
example, you should be able to get it working.
Sometimes it's a struggle, but when it's finally working HomeKit is a lot of fun and it's certainly worth it. I'll be happy to add support for more boards and merge a pull request with your new Bean example if you want to do it.
from homebridge-bluetooth.
Hi @vojtamolda,
Thanks for the help.
I've made this so far. It's shows up in the home app on the iPhone but the temperature says 0 no matter what I do. Any idea?
#include <SPI.h>
#include <BLEPeripheral.h>
BLEPeripheral ble;
BLEService informationService("180A");
BLECharacteristic modelCharacteristic("2A24", BLERead, "101");
BLECharacteristic manufacturerCharacteristic("2A29", BLERead, "Arduino");
BLECharacteristic serialNumberCharacteristic("2A25", BLERead, "2.71828");
BLEService thermometerService("1D8A68E0-E68E-4FED-943E-369099F5B499");
BLEFloatCharacteristic temperatureCharacteristic("1D8A68E1-E68E-4FED-943E-369099F5B499", BLERead | BLENotify);
void setup() {
Serial.begin(115200);
ble.setLocalName("Thermo");
ble.setAdvertisedServiceUuid(thermometerService.uuid());
ble.addAttribute(informationService);
ble.addAttribute(modelCharacteristic);
ble.addAttribute(manufacturerCharacteristic);
ble.addAttribute(serialNumberCharacteristic);
ble.addAttribute(thermometerService);
ble.addAttribute(temperatureCharacteristic);
temperatureCharacteristic.setValue(0);
ble.begin();
Serial.println("Bluetooth on");
}
void loop() {
ble.poll();
int tempRead = Bean.getTemperature();
temperatureCharacteristic.setValue(tempRead);
Serial.print(tempRead);
delay(3000);
}
Thanks again.
from homebridge-bluetooth.
I don't have a Bean to test, but I think you're puting an int
value in place of a float
value. HomeKit requires the temperatureCharacteristic
to be of type BLEFloatCharacteristic
. Try changing your code to something like this:
float tempRead = (float) Bean.getTemperature();
temperatureCharacteristic.setValue(tempRead);
The conversion is probably happening implicitly anyway, but getting the values to match is what matters here. You're seeing 0, because it's the default used by Homebridge when nothing is received.
Another way to check where is the problem is to use the LightBlue iOS app. When you change the type of the characteristic to float
the number there has to match the output from the serial console.
from homebridge-bluetooth.
One more thing - Maybe I'm wrong, since I'm not very familiar with Bean's hardware, but I don't think it is currently supported by the BLEPeripheral
library. Check the list of supported hardware here.
Bean is in fact an ATmega328p processor and the LBM313 module with battery. The module contains the CC2240 BLE SoC chip by Texas Instruments and an antenna in a nice FCC certified package.
Unfortunately the CC2240 isn't supported by the BLEPeripheral
library as it was written for the competing Nordic Semiconductor's nRF5* family of chipsets. It's possible that the code will actually run, but it won't do anything useful.
from homebridge-bluetooth.
Related Issues (20)
- Infinitely stuck activity spinner in the Home app on iOS HOT 7
- Use with iPhone Bluetooth presence detection HOT 2
- iPhone presence detection HOT 1
- Question about adding devices that donβt match HAP HOT 1
- Arduino UNO HOT 1
- Would it work with August Smart Lock? HOT 3
- let homebridge control a bluetooth projector, streamer? HOT 1
- Characteristic doesn't receive value HOT 9
- again didn't receive values
- How to control electric heater? HOT 1
- Bluetooth Shower controls HOT 1
- NOT AN ISSUE: After Market USB Bluetooth Adapter Mac OS HOT 1
- Ranger/ Extender behaviour possible? HOT 1
- Problem restarting Homebridge HOT 2
- Incompatibility to NodeJS > 9.9.0 HOT 1
- Tv commands HOT 1
- How to add devices with auth HOT 1
- Adding a custom BLE device
- Install fails on Homebridge on Raspberry Pi3+ HOT 6
- Schlage bluetooth lock question HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
π Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google β€οΈ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from homebridge-bluetooth.