meta data for this page
Differences
This shows you the differences between two versions of the page.
| Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
| homeautomation2017:group3:start [2017/03/10 11:58] – suganmira | homeautomation2017:group3:start [2017/03/11 01:11] (current) – suganmira | ||
|---|---|---|---|
| Line 42: | Line 42: | ||
| ===== Cognitive Prediction (Code Snippet) ===== | ===== Cognitive Prediction (Code Snippet) ===== | ||
| - | + | This is the Predition service code sample to train the neural network model with collected home data | |
| - | ''// | + | < |
| - | // collected home data. | + | |
| var brain = require(' | var brain = require(' | ||
| - | |||
| var fs = require(' | var fs = require(' | ||
| // Training data for temperature, | // Training data for temperature, | ||
| var training_data = JSON.parse(fs.readFileSync(' | var training_data = JSON.parse(fs.readFileSync(' | ||
| + | var net = new brain.NeuralNetwork(); | ||
| - | |||
| - | var net = new brain.NeuralNetwork(); | ||
| // Training the neural network | // Training the neural network | ||
| net.train(training_data); | net.train(training_data); | ||
| Line 60: | Line 56: | ||
| // Predict a switch response based on a temperature and humidity input | // Predict a switch response based on a temperature and humidity input | ||
| var output = net.run([0.22, | var output = net.run([0.22, | ||
| + | </ | ||
| ===== FHEM Definitions (Code Snippet) ===== | ===== FHEM Definitions (Code Snippet) ===== | ||
| - | '' | + | Normal Mode |
| - | define NormalMode notify DoorWindowSensor {if (($EVENT eq " | + | < |
| + | define NormalMode notify DoorWindowSensor { | ||
| + | if (($EVENT eq " | ||
| + | | ||
| + | | ||
| + | else { | ||
| + | fhem "set Switch off" | ||
| + | | ||
| + | | ||
| + | </ | ||
| Shield Mode | Shield Mode | ||
| - | define ShieldMode notify MotionSensor {if (($EVENT eq " | + | < |
| + | define ShieldMode notify MotionSensor { | ||
| + | | ||
| + | | ||
| + | | ||
| + | | ||
| + | </ | ||
| Child Mode | Child Mode | ||
| - | define ChildMode notify DoorWindowSensor {if (($EVENT eq " | + | < |
| + | define ChildMode notify DoorWindowSensor { | ||
| + | if (($EVENT eq " | ||
| + | fhem "set Switch on" | ||
| + | } | ||
| + | else { | ||
| + | fhem "set Switch off" | ||
| + | } | ||
| + | | ||
| + | </ | ||
| Line 128: | Line 148: | ||
| * Code Package : {{ : | * Code Package : {{ : | ||
| * Presentation Slides : {{ : | * Presentation Slides : {{ : | ||
| - | * Report : | + | * Report : {{ : |
| * Energy Analysis : {{ : | * Energy Analysis : {{ : | ||