diff --git a/script.js b/script.js index 106c090..7dc539b 100644 --- a/script.js +++ b/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()