Skip to content

Commit 89787e8

Browse files
authored
Update lockscreen-homeassistant-temp.js
1 parent 9596b42 commit 89787e8

File tree

1 file changed

+18
-1
lines changed

1 file changed

+18
-1
lines changed

source/lockscreen-homeassistant-temp.js

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,21 @@
1-
.headers = { "Authorization": "Bearer YOUR KEY", "content-type": "application/json" }
1+
hass.js
2+
let widget = await createWidget();
3+
if (!config.runsInWidget) {
4+
await widget.presentSmall();
5+
}
6+
7+
Script.setWidget(widget);
8+
Script.complete();
9+
10+
async function createWidget(items) {
11+
12+
/* Get data from API */
13+
const tempImg = await getImage('temperature.png');
14+
const humidImg = await getImage('humidity.png');
15+
const logoImg = await getImage('hass-favicon.png');
16+
17+
let req = new Request("https://<HASS IP>/api/states")
18+
req.headers = { "Authorization": "Bearer YOUR KEY", "content-type": "application/json" }
219
let json = await req.loadJSON();
320

421
/* Parse data received from API */

0 commit comments

Comments
 (0)