pull/1995/head
David Peer 2022-06-20 13:36:49 +02:00
parent b8c5558aac
commit 2044fa9df3
11 changed files with 71 additions and 55 deletions

8
apps/ha/README.md Normal file
View File

@ -0,0 +1,8 @@
# Home Assistant
## Creator
- [David Peer](https://github.com/peerdavid).
## Thanks To
<a href="https://www.flaticon.com/free-icons/info" title="info icons">Info icons created by Freepik - Flaticon</a>

59
apps/ha/ha.app.js Normal file
View File

@ -0,0 +1,59 @@
var W = g.getWidth(), H = g.getHeight();
var position=0;
var response="...";
function draw() {
g.reset().clearRect(Bangle.appRect);
// Header
g.setFont("Vector", 32).setFontAlign(0,0);
var text = "";
if(position == 0){
text = "Door";
} else if(position == 1){
text = "Light";
}
g.drawString(text, W/2, H/3);
g.setFont("Vector", 24);
g.drawString(response, W/2, H/3+34);
}
draw();
setWatch(_=>load(), BTN1);
Bangle.on('touch', function(btn, e){
var left = parseInt(g.getWidth() * 0.3);
var right = g.getWidth() - left;
var isLeft = e.x < left;
var isRight = e.x > right;
if(isRight){
position += 1;
position = position > 1 ? 0 : position;
draw();
}
if(isLeft){
position -= 1;
position = position < 0 ? 1 : position;
draw();
}
if(!isRight && !isLeft){
Bangle.buzz(40, 0.6);
// Trigger HA bridge
response = "sending...";
draw();
var url = "https://www.google.com/";
response = Bluetooth.println(JSON.stringify({t:"http", url:url}));
}
draw();
});
Bangle.loadWidgets();
Bangle.drawWidgets();

View File

Before

Width:  |  Height:  |  Size: 1.5 KiB

After

Width:  |  Height:  |  Size: 1.5 KiB

View File

@ -1,9 +1,9 @@
{ {
"id": "homeassistant", "id": "ha",
"name": "HomeAssistant", "name": "HomeAssistant",
"version": "0.01", "version": "0.01",
"description": "An application that displays information such as battery level, steps etc.", "description": "An application that displays information such as battery level, steps etc.",
"icon": "homeassistant.png", "icon": "ha.png",
"type": "app", "type": "app",
"tags": "tool", "tags": "tool",
"readme": "README.md", "readme": "README.md",
@ -13,7 +13,7 @@
{"url":"screenshot_2.png"}, {"url":"screenshot_2.png"},
{"url":"screenshot_3.png"}], {"url":"screenshot_3.png"}],
"storage": [ "storage": [
{"name":"homeassistant.app.js","url":"homeassistant.app.js"}, {"name":"ha.app.js","url":"ha.app.js"},
{"name":"homeassistant.img","url":"homeassistant.icon.js","evaluate":true} {"name":"ha.img","url":"ha.icon.js","evaluate":true}
] ]
} }

View File

Before

Width:  |  Height:  |  Size: 3.5 KiB

After

Width:  |  Height:  |  Size: 3.5 KiB

View File

Before

Width:  |  Height:  |  Size: 3.3 KiB

After

Width:  |  Height:  |  Size: 3.3 KiB

View File

Before

Width:  |  Height:  |  Size: 3.4 KiB

After

Width:  |  Height:  |  Size: 3.4 KiB

View File

@ -1,17 +0,0 @@
# Info
A very simple app that shows information on 3 different screens.
Go to the next screen via tab right, go to the previous screen
via tab left and reload the data via tab in the middle of the
screen. Very useful if combined with pattern launcher ;)
![](screenshot_1.png)
![](screenshot_2.png)
![](screenshot_3.png)
## Creator
- [David Peer](https://github.com/peerdavid).
## Thanks To
<a href="https://www.flaticon.com/free-icons/info" title="info icons">Info icons created by Freepik - Flaticon</a>

View File

@ -1,34 +0,0 @@
var W = g.getWidth(), H = g.getHeight();
function draw() {
g.reset().clearRect(Bangle.appRect);
// Header
g.setFont("Vector", 22).setFontAlign(0,-1);
g.drawString("", W/2, H/2);
}
draw();
setWatch(_=>load(), BTN1);
Bangle.on('touch', function(btn, e){
var left = parseInt(g.getWidth() * 0.3);
var right = g.getWidth() - left;
var isLeft = e.x < left;
var isRight = e.x > right;
if(isRight){
}
if(isLeft){
}
draw();
});
Bangle.loadWidgets();
Bangle.drawWidgets();