Browse Source

load HA data

master
Peter Hajas 3 years ago
parent
commit
5fb1e1a109
  1. 19
      script.js

19
script.js

@ -1,3 +1,5 @@
let haStateURL = "http://beacon:1880/ha_state"
const scene = new THREE.Scene();
const camera = new THREE.PerspectiveCamera( 75, window.innerWidth / window.innerHeight, 0.1, 1000 );
let homeContainer = new THREE.Group()
@ -84,7 +86,7 @@ function configureScene(data) {
home.position.y = +1 * (yExtent / 2)
}
async function doLoad() {
async function loadHomeData() {
let request = new Request('data.json');
fetch(request)
.then(response => {
@ -95,5 +97,18 @@ async function doLoad() {
})
}
doLoad();
loadHomeData();
async function loadHAData() {
let request = new Request(haStateURL);
fetch(request)
.then(response => {
return response.json()
})
.then(json => {
console.log(json)
})
}
loadHAData()

Loading…
Cancel
Save