diff --git a/public/Photos/jarjestelma07112019.jpg b/public/Photos/jarjestelma07112019.jpg
new file mode 100644
index 0000000..b539de3
Binary files /dev/null and b/public/Photos/jarjestelma07112019.jpg differ
diff --git a/public/index.html b/public/index.html
index ed1fb15..b877303 100644
--- a/public/index.html
+++ b/public/index.html
@@ -23,7 +23,7 @@
work correctly both with client-side routing and a non-root public URL.
Learn how to configure a non-root public URL by running `npm run build`.
-->
-
-
+
{
"../Photos/rpiTemp.jpeg",
"../Photos/valkosipulivk1.jpeg",
"../Photos/valkosipulivk2.jpg",
- "../Photos/valkosipulivk3.jpg"]}/>
+ "../Photos/valkosipulivk3.jpg",
+ "../Photos/jarjestelma07112019.jpg"]}/>
-
About
+
Monialaprojekti TinyForest
- Tekstiä
+ Projektimme tarkoitus on tuottaa järjestelmä joka automatisoi kasvien kasvatusta ja monitoroi lämpötilaa, kosteutta ja valoa.
+
+
+ Projektin osalliset ovat Juska Forelius (Projektipäällikkö), Niko Hakala, Konstantin Gurin ja Pekka Helenius.
diff --git a/src/Components/Plants.js b/src/Components/Plants.js
index 9153653..276f301 100644
--- a/src/Components/Plants.js
+++ b/src/Components/Plants.js
@@ -16,7 +16,7 @@ const Plants = () => {
const jsonFetch = () => {
fetch('../plantinfo.json')
.then((res) => res.json())
- .then(data => setPlant(data))
+ .then(data => setPlant(data.plant))
.catch(err => console.error(err))
}
@@ -27,19 +27,19 @@ const Plants = () => {
Plant Information
-
-
Nimi: {plant.id}
-
Tyyppi: {plant.type}
-
Istutuspäivä: {plant.istutuspv}
-
+
ID: {plant.id}
+
Nimi: {plant.nimi}
+
Tyyppi: {plant.type}
+
Istutuspäivä: {plant.planting_day}
+
-
-
Nimi: Kasvi2
-
Tyyppi: Kasvi2Tyyppi
-
Istutuspäivä: Istutuspv2
-
+
ID: PL2ID
+
Nimi: Kasvi2
+
Tyyppi: Kasvi2Tyyppi
+
Istutuspäivä: kasvi2ispv
+
diff --git a/src/Components/Sysinfo.js b/src/Components/Sysinfo.js
index 6ccc4a5..fb43495 100644
--- a/src/Components/Sysinfo.js
+++ b/src/Components/Sysinfo.js
@@ -1,12 +1,52 @@
-import React from 'react';
+import React, { useState, useEffect } from 'react';
const Sysinfo = () => {
+ const [moisture, setMoisture] = useState([]);
+ const [light, setLight] = useState([]);
+ const [temperature, setTemperature] = useState([]);
+
+ useEffect(() => {
+ fetchMoisture();
+ fetchLight();
+ fetchTemperature();
+ }, [])
+
+ const fetchMoisture = () => {
+ fetch('../plantinfo.json')
+ .then((res) => res.json())
+ .then(data => setMoisture(data.sensors.moisture))
+ .catch(err => console.error(err))
+ }
+
+ const fetchLight = () => {
+ fetch('../plantinfo.json')
+ .then((res) => res.json())
+ .then(data => setLight(data.sensors.light))
+ .catch(err => console.error(err))
+ }
+
+ const fetchTemperature = () => {
+ fetch('../plantinfo.json')
+ .then((res) => res.json())
+ .then(data => setTemperature(data.sensors.temperature))
+ .catch(err => console.error(err))
+ }
+
+ console.log(moisture.sensor_friendly_name)
+ console.log(light.sensor_friendly_name)
+ console.log(temperature.sensor_friendly_name)
+
+ //console.log(sensors.light)
+ //console.log(sensors.temperature)
+ //console.log(sensors.acidity)
+
+
// TODO Pull system info etc.
//const [sysinfo, setSysinfo] = useState([]);
- // const jsonFetch = () => {
+ //const jsonFetch = () => {
// fetch('../sysinfo.json')
// .then((res) => res.json())
// .then(data => setSysinfo(data))
@@ -15,13 +55,23 @@ const Sysinfo = () => {
return (
-
+
System Information
-
-
System Information
- Temperature: Pull system temp
- Kernel: Pull kernel info
-
+
+
+
Sensor name: {moisture.sensor_friendly_name}
+ Connected to pin: {moisture.gpio_pin}
+
+
+
Sensor name: {light.sensor_friendly_name}
+ Connected to pin: {light.gpio_pin}
+
+
+
Sensor name: {temperature.sensor_friendly_name}
+ Connected to pin: {temperature.gpio_pin}
+
+
+
);
diff --git a/src/logo.svg b/src/logo.svg
deleted file mode 100644
index 2e5df0d..0000000
--- a/src/logo.svg
+++ /dev/null
@@ -1 +0,0 @@
-
\ No newline at end of file