Skip to content

Commit d89a0b8

Browse files
committed
Add Home Assistant Bluetooth LED
1 parent 2f9ce82 commit d89a0b8

File tree

5 files changed

+35
-0
lines changed

5 files changed

+35
-0
lines changed

apps.json

+12
Original file line numberDiff line numberDiff line change
@@ -290,6 +290,18 @@
290290
{"name":".bootcde","url":"app.js"}
291291
]
292292
},
293+
{ "id": "ha_led",
294+
"name": "Home Assistant Bluetooth LED",
295+
"icon": "icon.png",
296+
"version":"0.01",
297+
"description": "Turn your Bluetooth Espruino device into a LED that can be controlled from Home assistant",
298+
"tags": "bluetooth,homeassistant,LED",
299+
"readme": "README.md",
300+
"needsFeatures":["BLE","RGBLED"],
301+
"storage": [
302+
{"name":".bootcde","url":"app.js"}
303+
]
304+
},
293305
{ "id": "knobbutton",
294306
"name": "Knob Button",
295307
"icon": "icon.png",

apps/ha_led/ChangeLog

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
0.01: New App!

apps/ha_led/README.md

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
# Home Assistant Bluetooth LED
2+
3+
Turn your Bluetooth Espruino device into a LED that can be controlled from Home assistant.
4+
5+
This uses the [LED BLE Library](https://www.espruino.com/ble_led) which makes Espruino appear as a BLE lightbulb which
6+
is detected by the [LED BLE integration](https://www.home-assistant.io/integrations/led_ble/) in https://www.home-assistant.io/
7+
8+
This is based on https://www.espruino.com/BTHome and https://www.espruino.com/Smart+Meter
9+
10+
## Usage
11+
12+
Install the app and disconnect, and a device called `LEDBLE` should appear in Home Assistant. Turning it on/off or changing the colour will change the built-in LEDs.

apps/ha_led/app.js

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
require("ble_led").setup(function(state) {
2+
if (state.on) {
3+
// state.r/g/b arr in the range 0..255
4+
LED1.pwm(state.r/256);
5+
LED2.pwm(state.g/256);
6+
LED3.pwm(state.b/256);
7+
} else {
8+
digitalWrite([LED1,LED2,LED3],0);
9+
}
10+
});

apps/ha_led/icon.png

10.3 KB
Loading

0 commit comments

Comments
 (0)