Comments (2)
Say please... I can't give you the exact answer because it requires time and you need to know how to handle the sensors output result. ...but, please find below an example implementation for a node.js 1-wire sensor. A ds18b20 temperature sensor to be exact.
function readTemp(callback){
fs.readFile('/sys/bus/w1/devices/28-00000400a88a/w1_slave', function(err, buffer)
{
if (err){
console.error(err);
process.exit(1);
}
// Read data from file (using fast node ASCII encoding).
var data = buffer.toString('ascii').split(" "); // Split by space
// Extract temperature from string and divide by 1000 to give celsius
var temp = parseFloat(data[data.length-1].split("=")[1])/1000.0;
// Round to one decimal place
temp = Math.round(temp * 10) / 10;
// Add date/time to temperature
var data = {
temperature_record:[{
unix_time: Date.now(),
celsius: temp
}]};
// Execute call back with data
callback(data);
});
};
Hope this helps you on your way. All you need to do is modify the code above and write the socket.io adapters and views. If you're lucky you might find your 1-wire sensors already implemented through the npm. ...also you must run 'sudo mod-probe w1-gpio' and 'sudo mod-probe w1-therm' to enable 1-wire drivers. Sorry I couldn't be of more help.
from heimcontrol.js.
Respect for @Opulence ! Because how maverik23 asks his question is just plain rude, i wouldn't have answered him :) !
from heimcontrol.js.
Related Issues (20)
- Fails to load ds18x20 HOT 1
- Sensors HOT 1
- Supported hardware and protocols? HOT 5
- Output button removal for relay use HOT 7
- RGB Not working
- Error at startup this.board.setup(); undefined is not a function
- Docker Container for Heimkontrolle.js
- Arduino RC Switch - Format for RC codes HOT 7
- Changing arduino digital pin values (high/low) based upon sensor value HOT 1
- Install raspberry pi 2 model d
- Bluetooth LE -> Arduino? IFTTT?
- Multiple errors during install HOT 5
- Automatic Mode
- Presenting a new repo
- Webcam (using streamer) showing black screen HOT 1
- How to run heimcontrol.js on windows system?
- socket.io error on startup (fresh install) HOT 1
- Broken dependencies (aka: is this project still active ?) HOT 1
- Startup heimcontrol.js
- updated URL required
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from heimcontrol.js.