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,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);
|
||||||
|
});
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -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 = [
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in a new issue