From 49f9ee120ba93e69b827022514be5cb14e621edf Mon Sep 17 00:00:00 2001 From: Tanner Collin Date: Tue, 13 May 2025 19:16:55 +0000 Subject: [PATCH] Add Kitchen and Bedroom air / lux sensors --- .gitignore | 1 + client/src/App.js | 270 ++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 271 insertions(+) diff --git a/.gitignore b/.gitignore index 69fdc0b..81b5bec 100644 --- a/.gitignore +++ b/.gitignore @@ -104,3 +104,4 @@ ENV/ settings.py *.csv +.aider* diff --git a/client/src/App.js b/client/src/App.js index e5817fc..bd2edac 100644 --- a/client/src/App.js +++ b/client/src/App.js @@ -869,6 +869,184 @@ function LivingRoomAir({end, duration}) { ); } +function KitchenAir({end, duration}) { + const [data, loading, tickFormatter] = useSensor('air', 'Kitchen', end, duration); + + return ( + x.max_p10?.toFixed(1) + ' ug/m³'} + loading={loading} + > + + + + + + + + v + units[name]} + labelFormatter={timeStr => moment(timeStr).tz('America/Edmonton').format('ddd MMM DD h:mm A')} + separator=': ' + /> + + + + + + + + + + + + ); +} + +function BedroomAir({end, duration}) { + const [data, loading, tickFormatter] = useSensor('air', 'Bedroom', end, duration); + + return ( + x.max_p10?.toFixed(1) + ' ug/m³'} + loading={loading} + > + + + + + + + + v + units[name]} + labelFormatter={timeStr => moment(timeStr).tz('America/Edmonton').format('ddd MMM DD h:mm A')} + separator=': ' + /> + + + + + + + + + + + + ); +} + function BedroomSleep({end, duration}) { const [data, loading, tickFormatter] = useSensor('sleep', 'Bedroom', end, duration); @@ -953,6 +1131,94 @@ function LivingRoomLux({end, duration}) { ); } +function KitchenLux({end, duration}) { + const [data, loading, tickFormatter] = useSensor('lux', 'Kitchen', end, duration); + + return ( + x.lux?.toFixed(1) + ' lx'} + loading={loading} + > + + + + + + v.toFixed(1) + units[name]} + labelFormatter={timeStr => moment(timeStr).tz('America/Edmonton').format('ddd MMM DD h:mm A')} + separator=': ' + /> + + + + + + ); +} + +function BedroomLux({end, duration}) { + const [data, loading, tickFormatter] = useSensor('lux', 'Bedroom', end, duration); + + return ( + x.lux?.toFixed(1) + ' lx'} + 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); @@ -968,6 +1234,8 @@ function Graphs({end, duration}) { + + @@ -979,6 +1247,8 @@ function Graphs({end, duration}) { + + {!!api_key ||