Add SmartHome and relevant config
This commit is contained in:
parent
031c1ede21
commit
4bdcd49e1f
|
@ -16,7 +16,7 @@ function Core() {
|
||||||
data: coreState.data,
|
data: coreState.data,
|
||||||
close: () => dispatch(setPlugin(false))
|
close: () => dispatch(setPlugin(false))
|
||||||
};
|
};
|
||||||
const dummyButtons = ["Maps", "Home Devices", "Phone"];
|
const dummyButtons = ["Maps", "Phone"];
|
||||||
return <>
|
return <>
|
||||||
<Box height="5vh" background="light-1" justify="center" direction="row">
|
<Box height="5vh" background="light-1" justify="center" direction="row">
|
||||||
{voiceState.recording ? <VoiceBars style={{height: "100%"}}/>:
|
{voiceState.recording ? <VoiceBars style={{height: "100%"}}/>:
|
||||||
|
@ -39,6 +39,8 @@ function Core() {
|
||||||
<Box direction="row" margin="1.5em" wrap={true}>
|
<Box direction="row" margin="1.5em" wrap={true}>
|
||||||
<Button onClick={() => dispatch(setPlugin("petMode"))} primary
|
<Button onClick={() => dispatch(setPlugin("petMode"))} primary
|
||||||
label="Pet Mode" />
|
label="Pet Mode" />
|
||||||
|
<Button onClick={() => dispatch(setPlugin("smartHome"))} primary
|
||||||
|
label="Smart Home" margin="0 0 0 1em" />
|
||||||
{dummyButtons.map(i =>
|
{dummyButtons.map(i =>
|
||||||
<Button primary label={i} key={i} margin="0 0 0 1em" />
|
<Button primary label={i} key={i} margin="0 0 0 1em" />
|
||||||
)}
|
)}
|
||||||
|
|
|
@ -0,0 +1,37 @@
|
||||||
|
import React, {useState, useEffect} from "react";
|
||||||
|
import PropTypes from "prop-types";
|
||||||
|
import { Box, Button } from "grommet";
|
||||||
|
|
||||||
|
import { CAMERA_URL } from "../config";
|
||||||
|
|
||||||
|
function SmartHome(props) {
|
||||||
|
const [ idx, setIdx ] = useState(0);
|
||||||
|
useEffect(() => {
|
||||||
|
const id = setInterval(() => setIdx(i => i + 1), 20);
|
||||||
|
return () => clearInterval(id);
|
||||||
|
}, []);
|
||||||
|
return (
|
||||||
|
<Box
|
||||||
|
align="center"
|
||||||
|
background="light-1"
|
||||||
|
width="100vw"
|
||||||
|
justify="center"
|
||||||
|
direction="column"
|
||||||
|
alignContent="center"
|
||||||
|
height="95vh"
|
||||||
|
>
|
||||||
|
<img src={`${CAMERA_URL}?id=${idx}`} />
|
||||||
|
<Button primary size="large" onClick={props.close}
|
||||||
|
label="Dismiss" margin="1.5em" />
|
||||||
|
</Box>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
SmartHome.propTypes = {
|
||||||
|
data: PropTypes.object,
|
||||||
|
close: PropTypes.func
|
||||||
|
};
|
||||||
|
|
||||||
|
SmartHome.pluginName = "Smart Home";
|
||||||
|
|
||||||
|
export default SmartHome;
|
|
@ -3,6 +3,7 @@ import Manual from "./Manual";
|
||||||
import Temperature from "./Temperature";
|
import Temperature from "./Temperature";
|
||||||
import Accident from "./Accident";
|
import Accident from "./Accident";
|
||||||
import PetMode from "./PetMode";
|
import PetMode from "./PetMode";
|
||||||
|
import SmartHome from "./SmartHome";
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
warning: Warning,
|
warning: Warning,
|
||||||
|
@ -10,4 +11,5 @@ export default {
|
||||||
temperature: Temperature,
|
temperature: Temperature,
|
||||||
accident: Accident,
|
accident: Accident,
|
||||||
petMode: PetMode,
|
petMode: PetMode,
|
||||||
|
smartHome: SmartHome,
|
||||||
};
|
};
|
||||||
|
|
|
@ -2,5 +2,6 @@ const WS_BASE = "http://localhost:5050/";
|
||||||
const TG_API = "xxxxxxxxx:xxxxxxxxxxxxxxxxxxxxxx";
|
const TG_API = "xxxxxxxxx:xxxxxxxxxxxxxxxxxxxxxx";
|
||||||
const TG_USERID = 123456789;
|
const TG_USERID = 123456789;
|
||||||
const CAR_API = "http://localhost:5000/";
|
const CAR_API = "http://localhost:5000/";
|
||||||
|
const CAMERA_URL = "http://path.to/still/image.jpg";
|
||||||
|
|
||||||
export { WS_BASE, TG_API, TG_USERID, CAR_API };
|
export { WS_BASE, TG_API, TG_USERID, CAR_API, CAMERA_URL };
|
||||||
|
|
Loading…
Reference in New Issue