thing-it-device-enocean-ip
Advanced tools
Comparing version 0.2.11 to 0.2.12
@@ -46,2 +46,5 @@ module.exports = { | ||
id: 'set' | ||
}, { | ||
label: 'Valve Closed', | ||
id: 'valveClosed' | ||
}], | ||
@@ -179,6 +182,2 @@ state: [{ | ||
} | ||
if (body.state.functions[n].key === "temperatureSetpoint") { | ||
this.state.setpoint = setpointConversion(body.state.functions[n].value, this.configuration.temperatureBasePoint, this.configuration.setPointScale); | ||
//console.log(this.state.setpoint); | ||
} | ||
} | ||
@@ -200,5 +199,2 @@ tempDiff = this.state.temperature - this.state.setpoint; | ||
this.publishStateChange(); | ||
if(!this.state.window) { | ||
this.setTemperature(this.state.setpoint, this.state.temperature); | ||
} | ||
console.log(this.state); | ||
@@ -295,5 +291,5 @@ }.bind(this), function (err){ | ||
} | ||
if(!this.state.window) { | ||
this.setTemperature(this.state.setpoint, this.state.temperature); | ||
} | ||
// if(!this.state.window) { | ||
// this.setTemperature(this.state.setpoint, this.state.temperature); | ||
// } | ||
this.publishStateChange(); | ||
@@ -336,2 +332,3 @@ } | ||
this.state = updatedState; | ||
this.publishStateChange(); | ||
this.publishEvent('set', {}); | ||
@@ -355,2 +352,3 @@ }; | ||
HeatingSystem.prototype.setTemperature = function (setPointTemperature, currentTemperature) { | ||
if(setPointTemperature === undefined || currentTemperature === undefined) return; | ||
let deltaTemperature = currentTemperature - setPointTemperature; | ||
@@ -371,2 +369,3 @@ let functions = []; | ||
this.device.adapter.setDeviceState(this.configuration.micropeltDeviceId,[{"key": "valve", "value": 0}]) | ||
this.publishEvent('valveClosed', {}); | ||
} | ||
@@ -381,3 +380,3 @@ | ||
this.state.setpoint = state.setpoint; | ||
if(!this.state.window) { | ||
if(!this.state.window || state.window === false) { | ||
this.setTemperature(this.state.setpoint, this.state.temperature); | ||
@@ -390,6 +389,6 @@ } | ||
this.closeValve(); | ||
// } | ||
// else{ | ||
// this.setTemperature(this.state.setpoint, this.state.temperature); | ||
} | ||
else{ | ||
this.setTemperature(this.state.setpoint, this.state.temperature); | ||
} | ||
} | ||
@@ -480,2 +479,2 @@ } | ||
return string.charAt(0).toUpperCase() + string.slice(1); | ||
} | ||
} |
{ | ||
"name": "thing-it-device-enocean-ip", | ||
"version": "0.2.11", | ||
"version": "0.2.12", | ||
"description": "[thing-it-node] Device Plugin for EnOcean IP products.", | ||
@@ -32,2 +32,2 @@ "authors": "Marc Gille", | ||
} | ||
} | ||
} |
const moment = require('moment') | ||
const express = require('express') | ||
var bodyParser = require('body-parser'); | ||
const app = express() | ||
app.use(bodyParser.json()); | ||
@@ -47,2 +49,17 @@ // 0180CAB7 Vorfuehrung-RWM F6-05-02 | ||
}; | ||
const thermokon = { | ||
configuration: {deviceId: '5'}, | ||
state: { state: {functions: [{key: 'temperature', value: 22}, {key: 'setpoint', value: 22}]} }, | ||
} | ||
const micropelt = { | ||
configuration: {}, | ||
state: { valve: 1, batteryLow: false, actuatorObstructed: false}, | ||
setState(functions) { | ||
console.log('Set setpoint to', functions[1].value); | ||
thermokon.state.state.functions[1].value = functions[1].value; | ||
writeState(thermokon, functions); | ||
} | ||
} | ||
const temperatureSensor = {configuration: {deviceId: '4'}, state: {temperature: 20}}; | ||
@@ -53,3 +70,5 @@ const devices = { | ||
'05065B85': motionSensor, | ||
'4': temperatureSensor | ||
'4': temperatureSensor, | ||
'5': thermokon, | ||
'6': micropelt | ||
}; | ||
@@ -86,7 +105,7 @@ | ||
app.put('/devices/:device/state', (req, res) => { | ||
if (!devices[req.params.deviceId]) { | ||
res.status(500).send('Device [' + req.params.deviceId + '] does not exist.'); | ||
if (!devices[req.params.device]) { | ||
res.status(500).send('Device [' + req.params.device + '] does not exist.'); | ||
} | ||
devices[req.params.deviceId].setState(req.body); | ||
devices[req.params.device].setState(req.body.state.functions); | ||
}); | ||
@@ -93,0 +112,0 @@ |
Sorry, the diff of this file is not supported yet
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
161871
3972
0