Browse Source

minor fixes

master
Niko Hakala 5 years ago
parent
commit
c9f3f0dd54
9 changed files with 294 additions and 37 deletions
  1. +69
    -3
      package-lock.json
  2. +3
    -1
      package.json
  3. +2
    -1
      public/plantinfo.json
  4. +137
    -0
      public/tekstia.txt
  5. +37
    -10
      public/tinyforest.log.json
  6. +0
    -2
      src/Components/Home.js
  7. +25
    -7
      src/Components/LogParser.js
  8. +12
    -3
      src/Components/Plants.js
  9. +9
    -10
      src/Components/Sysinfo.js

+ 69
- 3
package-lock.json View File

@ -1980,6 +1980,11 @@
"color-convert": "^1.9.0" "color-convert": "^1.9.0"
} }
}, },
"any-promise": {
"version": "1.3.0",
"resolved": "https://registry.npmjs.org/any-promise/-/any-promise-1.3.0.tgz",
"integrity": "sha1-q8av7tzqUugJzcA3au0845Y10X8="
},
"anymatch": { "anymatch": {
"version": "2.0.0", "version": "2.0.0",
"resolved": "https://registry.npmjs.org/anymatch/-/anymatch-2.0.0.tgz", "resolved": "https://registry.npmjs.org/anymatch/-/anymatch-2.0.0.tgz",
@ -5719,6 +5724,23 @@
"schema-utils": "^1.0.0" "schema-utils": "^1.0.0"
} }
}, },
"file-match": {
"version": "1.0.2",
"resolved": "https://registry.npmjs.org/file-match/-/file-match-1.0.2.tgz",
"integrity": "sha1-ycrSZdLIrfOoFHWw30dYWQafrvc=",
"requires": {
"utils-extend": "^1.0.6"
}
},
"file-system": {
"version": "2.2.2",
"resolved": "https://registry.npmjs.org/file-system/-/file-system-2.2.2.tgz",
"integrity": "sha1-fWWDPjojR9zZVqgTxncVPtPt2Yc=",
"requires": {
"file-match": "^1.0.1",
"utils-extend": "^1.0.4"
}
},
"filesize": { "filesize": {
"version": "3.6.1", "version": "3.6.1",
"resolved": "https://registry.npmjs.org/filesize/-/filesize-3.6.1.tgz", "resolved": "https://registry.npmjs.org/filesize/-/filesize-3.6.1.tgz",
@ -5964,6 +5986,11 @@
} }
} }
}, },
"fs": {
"version": "0.0.1-security",
"resolved": "https://registry.npmjs.org/fs/-/fs-0.0.1-security.tgz",
"integrity": "sha1-invTcYa23d84E/I4WLV+yq9eQdQ="
},
"fs-extra": { "fs-extra": {
"version": "7.0.1", "version": "7.0.1",
"resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-7.0.1.tgz", "resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-7.0.1.tgz",
@ -6186,9 +6213,9 @@
"integrity": "sha512-d4sze1JNC454Wdo2fkuyzCr6aHcbL6PGGuFAz0Li/NcOm1tCHGnWDRmJP85dh9IhQErTc2svWFEX5xHIOo//kQ==" "integrity": "sha512-d4sze1JNC454Wdo2fkuyzCr6aHcbL6PGGuFAz0Li/NcOm1tCHGnWDRmJP85dh9IhQErTc2svWFEX5xHIOo//kQ=="
}, },
"handlebars": { "handlebars": {
"version": "4.5.1",
"resolved": "https://registry.npmjs.org/handlebars/-/handlebars-4.5.1.tgz",
"integrity": "sha512-C29UoFzHe9yM61lOsIlCE5/mQVGrnIOrOq7maQl76L7tYPCgC1og0Ajt6uWnX4ZTxBPnjw+CUvawphwCfJgUnA==",
"version": "4.5.3",
"resolved": "https://registry.npmjs.org/handlebars/-/handlebars-4.5.3.tgz",
"integrity": "sha512-3yPecJoJHK/4c6aZhSvxOyG4vJKDshV36VHp0iVCDVh7o9w2vwi3NSnL2MMPj3YdduqaBcu7cGbggJQM0br9xA==",
"requires": { "requires": {
"neo-async": "^2.6.0", "neo-async": "^2.6.0",
"optimist": "^0.6.1", "optimist": "^0.6.1",
@ -8926,6 +8953,16 @@
"resolved": "https://registry.npmjs.org/mute-stream/-/mute-stream-0.0.7.tgz", "resolved": "https://registry.npmjs.org/mute-stream/-/mute-stream-0.0.7.tgz",
"integrity": "sha1-MHXOk7whuPq0PhvE2n6BFe0ee6s=" "integrity": "sha1-MHXOk7whuPq0PhvE2n6BFe0ee6s="
}, },
"mz": {
"version": "2.7.0",
"resolved": "https://registry.npmjs.org/mz/-/mz-2.7.0.tgz",
"integrity": "sha512-z81GNO7nnYMEhrGh9LeymoE4+Yr0Wn5McHIZMK5cfQCl+NDX08sCZgUc9/6MHni9IWuFLm1Z3HTCXu2z9fN62Q==",
"requires": {
"any-promise": "^1.0.0",
"object-assign": "^4.0.1",
"thenify-all": "^1.0.0"
}
},
"nan": { "nan": {
"version": "2.14.0", "version": "2.14.0",
"resolved": "https://registry.npmjs.org/nan/-/nan-2.14.0.tgz", "resolved": "https://registry.npmjs.org/nan/-/nan-2.14.0.tgz",
@ -11462,6 +11499,14 @@
} }
} }
}, },
"read-last-lines": {
"version": "1.7.1",
"resolved": "https://registry.npmjs.org/read-last-lines/-/read-last-lines-1.7.1.tgz",
"integrity": "sha512-X98EcfP8dUNBg52Mhwdu/WTNI9TaGHnBeximG9Wp/bV6PmILeS9gQ0FHkrqcPIvbbZb/2jjWCzvA2r1HScnEqA==",
"requires": {
"mz": "^2.7.0"
}
},
"read-pkg": { "read-pkg": {
"version": "3.0.0", "version": "3.0.0",
"resolved": "https://registry.npmjs.org/read-pkg/-/read-pkg-3.0.0.tgz", "resolved": "https://registry.npmjs.org/read-pkg/-/read-pkg-3.0.0.tgz",
@ -13051,6 +13096,22 @@
"resolved": "https://registry.npmjs.org/text-table/-/text-table-0.2.0.tgz", "resolved": "https://registry.npmjs.org/text-table/-/text-table-0.2.0.tgz",
"integrity": "sha1-f17oI66AUgfACvLfSoTsP8+lcLQ=" "integrity": "sha1-f17oI66AUgfACvLfSoTsP8+lcLQ="
}, },
"thenify": {
"version": "3.3.0",
"resolved": "https://registry.npmjs.org/thenify/-/thenify-3.3.0.tgz",
"integrity": "sha1-5p44obq+lpsBCCB5eLn2K4hgSDk=",
"requires": {
"any-promise": "^1.0.0"
}
},
"thenify-all": {
"version": "1.6.0",
"resolved": "https://registry.npmjs.org/thenify-all/-/thenify-all-1.6.0.tgz",
"integrity": "sha1-GhkY1ALY/D+Y+/I02wvMjMEOlyY=",
"requires": {
"thenify": ">= 3.1.0 < 4"
}
},
"throat": { "throat": {
"version": "4.1.0", "version": "4.1.0",
"resolved": "https://registry.npmjs.org/throat/-/throat-4.1.0.tgz", "resolved": "https://registry.npmjs.org/throat/-/throat-4.1.0.tgz",
@ -13560,6 +13621,11 @@
"resolved": "https://registry.npmjs.org/utila/-/utila-0.4.0.tgz", "resolved": "https://registry.npmjs.org/utila/-/utila-0.4.0.tgz",
"integrity": "sha1-ihagXURWV6Oupe7MWxKk+lN5dyw=" "integrity": "sha1-ihagXURWV6Oupe7MWxKk+lN5dyw="
}, },
"utils-extend": {
"version": "1.0.8",
"resolved": "https://registry.npmjs.org/utils-extend/-/utils-extend-1.0.8.tgz",
"integrity": "sha1-zP17ZFQPjpDuIe7Fd2nQZRyril8="
},
"utils-merge": { "utils-merge": {
"version": "1.0.1", "version": "1.0.1",
"resolved": "https://registry.npmjs.org/utils-merge/-/utils-merge-1.0.1.tgz", "resolved": "https://registry.npmjs.org/utils-merge/-/utils-merge-1.0.1.tgz",


+ 3
- 1
package.json View File

@ -5,6 +5,7 @@
"dependencies": { "dependencies": {
"@material-ui/core": "^4.5.0", "@material-ui/core": "^4.5.0",
"bootstrap": "^4.3.1", "bootstrap": "^4.3.1",
"file-system": "^2.2.2",
"react": "^16.10.2", "react": "^16.10.2",
"react-bootstrap": "^1.0.0-beta.14", "react-bootstrap": "^1.0.0-beta.14",
"react-dom": "^16.10.2", "react-dom": "^16.10.2",
@ -13,7 +14,8 @@
"react-image-lightbox": "^5.1.0", "react-image-lightbox": "^5.1.0",
"react-multiple-image-grid": "^0.1.1", "react-multiple-image-grid": "^0.1.1",
"react-router-dom": "^5.1.2", "react-router-dom": "^5.1.2",
"react-scripts": "3.2.0"
"react-scripts": "3.2.0",
"read-last-lines": "^1.7.1"
}, },
"scripts": { "scripts": {
"start": "react-scripts start", "start": "react-scripts start",


+ 2
- 1
public/plantinfo.json View File

@ -86,7 +86,7 @@
"light": { "light": {
"enabled": true, "enabled": true,
"sensor_type": "common", "sensor_type": "common",
"gpio_pin": "",
"gpio_pin": 19,
"gpio_pin_initialstate": "LOW", "gpio_pin_initialstate": "LOW",
"gpio_pin_upstate": "HIGH", "gpio_pin_upstate": "HIGH",
"sensor_friendly_name": "Light sensor (1)", "sensor_friendly_name": "Light sensor (1)",
@ -147,6 +147,7 @@
"temperature": { "temperature": {
"enabled": true, "enabled": true,
"gpio_pin": 36,
"sensor_type": "temperature", "sensor_type": "temperature",
"device_type": "THERM_SENSOR_DS18B20", "device_type": "THERM_SENSOR_DS18B20",
"device_id": "", "device_id": "",


+ 137
- 0
public/tekstia.txt View File

@ -0,0 +1,137 @@
[22/Nov/2019 10:47:17] INFO [alarmpi: jsonreader.py, __init__ (305)]: Loaded JSON configuration for sensor 'Moisture sensor (1)'
[22/Nov/2019 10:47:17] WARNING [alarmpi: jsonreader.py, check_devices_out (313)]: Output device 'UV lamp (1)' for sensor 'Light sensor (1)' has been disabled. Either this is intended or the device has not required GPIO pin value in JSON configuration file /etc/tinyforest/json/profile_plant1_v01.json
[22/Nov/2019 10:47:17] WARNING [alarmpi: jsonreader.py, __init__ (313)]: Sensor 'Light sensor (1)' has been disabled. Either this is intended or the sensor has not required GPIO pin value in JSON configuration file /etc/tinyforest/json/profile_plant1_v01.json
[22/Nov/2019 10:47:17] INFO [alarmpi: jsonreader.py, __init__ (305)]: Loaded JSON configuration for sensor 'Temperature sensor (1)'
[22/Nov/2019 10:47:17] WARNING [alarmpi: jsonreader.py, check_devices_out (313)]: Output device 'Fertilizer pump (1)' for sensor 'pH sensor (1)' has been disabled. Either this is intended or the device has not required GPIO pin value in JSON configuration file /etc/tinyforest/json/profile_plant1_v01.json
[22/Nov/2019 10:47:17] WARNING [alarmpi: jsonreader.py, __init__ (313)]: Sensor 'pH sensor (1)' has been disabled. Either this is intended or the sensor has not required GPIO pin value in JSON configuration file /etc/tinyforest/json/profile_plant1_v01.json
[22/Nov/2019 10:47:17] INFO [alarmpi: jsonreader.py, __init__ (305)]: Started sensor process for sensor 'Moisture sensor (1)'
[22/Nov/2019 10:47:17] INFO [alarmpi: jsonreader.py, __init__ (305)]: Started sensor process for sensor 'Temperature sensor (1)'
[22/Nov/2019 10:47:30] WARNING [alarmpi: system.py, user (313)]: Running process as root. Please make sure this is intended.
[22/Nov/2019 10:47:31] INFO [alarmpi: jsonreader.py, __init__ (305)]: Loaded JSON configuration for sensor 'Moisture sensor (1)'
[22/Nov/2019 10:47:31] WARNING [alarmpi: jsonreader.py, check_devices_out (313)]: Output device 'UV lamp (1)' for sensor 'Light sensor (1)' has been disabled. Either this is intended or the device has not required GPIO pin value in JSON configuration file /etc/tinyforest/json/profile_plant1_v01.json
[22/Nov/2019 10:47:31] WARNING [alarmpi: jsonreader.py, __init__ (313)]: Sensor 'Light sensor (1)' has been disabled. Either this is intended or the sensor has not required GPIO pin value in JSON configuration file /etc/tinyforest/json/profile_plant1_v01.json
[22/Nov/2019 10:47:31] INFO [alarmpi: jsonreader.py, __init__ (305)]: Loaded JSON configuration for sensor 'Temperature sensor (1)'
[22/Nov/2019 10:47:31] WARNING [alarmpi: jsonreader.py, check_devices_out (313)]: Output device 'Fertilizer pump (1)' for sensor 'pH sensor (1)' has been disabled. Either this is intended or the device has not required GPIO pin value in JSON configuration file /etc/tinyforest/json/profile_plant1_v01.json
[22/Nov/2019 10:47:31] WARNING [alarmpi: jsonreader.py, __init__ (313)]: Sensor 'pH sensor (1)' has been disabled. Either this is intended or the sensor has not required GPIO pin value in JSON configuration file /etc/tinyforest/json/profile_plant1_v01.json
[22/Nov/2019 10:47:31] INFO [alarmpi: jsonreader.py, __init__ (305)]: Started sensor process for sensor 'Moisture sensor (1)'
[22/Nov/2019 10:47:31] INFO [alarmpi: jsonreader.py, __init__ (305)]: Started sensor process for sensor 'Temperature sensor (1)'
[22/Nov/2019 10:47:32] INFO [alarmpi: sensorfunctions.py, temperature (305)]: Temperature sensor (1): temperature (22.25) is below tolerance value 26.0 celsius
[22/Nov/2019 10:47:32] INFO [alarmpi: sensorfunctions.py, temperature (305)]: Battery (1) is warming
[22/Nov/2019 10:48:01] INFO [alarmpi: sensorfunctions.py, common (305)]: Water pump (1) OFF (GPIO pin: 14, triggered by Moisture sensor (1))
[22/Nov/2019 10:48:15] INFO [alarmpi: sensorfunctions.py, temperature (305)]: Temperature sensor (1): temperature (22.5) is below tolerance value 26.0 celsius
[22/Nov/2019 10:48:15] INFO [alarmpi: sensorfunctions.py, temperature (305)]: Battery (1) is warming
[22/Nov/2019 10:48:16] INFO [alarmpi: sensorfunctions.py, temperature (305)]: Temperature sensor (1): temperature (23.3125) is below tolerance value 26.0 celsius
[22/Nov/2019 10:48:16] INFO [alarmpi: sensorfunctions.py, temperature (305)]: Battery (1) is warming
[22/Nov/2019 10:48:17] INFO [alarmpi: sensorfunctions.py, temperature (305)]: Temperature sensor (1): temperature (24.1875) is below tolerance value 26.0 celsius
[22/Nov/2019 10:48:17] INFO [alarmpi: sensorfunctions.py, temperature (305)]: Battery (1) is warming
[22/Nov/2019 10:48:18] INFO [alarmpi: sensorfunctions.py, temperature (305)]: Temperature sensor (1): temperature (24.9375) is below tolerance value 26.0 celsius
[22/Nov/2019 10:48:18] INFO [alarmpi: sensorfunctions.py, temperature (305)]: Battery (1) is warming
[22/Nov/2019 10:48:20] INFO [alarmpi: sensorfunctions.py, temperature (305)]: Temperature sensor (1): temperature (25.625) is below tolerance value 26.0 celsius
[22/Nov/2019 10:48:20] INFO [alarmpi: sensorfunctions.py, temperature (305)]: Battery (1) is warming
[22/Nov/2019 10:48:21] INFO [alarmpi: sensorfunctions.py, temperature (305)]: Temperature sensor (1): temperature is 26.1875 celsius
[22/Nov/2019 10:48:22] INFO [alarmpi: sensorfunctions.py, temperature (305)]: Temperature sensor (1): temperature is 26.6875 celsius
[22/Nov/2019 10:48:23] INFO [alarmpi: sensorfunctions.py, temperature (305)]: Temperature sensor (1): temperature is 26.9375 celsius
[22/Nov/2019 10:48:24] INFO [alarmpi: sensorfunctions.py, temperature (305)]: Temperature sensor (1): temperature is 27.0625 celsius
[22/Nov/2019 10:48:32] INFO [alarmpi: sensorfunctions.py, temperature (305)]: Temperature sensor (1): temperature is 27.375 celsius
[22/Nov/2019 10:48:34] INFO [alarmpi: sensorfunctions.py, temperature (305)]: Temperature sensor (1): temperature is 27.8125 celsius
[22/Nov/2019 10:48:35] INFO [alarmpi: sensorfunctions.py, temperature (305)]: Temperature sensor (1): temperature is 28.25 celsius
[22/Nov/2019 10:48:36] INFO [alarmpi: sensorfunctions.py, temperature (305)]: Temperature sensor (1): temperature is 28.625 celsius
[22/Nov/2019 10:48:37] INFO [alarmpi: sensorfunctions.py, temperature (305)]: Temperature sensor (1): temperature is 28.9375 celsius
[22/Nov/2019 10:48:38] INFO [alarmpi: sensorfunctions.py, temperature (305)]: Temperature sensor (1): temperature is 29.25 celsius
[22/Nov/2019 10:48:40] INFO [alarmpi: sensorfunctions.py, temperature (305)]: Temperature sensor (1): temperature is 29.4375 celsius
[22/Nov/2019 10:48:47] INFO [alarmpi: sensorfunctions.py, temperature (305)]: Temperature sensor (1): temperature is 29.3125 celsius
[22/Nov/2019 10:48:49] INFO [alarmpi: sensorfunctions.py, temperature (305)]: Temperature sensor (1): temperature is 29.1875 celsius
[22/Nov/2019 10:48:51] INFO [alarmpi: sensorfunctions.py, temperature (305)]: Temperature sensor (1): temperature is 29.0625 celsius
[22/Nov/2019 10:48:53] INFO [alarmpi: sensorfunctions.py, temperature (305)]: Temperature sensor (1): temperature is 28.9375 celsius
[22/Nov/2019 10:48:56] INFO [alarmpi: sensorfunctions.py, temperature (305)]: Temperature sensor (1): temperature is 28.8125 celsius
[22/Nov/2019 10:48:58] INFO [alarmpi: sensorfunctions.py, temperature (305)]: Temperature sensor (1): temperature is 28.6875 celsius
[22/Nov/2019 10:49:00] INFO [alarmpi: sensorfunctions.py, temperature (305)]: Temperature sensor (1): temperature is 28.5625 celsius
[22/Nov/2019 10:49:03] INFO [alarmpi: sensorfunctions.py, temperature (305)]: Temperature sensor (1): temperature is 28.4375 celsius
[22/Nov/2019 10:49:06] INFO [alarmpi: sensorfunctions.py, temperature (305)]: Temperature sensor (1): temperature is 28.3125 celsius
[22/Nov/2019 10:49:08] INFO [alarmpi: sensorfunctions.py, temperature (305)]: Temperature sensor (1): temperature is 28.1875 celsius
[22/Nov/2019 10:49:11] INFO [alarmpi: sensorfunctions.py, temperature (305)]: Temperature sensor (1): temperature is 28.0625 celsius
[22/Nov/2019 10:49:13] INFO [alarmpi: sensorfunctions.py, temperature (305)]: Temperature sensor (1): temperature is 27.9375 celsius
[22/Nov/2019 10:49:18] INFO [alarmpi: sensorfunctions.py, temperature (305)]: Temperature sensor (1): temperature is 27.8125 celsius
[22/Nov/2019 10:49:21] INFO [alarmpi: sensorfunctions.py, temperature (305)]: Temperature sensor (1): temperature is 27.6875 celsius
[22/Nov/2019 10:49:23] INFO [alarmpi: sensorfunctions.py, temperature (305)]: Temperature sensor (1): temperature is 27.5625 celsius
[22/Nov/2019 10:49:29] INFO [alarmpi: sensorfunctions.py, temperature (305)]: Temperature sensor (1): temperature is 27.4375 celsius
[22/Nov/2019 10:49:32] INFO [alarmpi: sensorfunctions.py, temperature (305)]: Temperature sensor (1): temperature is 27.3125 celsius
[22/Nov/2019 10:49:37] INFO [alarmpi: sensorfunctions.py, temperature (305)]: Temperature sensor (1): temperature is 27.1875 celsius
[22/Nov/2019 10:49:42] INFO [alarmpi: sensorfunctions.py, temperature (305)]: Temperature sensor (1): temperature is 27.0625 celsius
[22/Nov/2019 10:49:46] INFO [alarmpi: sensorfunctions.py, temperature (305)]: Temperature sensor (1): temperature is 26.9375 celsius
[22/Nov/2019 10:49:51] INFO [alarmpi: sensorfunctions.py, temperature (305)]: Temperature sensor (1): temperature is 26.8125 celsius
[22/Nov/2019 10:49:55] INFO [alarmpi: sensorfunctions.py, temperature (305)]: Temperature sensor (1): temperature is 26.6875 celsius
[22/Nov/2019 10:50:01] INFO [alarmpi: sensorfunctions.py, temperature (305)]: Temperature sensor (1): temperature is 26.5625 celsius
[22/Nov/2019 10:50:05] INFO [alarmpi: sensorfunctions.py, temperature (305)]: Temperature sensor (1): temperature is 26.4375 celsius
[22/Nov/2019 10:50:12] INFO [alarmpi: sensorfunctions.py, temperature (305)]: Temperature sensor (1): temperature is 26.3125 celsius
[22/Nov/2019 10:50:17] INFO [alarmpi: sensorfunctions.py, temperature (305)]: Temperature sensor (1): temperature is 26.1875 celsius
[22/Nov/2019 10:50:19] INFO [alarmpi: sensorfunctions.py, temperature (305)]: Temperature sensor (1): temperature is 26.0625 celsius
[22/Nov/2019 10:50:20] INFO [alarmpi: sensorfunctions.py, temperature (305)]: Temperature sensor (1): temperature (25.875) is below tolerance value 26.0 celsius
[22/Nov/2019 10:50:20] INFO [alarmpi: sensorfunctions.py, temperature (305)]: Battery (1) is warming
[22/Nov/2019 10:50:24] INFO [alarmpi: sensorfunctions.py, temperature (305)]: Temperature sensor (1): temperature is 26.0625 celsius
[22/Nov/2019 10:50:26] INFO [alarmpi: sensorfunctions.py, temperature (305)]: Temperature sensor (1): temperature is 26.1875 celsius
[22/Nov/2019 10:50:27] INFO [alarmpi: sensorfunctions.py, temperature (305)]: Temperature sensor (1): temperature is 26.3125 celsius
[22/Nov/2019 10:50:30] INFO [alarmpi: sensorfunctions.py, temperature (305)]: Temperature sensor (1): temperature is 26.4375 celsius
[22/Nov/2019 10:50:32] INFO [alarmpi: sensorfunctions.py, temperature (305)]: Temperature sensor (1): temperature is 26.5625 celsius
[22/Nov/2019 10:50:37] INFO [alarmpi: sensorfunctions.py, temperature (305)]: Temperature sensor (1): temperature is 26.4375 celsius
[22/Nov/2019 10:50:44] INFO [alarmpi: sensorfunctions.py, temperature (305)]: Temperature sensor (1): temperature is 26.3125 celsius
[22/Nov/2019 10:50:49] INFO [alarmpi: sensorfunctions.py, temperature (305)]: Temperature sensor (1): temperature is 26.1875 celsius
[22/Nov/2019 10:50:55] INFO [alarmpi: sensorfunctions.py, temperature (305)]: Temperature sensor (1): temperature is 26.0625 celsius
[22/Nov/2019 10:51:01] INFO [alarmpi: sensorfunctions.py, temperature (305)]: Temperature sensor (1): temperature (25.9375) is below tolerance value 26.0 celsius
[22/Nov/2019 10:51:02] INFO [alarmpi: sensorfunctions.py, temperature (305)]: Battery (1) is warming
[22/Nov/2019 10:51:05] INFO [alarmpi: sensorfunctions.py, temperature (305)]: Temperature sensor (1): temperature (25.8125) is below tolerance value 26.0 celsius
[22/Nov/2019 10:51:05] INFO [alarmpi: sensorfunctions.py, temperature (305)]: Battery (1) is warming
[22/Nov/2019 10:51:13] INFO [alarmpi: sensorfunctions.py, temperature (305)]: Temperature sensor (1): temperature (25.6875) is below tolerance value 26.0 celsius
[22/Nov/2019 10:51:13] INFO [alarmpi: sensorfunctions.py, temperature (305)]: Battery (1) is warming
[22/Nov/2019 10:51:19] INFO [alarmpi: sensorfunctions.py, temperature (305)]: Temperature sensor (1): temperature (25.5625) is below tolerance value 26.0 celsius
[22/Nov/2019 10:51:19] INFO [alarmpi: sensorfunctions.py, temperature (305)]: Battery (1) is warming
[22/Nov/2019 10:51:25] INFO [alarmpi: sensorfunctions.py, temperature (305)]: Temperature sensor (1): temperature (25.4375) is below tolerance value 26.0 celsius
[22/Nov/2019 10:51:25] INFO [alarmpi: sensorfunctions.py, temperature (305)]: Battery (1) is warming
[22/Nov/2019 10:51:31] INFO [alarmpi: sensorfunctions.py, temperature (305)]: Temperature sensor (1): temperature (25.3125) is below tolerance value 26.0 celsius
[22/Nov/2019 10:51:31] INFO [alarmpi: sensorfunctions.py, temperature (305)]: Battery (1) is warming
[22/Nov/2019 10:51:37] INFO [alarmpi: sensorfunctions.py, temperature (305)]: Temperature sensor (1): temperature (25.1875) is below tolerance value 26.0 celsius
[22/Nov/2019 10:51:37] INFO [alarmpi: sensorfunctions.py, temperature (305)]: Battery (1) is warming
[22/Nov/2019 10:51:46] INFO [alarmpi: sensorfunctions.py, temperature (305)]: Temperature sensor (1): temperature (25.0625) is below tolerance value 26.0 celsius
[22/Nov/2019 10:51:46] INFO [alarmpi: sensorfunctions.py, temperature (305)]: Battery (1) is warming
[22/Nov/2019 10:51:50] INFO [alarmpi: sensorfunctions.py, temperature (305)]: Temperature sensor (1): temperature (24.9375) is below tolerance value 26.0 celsius
[22/Nov/2019 10:51:50] INFO [alarmpi: sensorfunctions.py, temperature (305)]: Battery (1) is warming
[22/Nov/2019 10:51:58] INFO [alarmpi: sensorfunctions.py, temperature (305)]: Temperature sensor (1): temperature (24.8125) is below tolerance value 26.0 celsius
[22/Nov/2019 10:51:58] INFO [alarmpi: sensorfunctions.py, temperature (305)]: Battery (1) is warming
[22/Nov/2019 10:52:06] INFO [alarmpi: sensorfunctions.py, temperature (305)]: Temperature sensor (1): temperature (24.6875) is below tolerance value 26.0 celsius
[22/Nov/2019 10:52:06] INFO [alarmpi: sensorfunctions.py, temperature (305)]: Battery (1) is warming
[22/Nov/2019 10:52:14] INFO [alarmpi: sensorfunctions.py, temperature (305)]: Temperature sensor (1): temperature (24.5625) is below tolerance value 26.0 celsius
[22/Nov/2019 10:52:14] INFO [alarmpi: sensorfunctions.py, temperature (305)]: Battery (1) is warming
[22/Nov/2019 10:52:24] INFO [alarmpi: sensorfunctions.py, temperature (305)]: Temperature sensor (1): temperature (24.4375) is below tolerance value 26.0 celsius
[22/Nov/2019 10:52:24] INFO [alarmpi: sensorfunctions.py, temperature (305)]: Battery (1) is warming
[22/Nov/2019 10:52:36] INFO [alarmpi: sensorfunctions.py, temperature (305)]: Temperature sensor (1): temperature (24.3125) is below tolerance value 26.0 celsius
[22/Nov/2019 10:52:36] INFO [alarmpi: sensorfunctions.py, temperature (305)]: Battery (1) is warming
[22/Nov/2019 10:52:42] INFO [alarmpi: sensorfunctions.py, temperature (305)]: Temperature sensor (1): temperature (24.1875) is below tolerance value 26.0 celsius
[22/Nov/2019 10:52:42] INFO [alarmpi: sensorfunctions.py, temperature (305)]: Battery (1) is warming
[22/Nov/2019 10:52:53] INFO [alarmpi: sensorfunctions.py, temperature (305)]: Temperature sensor (1): temperature (24.0625) is below tolerance value 26.0 celsius
[22/Nov/2019 10:52:53] INFO [alarmpi: sensorfunctions.py, temperature (305)]: Battery (1) is warming
[22/Nov/2019 10:53:04] INFO [alarmpi: sensorfunctions.py, temperature (305)]: Temperature sensor (1): temperature (23.9375) is below tolerance value 26.0 celsius
[22/Nov/2019 10:53:04] INFO [alarmpi: sensorfunctions.py, temperature (305)]: Battery (1) is warming
[22/Nov/2019 10:53:17] INFO [alarmpi: sensorfunctions.py, temperature (305)]: Temperature sensor (1): temperature (23.8125) is below tolerance value 26.0 celsius
[22/Nov/2019 10:53:17] INFO [alarmpi: sensorfunctions.py, temperature (305)]: Battery (1) is warming
[22/Nov/2019 10:53:27] INFO [alarmpi: sensorfunctions.py, temperature (305)]: Temperature sensor (1): temperature (23.6875) is below tolerance value 26.0 celsius
[22/Nov/2019 10:53:28] INFO [alarmpi: sensorfunctions.py, temperature (305)]: Battery (1) is warming
[22/Nov/2019 10:53:39] INFO [alarmpi: sensorfunctions.py, temperature (305)]: Temperature sensor (1): temperature (23.5625) is below tolerance value 26.0 celsius
[22/Nov/2019 10:53:39] INFO [alarmpi: sensorfunctions.py, temperature (305)]: Battery (1) is warming
[22/Nov/2019 10:53:52] INFO [alarmpi: sensorfunctions.py, temperature (305)]: Temperature sensor (1): temperature (23.4375) is below tolerance value 26.0 celsius
[22/Nov/2019 10:53:52] INFO [alarmpi: sensorfunctions.py, temperature (305)]: Battery (1) is warming
[22/Nov/2019 10:54:07] INFO [alarmpi: sensorfunctions.py, temperature (305)]: Temperature sensor (1): temperature (23.3125) is below tolerance value 26.0 celsius
[22/Nov/2019 10:54:07] INFO [alarmpi: sensorfunctions.py, temperature (305)]: Battery (1) is warming
[22/Nov/2019 10:54:26] INFO [alarmpi: sensorfunctions.py, temperature (305)]: Temperature sensor (1): temperature (23.1875) is below tolerance value 26.0 celsius
[22/Nov/2019 10:54:26] INFO [alarmpi: sensorfunctions.py, temperature (305)]: Battery (1) is warming
[22/Nov/2019 10:54:44] INFO [alarmpi: sensorfunctions.py, temperature (305)]: Temperature sensor (1): temperature (23.0625) is below tolerance value 26.0 celsius
[22/Nov/2019 10:54:44] INFO [alarmpi: sensorfunctions.py, temperature (305)]: Battery (1) is warming
[22/Nov/2019 10:55:05] INFO [alarmpi: sensorfunctions.py, temperature (305)]: Temperature sensor (1): temperature (22.9375) is below tolerance value 26.0 celsius
[22/Nov/2019 10:55:05] INFO [alarmpi: sensorfunctions.py, temperature (305)]: Battery (1) is warming
[22/Nov/2019 10:55:37] INFO [alarmpi: sensorfunctions.py, temperature (305)]: Temperature sensor (1): temperature (22.8125) is below tolerance value 26.0 celsius
[22/Nov/2019 10:55:37] INFO [alarmpi: sensorfunctions.py, temperature (305)]: Battery (1) is warming
[22/Nov/2019 10:56:00] INFO [alarmpi: sensorfunctions.py, temperature (305)]: Temperature sensor (1): temperature (22.6875) is below tolerance value 26.0 celsius
[22/Nov/2019 10:56:00] INFO [alarmpi: sensorfunctions.py, temperature (305)]: Battery (1) is warming
[22/Nov/2019 10:56:22] INFO [alarmpi: sensorfunctions.py, temperature (305)]: Temperature sensor (1): temperature (22.5625) is below tolerance value 26.0 celsius
[22/Nov/2019 10:56:22] INFO [alarmpi: sensorfunctions.py, temperature (305)]: Battery (1) is warming
[22/Nov/2019 10:56:56] INFO [alarmpi: sensorfunctions.py, temperature (305)]: Temperature sensor (1): temperature (22.4375) is below tolerance value 26.0 celsius
[22/Nov/2019 10:56:56] INFO [alarmpi: sensorfunctions.py, temperature (305)]: Battery (1) is warming

+ 37
- 10
public/tinyforest.log.json View File

@ -1,12 +1,39 @@
{ {
"0" :{ "time": { "day": 30, "month": 10, "year": 2019, "hour": 11, "minute": 3, "second": 22 }, "loglevel": "INFO", "host": "alarmpi", "file": "system.py", "func": "init_file", "msg": {"info": "file created", "file": "/var/log/tinyforest/tinyforest.log.json"} },
"1" :{ "time": { "day": 30, "month": 10, "year": 2019, "hour": 11, "minute": 3, "second": 22 }, "loglevel": "INFO", "host": "alarmpi", "file": "system.py", "func": "init_file", "msg": {"info": "file opened", "file": "/var/log/tinyforest/tinyforest.log.json"} },
"2" :{ "time": { "day": 30, "month": 10, "year": 2019, "hour": 11, "minute": 3, "second": 23 }, "loglevel": "INFO", "host": "alarmpi", "file": "jsonreader.py", "func": "__init__", "msg": {"json_common": {"target": "/etc/tinyforest/json/profile_plant1_v01.json", "name": "Moisture sensor (1)", "description": "Moisture sensor (1): loaded JSON configuration"}} },
"3" :{ "time": { "day": 30, "month": 10, "year": 2019, "hour": 11, "minute": 3, "second": 23 }, "loglevel": "DEBUG", "host": "alarmpi", "file": "jsonreader.py", "func": "__init__", "msg": {"json_common": {"target": "/etc/tinyforest/json/profile_plant1_v01.json", "name": "Moisture sensor (1)", "description": "Moisture sensor (1): {'enabled': True, 'sensor_type': 'common', 'gpio_pin': 24, 'gpio_pin_initialstate': 'LOW', 'gpio_pin_upstate': 'HIGH', 'sensor_friendly_name': 'Moisture sensor (1)', 'trigger_data_type': 'dummy_on_off', 'trigger_min': 1.0, 'trigger_max': 0.0, 'time': {'use_time': True, 'months': {'1': True, '2': True, '3': True, '4': True, '5': True, '6': True, '7': True, '8': True, '9': True, '10': True, '11': True, '12': True}, 'weeks': {'1': True, '2': True, '3': True, '4': True}, 'days': {'mon': {'enabled': True, 'interval': ['12.00', '18.00']}, 'tue': {'enabled': True, 'interval': ['8.00', '16.00']}, 'wed': {'enabled': True, 'interval': ['13.00', '20.00']}, 'thu': {'enabled': True, 'interval': ['4.00', '12.00']}, 'fri': {'enabled': True, 'interval': ['12.00', '18.00']}, 'sat': {'enabled': True, 'interval': ['6.00', '14.00']}, 'sun': {'enabled': True, 'interval': ['15.00', '23.59']}}}, 'devices_out': {'common': {'use_devices_out': True, 'check_interval': 0.25, 'keepalivetime_max': 5.0}, 'devices_out_spec': [{'enabled': True, 'gpio_pin': 14, 'gpio_pin_initialstate': 'LOW', 'gpio_pin_upstate': 'HIGH', 'operation_type': 'irrigation', 'name': 'pump_1', 'friendly_name': 'Water pump (1)'}, {'enabled': False, 'gpio_pin': 15, 'gpio_pin_initialstate': 'LOW', 'gpio_pin_upstate': 'HIGH', 'operation_type': 'irrigation', 'name': 'pump_2', 'friendly_name': 'Water pump (2)'}]}}"}} },
"4" :{ "time": { "day": 30, "month": 10, "year": 2019, "hour": 11, "minute": 3, "second": 23 }, "loglevel": "WARNING", "host": "alarmpi", "file": "jsonreader.py", "func": "check_devices_out", "msg": {"json_common": {"target": "/etc/tinyforest/json/profile_plant1_v01.json", "name": "Light sensor (1)", "description": "Light sensor (1): output device UV lamp (1) disabled"}} },
"5" :{ "time": { "day": 30, "month": 10, "year": 2019, "hour": 11, "minute": 3, "second": 23 }, "loglevel": "WARNING", "host": "alarmpi", "file": "jsonreader.py", "func": "__init__", "msg": {"json_common": {"target": "/etc/tinyforest/json/profile_plant1_v01.json", "name": "light", "description": "light: disabled"}} },
"6" :{ "time": { "day": 30, "month": 10, "year": 2019, "hour": 11, "minute": 3, "second": 23 }, "loglevel": "WARNING", "host": "alarmpi", "file": "jsonreader.py", "func": "__init__", "msg": {"json_common": {"target": "/etc/tinyforest/json/profile_plant1_v01.json", "name": "temperature", "description": "temperature: disabled"}} },
"7" :{ "time": { "day": 30, "month": 10, "year": 2019, "hour": 11, "minute": 3, "second": 23 }, "loglevel": "WARNING", "host": "alarmpi", "file": "jsonreader.py", "func": "check_devices_out", "msg": {"json_common": {"target": "/etc/tinyforest/json/profile_plant1_v01.json", "name": "pH sensor (1)", "description": "pH sensor (1): output device Fertilizer pump (1) disabled"}} },
"8" :{ "time": { "day": 30, "month": 10, "year": 2019, "hour": 11, "minute": 3, "second": 23 }, "loglevel": "WARNING", "host": "alarmpi", "file": "jsonreader.py", "func": "__init__", "msg": {"json_common": {"target": "/etc/tinyforest/json/profile_plant1_v01.json", "name": "acidity", "description": "acidity: disabled"}} },
"9" :{ "time": { "day": 30, "month": 10, "year": 2019, "hour": 11, "minute": 3, "second": 23 }, "loglevel": "INFO", "host": "alarmpi", "file": "jsonreader.py", "func": "__init__", "msg": {"json_common": {"target": "/etc/tinyforest/json/profile_plant1_v01.json", "name": "Moisture sensor (1)", "description": "Moisture sensor (1): started sensor process"}} }
"system_file": { "loglevel": "INFO", "msg": {"info": "file created", "user": "kasviloordi", "file": "/var/log/tinyforest/tinyforest.log.json"}, "time": { "day": 22, "month": 11, "year": 2019, "hour": 1, "minute": 47, "second": 29 }, "host": "fincer-laptop", "file": "system.py", "func": "init_file", "line": 299 }
,
"system_file": { "loglevel": "INFO", "msg": {"info": "file opened", "user": "kasviloordi", "file": "/var/log/tinyforest/tinyforest.log.json"}, "time": { "day": 22, "month": 11, "year": 2019, "hour": 1, "minute": 47, "second": 29 }, "host": "fincer-laptop", "file": "system.py", "func": "init_file", "line": 299 }
,
"sensor": { "loglevel": "INFO", "msg": {"name": "Moisture sensor (1)", "description": "loaded JSON configuration", "source": "/etc/tinyforest/json/profile_plant1_v01.json"}, "time": { "day": 22, "month": 11, "year": 2019, "hour": 1, "minute": 47, "second": 29 }, "host": "fincer-laptop", "file": "jsonreader.py", "func": "__init__", "line": 299 }
,
"json_check": { "loglevel": "WARNING", "msg": {"description": "Light sensor (1): output device UV lamp (1) disabled", "source": "/etc/tinyforest/json/profile_plant1_v01.json"}, "time": { "day": 22, "month": 11, "year": 2019, "hour": 1, "minute": 47, "second": 29 }, "host": "fincer-laptop", "file": "jsonreader.py", "func": "check_devices_out", "line": 307 }
,
"sensor": { "loglevel": "WARNING", "msg": {"name": "Light sensor (1)", "description": "disabled", "source": "/etc/tinyforest/json/profile_plant1_v01.json"}, "time": { "day": 22, "month": 11, "year": 2019, "hour": 1, "minute": 47, "second": 29 }, "host": "fincer-laptop", "file": "jsonreader.py", "func": "__init__", "line": 307 }
,
"sensor": { "loglevel": "INFO", "msg": {"name": "Temperature sensor (1)", "description": "loaded JSON configuration", "source": "/etc/tinyforest/json/profile_plant1_v01.json"}, "time": { "day": 22, "month": 11, "year": 2019, "hour": 1, "minute": 47, "second": 29 }, "host": "fincer-laptop", "file": "jsonreader.py", "func": "__init__", "line": 299 }
,
"json_check": { "loglevel": "WARNING", "msg": {"description": "pH sensor (1): output device Fertilizer pump (1) disabled", "source": "/etc/tinyforest/json/profile_plant1_v01.json"}, "time": { "day": 22, "month": 11, "year": 2019, "hour": 1, "minute": 47, "second": 29 }, "host": "fincer-laptop", "file": "jsonreader.py", "func": "check_devices_out", "line": 307 }
,
"sensor": { "loglevel": "WARNING", "msg": {"name": "pH sensor (1)", "description": "disabled", "source": "/etc/tinyforest/json/profile_plant1_v01.json"}, "time": { "day": 22, "month": 11, "year": 2019, "hour": 1, "minute": 47, "second": 29 }, "host": "fincer-laptop", "file": "jsonreader.py", "func": "__init__", "line": 307 }
,
"sensor": { "loglevel": "INFO", "msg": {"name": "Moisture sensor (1)", "description": "started process", "source": "/etc/tinyforest/json/profile_plant1_v01.json"}, "time": { "day": 22, "month": 11, "year": 2019, "hour": 1, "minute": 47, "second": 29 }, "host": "fincer-laptop", "file": "jsonreader.py", "func": "__init__", "line": 299 }
,
"sensor": { "loglevel": "INFO", "msg": {"name": "Temperature sensor (1)", "description": "started process", "source": "/etc/tinyforest/json/profile_plant1_v01.json"}, "time": { "day": 22, "month": 11, "year": 2019, "hour": 1, "minute": 47, "second": 29 }, "host": "fincer-laptop", "file": "jsonreader.py", "func": "__init__", "line": 299 }
,
"system_file": { "loglevel": "INFO", "msg": {"info": "file opened", "user": "kasviloordi", "file": "/var/log/tinyforest/tinyforest.log.json"}, "time": { "day": 22, "month": 11, "year": 2019, "hour": 1, "minute": 49, "second": 12 }, "host": "fincer-laptop", "file": "system.py", "func": "init_file", "line": 299 }
,
"sensor": { "loglevel": "INFO", "msg": {"name": "Moisture sensor (1)", "description": "loaded JSON configuration", "source": "/etc/tinyforest/json/profile_plant1_v01.json"}, "time": { "day": 22, "month": 11, "year": 2019, "hour": 1, "minute": 49, "second": 12 }, "host": "fincer-laptop", "file": "jsonreader.py", "func": "__init__", "line": 299 }
,
"json_check": { "loglevel": "WARNING", "msg": {"description": "Light sensor (1): output device UV lamp (1) disabled", "source": "/etc/tinyforest/json/profile_plant1_v01.json"}, "time": { "day": 22, "month": 11, "year": 2019, "hour": 1, "minute": 49, "second": 12 }, "host": "fincer-laptop", "file": "jsonreader.py", "func": "check_devices_out", "line": 307 }
,
"sensor": { "loglevel": "WARNING", "msg": {"name": "Light sensor (1)", "description": "disabled", "source": "/etc/tinyforest/json/profile_plant1_v01.json"}, "time": { "day": 22, "month": 11, "year": 2019, "hour": 1, "minute": 49, "second": 12 }, "host": "fincer-laptop", "file": "jsonreader.py", "func": "__init__", "line": 307 }
,
"sensor": { "loglevel": "INFO", "msg": {"name": "Temperature sensor (1)", "description": "loaded JSON configuration", "source": "/etc/tinyforest/json/profile_plant1_v01.json"}, "time": { "day": 22, "month": 11, "year": 2019, "hour": 1, "minute": 49, "second": 12 }, "host": "fincer-laptop", "file": "jsonreader.py", "func": "__init__", "line": 299 }
,
"json_check": { "loglevel": "WARNING", "msg": {"description": "pH sensor (1): output device Fertilizer pump (1) disabled", "source": "/etc/tinyforest/json/profile_plant1_v01.json"}, "time": { "day": 22, "month": 11, "year": 2019, "hour": 1, "minute": 49, "second": 12 }, "host": "fincer-laptop", "file": "jsonreader.py", "func": "check_devices_out", "line": 307 }
,
"sensor": { "loglevel": "WARNING", "msg": {"name": "pH sensor (1)", "description": "disabled", "source": "/etc/tinyforest/json/profile_plant1_v01.json"}, "time": { "day": 22, "month": 11, "year": 2019, "hour": 1, "minute": 49, "second": 12 }, "host": "fincer-laptop", "file": "jsonreader.py", "func": "__init__", "line": 307 }
,
"sensor": { "loglevel": "INFO", "msg": {"name": "Moisture sensor (1)", "description": "started process", "source": "/etc/tinyforest/json/profile_plant1_v01.json"}, "time": { "day": 22, "month": 11, "year": 2019, "hour": 1, "minute": 49, "second": 12 }, "host": "fincer-laptop", "file": "jsonreader.py", "func": "__init__", "line": 299 }
,
"sensor": { "loglevel": "INFO", "msg": {"name": "Temperature sensor (1)", "description": "started process", "source": "/etc/tinyforest/json/profile_plant1_v01.json"}, "time": { "day": 22, "month": 11, "year": 2019, "hour": 1, "minute": 49, "second": 12 }, "host": "fincer-laptop", "file": "jsonreader.py", "func": "__init__", "line": 299 }
} }

+ 0
- 2
src/Components/Home.js View File

@ -5,8 +5,6 @@ import React from 'react';
import MultipleGridImages from 'react-multiple-image-grid' import MultipleGridImages from 'react-multiple-image-grid'
// TODO fix modallist to display right item
const Home = () => { const Home = () => {
return ( return (
<div className="home-wrapper"> <div className="home-wrapper">


+ 25
- 7
src/Components/LogParser.js View File

@ -2,26 +2,44 @@ import React, { useState, useEffect } from 'react';
const LogParser = () => { const LogParser = () => {
const [logs, setLogs] = useState([]);
const [sensor, setSensor] = useState([]);
const [systemfile, setSystemfile] = useState([]);
const [jsoncheck, setJsoncheck] = useState([]);
useEffect(() => { useEffect(() => {
fetchLogs();
fetchSensor();
fetchSystemfile();
fetchJsoncheck();
}, []) }, [])
const fetchLogs = () => {
const fetchSensor = () => {
fetch('../tinyforest.log.json') fetch('../tinyforest.log.json')
.then((res) => res.json()) .then((res) => res.json())
.then(data => setLogs(data))
.then(data => setSensor(data.sensor.msg))
.catch(err => console.error(err))
}
const fetchSystemfile = () => {
fetch('../tinyforest.log.json')
.then((res) => res.json())
.then(data => setSystemfile(data.system_file.msg))
.catch(err => console.error(err))
}
const fetchJsoncheck = () => {
fetch('../tinyforest.log.json')
.then((res) => res.json())
.then(data => setJsoncheck(data.json_check.msg))
.catch(err => console.error(err)) .catch(err => console.error(err))
} }
console.log(log)
console.log(sensor)
console.log(jsoncheck)
console.log(systemfile)
return ( return (
<div> <div>
<p>{sensor.name}: {sensor.description}</p>
<p>{jsoncheck.description}</p>
</div> </div>
); );
}; };


+ 12
- 3
src/Components/Plants.js View File

@ -1,6 +1,5 @@
import React, {useState, useEffect} from 'react'; import React, {useState, useEffect} from 'react';
const Plants = () => { const Plants = () => {
// TODO Figure out layout and what information to pull form json // TODO Figure out layout and what information to pull form json
@ -8,9 +7,11 @@ const Plants = () => {
// plantinfo.json is a temporary file // plantinfo.json is a temporary file
const [plant, setPlant] = useState([]); const [plant, setPlant] = useState([]);
const [teksti, setTeksti] = useState('');
useEffect(() => { useEffect(() => {
jsonFetch(); jsonFetch();
txtFetch();
}, []) }, [])
const jsonFetch = () => { const jsonFetch = () => {
@ -20,7 +21,15 @@ const Plants = () => {
.catch(err => console.error(err)) .catch(err => console.error(err))
} }
const txtFetch = () => {
fetch('../tekstia.txt')
.then((res) => res.text())
.then(data => setTeksti(data))
.catch(err => console.error(err))
}
console.log(teksti)
//console.log(plant.imagefile) //console.log(plant.imagefile)
@ -42,7 +51,7 @@ const Plants = () => {
<h5>Tyyppi: Kasvi2Tyyppi</h5> <h5>Tyyppi: Kasvi2Tyyppi</h5>
<h5>Istutuspäivä: kasvi2ispv</h5> <h5>Istutuspäivä: kasvi2ispv</h5>
<img alt="No_image" src={plant.imagefile2} width="200" ></img> <img alt="No_image" src={plant.imagefile2} width="200" ></img>
</div>
</div>
</div> </div>
</div> </div>
</div> </div>


+ 9
- 10
src/Components/Sysinfo.js View File

@ -1,4 +1,5 @@
import React, { useState, useEffect } from 'react'; import React, { useState, useEffect } from 'react';
import LogParser from './LogParser.js';
const Sysinfo = () => { const Sysinfo = () => {
@ -42,16 +43,7 @@ const Sysinfo = () => {
.catch(err => console.error(err)) .catch(err => console.error(err))
} }
console.log(logs) console.log(logs)
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. // TODO Pull system info etc.
@ -64,6 +56,7 @@ const Sysinfo = () => {
// .catch(err => console.error(err)) // .catch(err => console.error(err))
//} //}
return ( return (
<div> <div>
<div className="wrapperSys"> <div className="wrapperSys">
@ -71,17 +64,23 @@ const Sysinfo = () => {
<div className="sensors"> <div className="sensors">
<div className="sys1"> <div className="sys1">
<h5>Sensor name: {moisture.sensor_friendly_name}</h5> <h5>Sensor name: {moisture.sensor_friendly_name}</h5>
<h5>Moisture: 202020</h5>
<h5>Connected to pin: {moisture.gpio_pin}</h5> <h5>Connected to pin: {moisture.gpio_pin}</h5>
</div> </div>
<div className="sys1"> <div className="sys1">
<h5>Sensor name: {light.sensor_friendly_name}</h5> <h5>Sensor name: {light.sensor_friendly_name}</h5>
<h5>Light value(dark or light): light</h5>
<h5>Connected to pin: {light.gpio_pin}</h5> <h5>Connected to pin: {light.gpio_pin}</h5>
</div> </div>
<div className="sys1"> <div className="sys1">
<h5>Sensor name: {temperature.sensor_friendly_name}</h5> <h5>Sensor name: {temperature.sensor_friendly_name}</h5>
<h5>Temperature: 123c</h5>
<h5>Connected to pin: {temperature.gpio_pin}</h5> <h5>Connected to pin: {temperature.gpio_pin}</h5>
</div> </div>
<div className="sys1">
<h5>Recent system logs</h5>
<LogParser />
</div>
</div> </div>
</div> </div>
</div> </div>


Loading…
Cancel
Save