Merge branch '87-fix-thermostat' into 'dev'
fix thermostat Closes #87 See merge request sa4-2020/the-sanmarinoes/frontend!102
This commit is contained in:
commit
7135ddc588
2 changed files with 38 additions and 37 deletions
|
@ -72,18 +72,20 @@ class Light extends Component {
|
|||
.saveDevice({ ...this.props.stateOrDevice, on })
|
||||
.catch((err) => console.error("regular light update error", err));
|
||||
} else {
|
||||
this.props
|
||||
.updateState(
|
||||
{
|
||||
id: this.props.stateOrDevice.id,
|
||||
on: on,
|
||||
sceneId: this.props.stateOrDevice.sceneId,
|
||||
},
|
||||
this.props.stateOrDevice.kind
|
||||
)
|
||||
.then((res) => {
|
||||
console.log(res);
|
||||
});
|
||||
if (this.props.device.kind === "regularLight") {
|
||||
this.props
|
||||
.updateState(
|
||||
{
|
||||
id: this.props.stateOrDevice.id,
|
||||
on: on,
|
||||
sceneId: this.props.stateOrDevice.sceneId,
|
||||
},
|
||||
this.props.stateOrDevice.kind
|
||||
)
|
||||
.then((res) => {
|
||||
console.log(res);
|
||||
});
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -117,10 +119,15 @@ class Light extends Component {
|
|||
.saveDevice({ ...this.props.stateOrDevice, intensity })
|
||||
.catch((err) => console.error("regular light update error", err));
|
||||
} else {
|
||||
this.props.updateState(
|
||||
{ id: this.props.stateOrDevice.id, intensity: intensity },
|
||||
this.props.stateOrDevice.kind
|
||||
);
|
||||
console.log("CIAOOOOOOOOO", this.props.stateOrDevice);
|
||||
this.props
|
||||
.updateState(
|
||||
{ id: this.props.stateOrDevice.id, intensity: intensity },
|
||||
this.props.stateOrDevice.kind
|
||||
)
|
||||
.then((res) => {
|
||||
console.log(res, this.props.stateOrDevice.kind);
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
|
|
|
@ -106,7 +106,7 @@ class NewDevice extends Component {
|
|||
switch: "New switch",
|
||||
buttonDimmer: "New button dimmer",
|
||||
knobDimmer: "New knob dimmer",
|
||||
securityCamera: "New security camera"
|
||||
securityCamera: "New security camera",
|
||||
};
|
||||
|
||||
if (this.state.deviceName === "") {
|
||||
|
@ -118,13 +118,13 @@ class NewDevice extends Component {
|
|||
switch (this.state.typeOfDevice) {
|
||||
//trying to make securityCamera work
|
||||
//case "securityCamera":
|
||||
// data.path="/security_camera_videos/security_camera_1.mp4";
|
||||
// data.on=false;
|
||||
//break;
|
||||
// data.path="/security_camera_videos/security_camera_1.mp4";
|
||||
// data.on=false;
|
||||
//break;
|
||||
//trying to make thermostat work
|
||||
case "thermostat":
|
||||
data.targetTemperature=0;
|
||||
data.measuredTemperuature=0;
|
||||
data.targetTemperature = 0;
|
||||
data.measuredTemperature = 0;
|
||||
break;
|
||||
case "dimmableLight":
|
||||
data.intensity = 0;
|
||||
|
@ -157,16 +157,10 @@ class NewDevice extends Component {
|
|||
|
||||
render() {
|
||||
const deviceOptions = [
|
||||
//stuff
|
||||
{key:"thermostat",
|
||||
text:"Thermostat",
|
||||
value:"thermostat",
|
||||
image:{}},
|
||||
{key:"curtains",
|
||||
text:"Curtain",
|
||||
value:"curtains",
|
||||
image:{}},
|
||||
//stuff ends
|
||||
//stuff
|
||||
{ key: "thermostat", text: "Thermostat", value: "thermostat", image: {} },
|
||||
{ key: "curtains", text: "Curtain", value: "curtains", image: {} },
|
||||
//stuff ends
|
||||
{
|
||||
key: "light",
|
||||
text: "Normal Light",
|
||||
|
@ -210,11 +204,11 @@ class NewDevice extends Component {
|
|||
image: { avatar: true, src: "/img/plusMinus.svg" },
|
||||
},
|
||||
{
|
||||
key: "securityCamera",
|
||||
text: "Security Camera",
|
||||
value: "securityCamera",
|
||||
image: { avatar: true, src: "/img/plusMinus.svg" },
|
||||
}
|
||||
key: "securityCamera",
|
||||
text: "Security Camera",
|
||||
value: "securityCamera",
|
||||
image: { avatar: true, src: "/img/plusMinus.svg" },
|
||||
},
|
||||
];
|
||||
const sensorOptions = [
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue