fix thermostat

This commit is contained in:
britea 2020-04-28 10:48:07 +02:00
parent 13f75e986e
commit 0b840e7f8e
2 changed files with 38 additions and 37 deletions

View file

@ -72,6 +72,7 @@ class Light extends Component {
.saveDevice({ ...this.props.stateOrDevice, on }) .saveDevice({ ...this.props.stateOrDevice, on })
.catch((err) => console.error("regular light update error", err)); .catch((err) => console.error("regular light update error", err));
} else { } else {
if (this.props.device.kind === "regularLight") {
this.props this.props
.updateState( .updateState(
{ {
@ -85,6 +86,7 @@ class Light extends Component {
console.log(res); console.log(res);
}); });
} }
}
}; };
getIcon = () => { getIcon = () => {
@ -117,10 +119,15 @@ class Light extends Component {
.saveDevice({ ...this.props.stateOrDevice, intensity }) .saveDevice({ ...this.props.stateOrDevice, intensity })
.catch((err) => console.error("regular light update error", err)); .catch((err) => console.error("regular light update error", err));
} else { } else {
this.props.updateState( console.log("CIAOOOOOOOOO", this.props.stateOrDevice);
this.props
.updateState(
{ id: this.props.stateOrDevice.id, intensity: intensity }, { id: this.props.stateOrDevice.id, intensity: intensity },
this.props.stateOrDevice.kind this.props.stateOrDevice.kind
); )
.then((res) => {
console.log(res, this.props.stateOrDevice.kind);
});
} }
}; };

View file

@ -106,7 +106,7 @@ class NewDevice extends Component {
switch: "New switch", switch: "New switch",
buttonDimmer: "New button dimmer", buttonDimmer: "New button dimmer",
knobDimmer: "New knob dimmer", knobDimmer: "New knob dimmer",
securityCamera: "New security camera" securityCamera: "New security camera",
}; };
if (this.state.deviceName === "") { if (this.state.deviceName === "") {
@ -123,8 +123,8 @@ class NewDevice extends Component {
//break; //break;
//trying to make thermostat work //trying to make thermostat work
case "thermostat": case "thermostat":
data.targetTemperature=0; data.targetTemperature = 0;
data.measuredTemperuature=0; data.measuredTemperature = 0;
break; break;
case "dimmableLight": case "dimmableLight":
data.intensity = 0; data.intensity = 0;
@ -158,14 +158,8 @@ class NewDevice extends Component {
render() { render() {
const deviceOptions = [ const deviceOptions = [
//stuff //stuff
{key:"thermostat", { key: "thermostat", text: "Thermostat", value: "thermostat", image: {} },
text:"Thermostat", { key: "curtains", text: "Curtain", value: "curtains", image: {} },
value:"thermostat",
image:{}},
{key:"curtains",
text:"Curtain",
value:"curtains",
image:{}},
//stuff ends //stuff ends
{ {
key: "light", key: "light",
@ -214,7 +208,7 @@ class NewDevice extends Component {
text: "Security Camera", text: "Security Camera",
value: "securityCamera", value: "securityCamera",
image: { avatar: true, src: "/img/plusMinus.svg" }, image: { avatar: true, src: "/img/plusMinus.svg" },
} },
]; ];
const sensorOptions = [ const sensorOptions = [
{ {