File tree Expand file tree Collapse file tree 1 file changed +13
-9
lines changed Expand file tree Collapse file tree 1 file changed +13
-9
lines changed Original file line number Diff line number Diff line change 1
- hass . js
1
+ // Home Assistant Lockscreen Widget
2
+
3
+ // Confguration
4
+ // EDIT HERE
5
+
6
+ const hassUrl = "<hass base url>"
7
+ const hassToken = "<your long lived Bearer token>"
8
+
2
9
let widget = await createWidget ( ) ;
3
10
if ( ! config . runsInWidget ) {
4
11
await widget . presentSmall ( ) ;
@@ -8,14 +15,11 @@ Script.setWidget(widget);
8
15
Script . complete ( ) ;
9
16
10
17
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" }
18
+ let req = new Request ( `${ hassUrl } /api/states` )
19
+ req . headers = {
20
+ "Authorization" : `Bearer ${ hassToken } ` ,
21
+ "content-type" : "application/json"
22
+ }
19
23
let json = await req . loadJSON ( ) ;
20
24
21
25
/* Parse data received from API */
You can’t perform that action at this time.
0 commit comments