diff --git a/client/src/App.js b/client/src/App.js index bd2edac..72259bc 100644 --- a/client/src/App.js +++ b/client/src/App.js @@ -31,6 +31,7 @@ const units = { 'Setpoint': ' °C', 'State': '', 'Lux': ' lx', + 'Soil': '', }; function useSensor(measurement, name, end, duration) { @@ -108,7 +109,7 @@ function ChartContainer({name, data, lastFormatter, loading, children, topMargin return false; } - const dataGood = (x) => !['undefined', 'null'].some(y => lastFormatter(x).includes(y)); + const dataGood = (x) => !['undefined', 'null'].some(y => String(lastFormatter(x)).includes(y)); let last = null; if (data.length) { const data_end = data.slice(-2); @@ -1220,6 +1221,51 @@ function BedroomLux({end, duration}) { } +function DumbCaneSoil({end, duration}) { + const [data, loading, tickFormatter] = useSensor('soil', 'Dumb Cane', end, duration); + + return ( + x.soil?.toFixed(1)} + loading={loading} + > + + + + + + v.toFixed(1) + units[name]} + labelFormatter={timeStr => moment(timeStr).tz('America/Edmonton').format('ddd MMM DD h:mm A')} + separator=': ' + /> + + + + + + ); +} + + function Graphs({end, duration}) { const api_key = localStorage.getItem('api_key', false); @@ -1249,6 +1295,7 @@ function Graphs({end, duration}) { + {!!api_key ||