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:
Andrea Brites Marto 2020-04-28 10:51:07 +02:00
commit 7135ddc588
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 === "") {
@ -124,7 +124,7 @@ class NewDevice extends Component {
//trying to make thermostat work
case "thermostat":
data.targetTemperature = 0;
data.measuredTemperuature=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 = [
{