Compare commits
No commits in common. "45272a62429d9002f704a22a27885499382e171d" and "34f0444de7e3aca130ec9fab96c27b87516bf06b" have entirely different histories.
45272a6242
...
34f0444de7
|
@ -41,8 +41,7 @@ function useSensor(measurement, name, end, duration) {
|
|||
const get = async() => {
|
||||
setLoading(true);
|
||||
try {
|
||||
const api_key = localStorage.getItem('api_key', 'null');
|
||||
const params = { end: end.unix(), duration: duration.len.toLowerCase(), window: duration.win, api_key: api_key };
|
||||
const params = { end: end.unix(), duration: duration.len.toLowerCase(), window: duration.win };
|
||||
const res = await axios.get(
|
||||
'https://sensors-api.dns.t0.vc/history/'+measurement+'/'+name,
|
||||
{ params: params },
|
||||
|
@ -369,67 +368,6 @@ function BedroomTemperature({end, duration}) {
|
|||
);
|
||||
}
|
||||
|
||||
function BasementTemperature({end, duration}) {
|
||||
const [data, loading, tickFormatter] = useSensor('temperature', 'Basement', end, duration);
|
||||
|
||||
return (
|
||||
<ChartContainer
|
||||
name='Basement Temperature'
|
||||
data={data}
|
||||
lastFormatter={(x) => x.temperature_C?.toFixed(1) + ' °C'}
|
||||
loading={loading}
|
||||
>
|
||||
<XAxis
|
||||
dataKey='time'
|
||||
minTickGap={10}
|
||||
tickFormatter={tickFormatter}
|
||||
/>
|
||||
|
||||
<YAxis
|
||||
yAxisId='right'
|
||||
domain={[0, 100]}
|
||||
orientation='right'
|
||||
hide={true}
|
||||
/>
|
||||
<YAxis
|
||||
yAxisId='left'
|
||||
domain={[-40, 40]}
|
||||
/>
|
||||
|
||||
<CartesianGrid strokeDasharray='3 3'/>
|
||||
<Tooltip
|
||||
formatter={(v, name) => v.toFixed(1) + units[name]}
|
||||
labelFormatter={timeStr => moment(timeStr).tz('America/Edmonton').format('ddd MMM DD h:mm A')}
|
||||
separator=': '
|
||||
/>
|
||||
|
||||
<ReferenceLine yAxisId='left' x={moment().tz('America/Edmonton').startOf('day').toISOString().replace('.000', '')} stroke='blue' />
|
||||
|
||||
<Line
|
||||
type='monotone'
|
||||
dataKey='temperature_C'
|
||||
yAxisId='left'
|
||||
name='Temperature'
|
||||
stroke='black'
|
||||
strokeWidth={2}
|
||||
dot={false}
|
||||
isAnimationActive={false}
|
||||
/>
|
||||
|
||||
<Line
|
||||
type='monotone'
|
||||
dataKey='humidity'
|
||||
yAxisId='right'
|
||||
name='Humidity'
|
||||
stroke='blue'
|
||||
strokeWidth={2}
|
||||
dot={false}
|
||||
isAnimationActive={false}
|
||||
/>
|
||||
</ChartContainer>
|
||||
);
|
||||
}
|
||||
|
||||
function MiscTemperature({end, duration}) {
|
||||
const [data, loading, tickFormatter] = useSensor('temperature', 'Misc', end, duration);
|
||||
|
||||
|
@ -955,14 +893,6 @@ function LivingRoomLux({end, duration}) {
|
|||
|
||||
|
||||
function Graphs({end, duration}) {
|
||||
const api_key = localStorage.getItem('api_key', false);
|
||||
|
||||
const handleSubmit = (e) => {
|
||||
e.preventDefault();
|
||||
const api_key = e.target[0].value;
|
||||
localStorage.setItem('api_key', api_key);
|
||||
}
|
||||
|
||||
return (
|
||||
<div className='container'>
|
||||
<SolarPower end={end} duration={duration} />
|
||||
|
@ -973,22 +903,11 @@ function Graphs({end, duration}) {
|
|||
<NookTemperature end={end} duration={duration} />
|
||||
<SeedsTemperature end={end} duration={duration} />
|
||||
<MiscTemperature end={end} duration={duration} />
|
||||
<BasementTemperature end={end} duration={duration} />
|
||||
<Thermostat end={end} duration={duration} />
|
||||
<Gas end={end} duration={duration} />
|
||||
<Water end={end} duration={duration} />
|
||||
<BedroomSleep end={end} duration={duration} />
|
||||
<LivingRoomLux end={end} duration={duration} />
|
||||
|
||||
{!!api_key ||
|
||||
<div>
|
||||
<form onSubmit={handleSubmit}>
|
||||
<p>
|
||||
<input placeholder='API key' />
|
||||
</p>
|
||||
</form>
|
||||
</div>
|
||||
}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
|
7507
client/yarn.lock
7507
client/yarn.lock
File diff suppressed because it is too large
Load Diff
|
@ -1,11 +1,10 @@
|
|||
import time
|
||||
import traceback
|
||||
|
||||
from selenium import webdriver
|
||||
from selenium.webdriver.chrome.options import Options
|
||||
from selenium.webdriver.common.by import By
|
||||
from selenium.webdriver.chrome.service import Service
|
||||
from selenium.common.exceptions import NoSuchElementException, WebDriverException
|
||||
from selenium.common.exceptions import NoSuchElementException
|
||||
from webdriver_manager.chrome import ChromeDriverManager
|
||||
import undetected_chromedriver as uc
|
||||
|
||||
|
@ -18,22 +17,7 @@ chrome_options.add_argument('--headless')
|
|||
chrome_options.add_argument('start-maximized')
|
||||
chrome_options.add_argument('--no-sandbox')
|
||||
|
||||
|
||||
try:
|
||||
driver = uc.Chrome(service=ser, options=chrome_options)
|
||||
except WebDriverException as e:
|
||||
print('Wrong chrome driver version, extracting correct version...')
|
||||
tb = traceback.format_exc()
|
||||
version_string = tb.split('Current browser version is ')[1]
|
||||
major_version = version_string.split('.')[0]
|
||||
print('Trying version:', major_version)
|
||||
|
||||
chrome_options = uc.ChromeOptions()
|
||||
chrome_options.add_argument('--headless')
|
||||
chrome_options.add_argument('start-maximized')
|
||||
chrome_options.add_argument('--no-sandbox')
|
||||
driver = uc.Chrome(service=ser, options=chrome_options, version_main=int(major_version))
|
||||
|
||||
driver = uc.Chrome(service=ser, options=chrome_options, version_main=116)
|
||||
|
||||
try:
|
||||
driver.get('https://sensors.dns.t0.vc')
|
||||
|
@ -47,8 +31,7 @@ try:
|
|||
'Outside_Temperature',
|
||||
'Bedroom_Temperature',
|
||||
'Nook_Temperature',
|
||||
#'Misc_Temperature',
|
||||
'Basement_Temperature',
|
||||
'Misc_Temperature',
|
||||
'Nook_Thermostat',
|
||||
'Gas_Usage',
|
||||
'Water_Usage',
|
||||
|
|
|
@ -8,8 +8,9 @@ body {
|
|||
|
||||
.container {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
flex-wrap: wrap;
|
||||
justify-content: center;
|
||||
margin-bottom: 3rem;
|
||||
}
|
||||
|
||||
.chart {
|
||||
|
|
|
@ -11,13 +11,14 @@ import 'leaflet/dist/leaflet.css';
|
|||
let tzcache = {};
|
||||
|
||||
const durations = [
|
||||
{id: 0, len: 'Day', win: '1m', full: '1 min', delta: [1, 'days'], format: 'HH'},
|
||||
{id: 1, len: 'Week', win: '3m', full: '3 min', delta: [7, 'days'], format: 'HH'},
|
||||
{id: 2, len: 'Week', win: '10m', full: '10 min', delta: [7, 'days'], format: 'HH'},
|
||||
{id: 3, len: 'Month', win: '10m', full: '10 min', delta: [1, 'months'], format: 'D'},
|
||||
{id: 4, len: 'Month', win: '1h', full: '1 hour', delta: [1, 'months'], format: 'D'},
|
||||
{id: 5, len: 'Year', win: '2h', full: '2 hours', delta: [1, 'years'], format: 'M/D'},
|
||||
{id: 0, len: 'Day', win: '10m', full: '10 min', delta: [1, 'days'], format: 'HH'},
|
||||
{id: 1, len: 'Day', win: '1h', full: '1 hour', delta: [1, 'days'], format: 'HH'},
|
||||
{id: 2, len: 'Week', win: '1h', full: '1 hour', delta: [7, 'days'], format: 'HH'},
|
||||
{id: 3, len: 'Week', win: '1d', full: '1 day', delta: [7, 'days'], format: 'D'},
|
||||
{id: 4, len: 'Month', win: '1d', full: '1 day', delta: [1, 'months'], format: 'D'},
|
||||
{id: 5, len: 'Month', win: '7d', full: '7 day', delta: [1, 'months'], format: 'D'},
|
||||
{id: 6, len: 'Year', win: '1d', full: '1 day', delta: [1, 'years'], format: 'M/D'},
|
||||
{id: 7, len: 'Year', win: '30d', full: '30 day', delta: [1, 'years'], format: 'M'},
|
||||
];
|
||||
|
||||
const units = {
|
||||
|
@ -68,12 +69,6 @@ function Owntracks({end, duration}) {
|
|||
|
||||
const coords = data.length ? data.map(({ lat, lon }) => [lat, lon]).filter(([lat, lon]) => lat !== null || lon !== null) : [];
|
||||
|
||||
const handleSubmit = (e) => {
|
||||
e.preventDefault();
|
||||
const api_key = e.target[0].value;
|
||||
localStorage.setItem('api_key', api_key);
|
||||
}
|
||||
|
||||
return (
|
||||
<>
|
||||
{loading ?
|
||||
|
@ -83,19 +78,12 @@ function Owntracks({end, duration}) {
|
|||
<MapContainer center={coords[coords.length-1]} zoom={13} scrollWheelZoom={true} style={{ width: '100%', height: 'calc(100vh - 2.5rem)' }}>
|
||||
<TileLayer
|
||||
attribution='© <a href="https://www.openstreetmap.org/copyright">OpenStreetMap</a> contributors'
|
||||
url='https://maptiles.p.rapidapi.com/en/map/v1/{z}/{x}/{y}.png?rapidapi-key=4375b0b1d8msh0c9e7fa3efb9adfp1769dfjsnd603a0387fea'
|
||||
url="https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png"
|
||||
/>
|
||||
<Polyline pathOptions={{color: 'blue'}} positions={coords} />
|
||||
</MapContainer>
|
||||
:
|
||||
<>
|
||||
<p>No data</p>
|
||||
<form onSubmit={handleSubmit}>
|
||||
<p>
|
||||
<input placeholder='API key' />
|
||||
</p>
|
||||
</form>
|
||||
</>
|
||||
<p>No coords</p>
|
||||
}
|
||||
</>
|
||||
);
|
||||
|
|
Loading…
Reference in New Issue
Block a user