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 })
.catch((err) => console.error("regular light update error", err));
} else {
if (this.props.device.kind === "regularLight") {
this.props
.updateState(
{
@ -85,6 +86,7 @@ class Light extends Component {
console.log(res);
});
}
}
};
getIcon = () => {
@ -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(
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);
});
}
};

View file

@ -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 === "") {
@ -123,8 +123,8 @@ class NewDevice extends Component {
//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;
@ -158,14 +158,8 @@ class NewDevice extends Component {
render() {
const deviceOptions = [
//stuff
{key:"thermostat",
text:"Thermostat",
value:"thermostat",
image:{}},
{key:"curtains",
text:"Curtain",
value:"curtains",
image:{}},
{ key: "thermostat", text: "Thermostat", value: "thermostat", image: {} },
{ key: "curtains", text: "Curtain", value: "curtains", image: {} },
//stuff ends
{
key: "light",
@ -214,7 +208,7 @@ class NewDevice extends Component {
text: "Security Camera",
value: "securityCamera",
image: { avatar: true, src: "/img/plusMinus.svg" },
}
},
];
const sensorOptions = [
{