pimatic-mysensors controller plugin
-
Created controller plugin for pimatic https://github.com/DheerajKhajuria/pimatic-MySensors
pimatic is a home automation framework that runs on node.js. It provides a common extensible platform for home control and automation tasks.
Uniform interface
It defines several schemata for different home devices and sensors, so that all devices can be controlled uniform and are presented in a common interface.
Automation by rules
Automation tasks can be defined by rules in the form of "if this then that", where the "this" and the "that" part can be fully custemized by plugins. See the rule page for more details.
Web-based interface
The mobile frontend plugin provides a nice web frontend with a sensor overview, device control and rule definition. The web interface is build using express and jQuery Mobile.
Extensible
pimatic is extensible by various plugins adding features and integrating existing hardware and software.
web based Interface

Flexible home Automation Rules

Graphs

Steps to install pimatic
Now I would say let's begin with setting up Pimatic from scratch :
You can either check the instructions on the Pimatic website http://www.pimatic.org/guide/getting-started/ or follow these steps.
If you are using a Raspberry Pi, get the latest Wheezy Image or what ever you like from here : http://downloads.raspberrypi.org
Then write this image with this tool Win32DiskImager to your SD-Card.
Now set up your Pi with sudo raspi-config and do the usual updates with
sudo apt-get update
sudo apt-get upgrade
sudo rpi-updateYou're ready to install Pimatic :) Go ahead with the following 19 steps :
1.) wget http://nodejs.org/dist/v0.10.24/node-v0.10.24-linux-arm-pi.tar.gz -P /tmp
2.) cd /usr/local
3.) sudo tar xzvf /tmp/node-v0.10.24-linux-arm-pi.tar.gz --strip=1
4.) sudo apt-get install build-essential
5.) mkdir /home/pi/pimatic-app
6.) cd /home/pi/
7.) npm install pimatic --prefix pimatic-app --production
8.) cd pimatic-app
9.) cp node_modules/pimatic/config_default.json config.json
10.) sudo nano /home/pi/pimatic-app/config.json (very important :insert admin password!!! otherwise pimatic won't start and comes up with an error message)11.) sudo chmod 777 /home/pi/pimatic-app/
12.) sudo reboot
13.) cd ./pimatic-app/node_modules/pimatic
14.) sudo npm link
15.) wget https://raw.github.com/pimatic/pimatic/master/install/pimatic-init-d
16.) sudo cp pimatic-init-d /etc/init.d/pimatic
17.) sudo chmod +x /etc/init.d/pimatic
18.) sudo chown root:root /etc/init.d/pimatic
19.) sudo update-rc.d pimatic defaultsNow you are ready to start pimatic for the first time!
There are three ways to start pimatic generally.Automatically at system start (since we daemonized Pimatic with the entries in init-d)
With the command sudo service pimatic start (will run Pimatic as daemon / service in the background)
With the command sudo pimatic.js (can be executed everywhere, since we globalized it)
For the first start i recommend to use option 3 since Pimatic will do some compiling and setting up things. this may take a while, so you are able to watch the debug outputs on the console screen and see what Pimatic is doing actually.
If you run sudo "service pimatic start" you won't get any debug messages since Pimatic will run in the background.When Pimatic is through with all the setup stuff, you will see a message like that :
Now you can access the Pimatic gui via browser by entering the IP of your pi and go ahead with the further setup = > Step 2 - GUI overview
For pimatic plugins : http://pimatic.org/pages/plugins/
Support following pimatic-mysensors sensors
-
Temperature and Humidity ( http://mysensors.org/build/humidity)
-
Temperature and Pressure ( http://mysensors.org/build/pressure)
-
Motion ( http://mysensors.org/build/motion )
-
Relay-Actuator ( http://www.mysensors.org/build/relay )
-
|TimeAware Sensor support ( Unix time seconds )
-
Binary buttom ( http://www.mysensors.org/build/binary )
-
Battery level of sensors
-
PulseMeter ( experimental only support wattage )
-
Light Sensor
-
-
Great work @Dheeraj!
@bjornhallberg
Please update your overview thread. -
@hek @bjornhallberg
added support for relay-actuator module :)Module supported..
Temperature and Humidity ( http://mysensors.org/build/humidity)
motion ( http://mysensors.org/build/motion )
Relay-Actuator ( http://www.mysensors.org/build/relay ) -
I can´t make mysensors plugin works in pimatic. I added this lines at plugins session of config.json with no sucess:
{
"plugin": "MySensors",
"driver": "serialport",
"protocols": "1.4.1",
"driverOptions": {
"serialDevice": "/dev/ttyUSB0", # #'/dev/ttyUSBx' if using serial Gateway
"baudrate": 115200
}
}I received error messages like syntax error.
-
I can´t make mysensors plugin works in pimatic. I added this lines at plugins session of config.json with no sucess:
{
"plugin": "MySensors",
"driver": "serialport",
"protocols": "1.4.1",
"driverOptions": {
"serialDevice": "/dev/ttyUSB0", # #'/dev/ttyUSBx' if using serial Gateway
"baudrate": 115200
}
}I received error messages like syntax error.
-
@Dheeraj said:
@ricardot said:
let me the exact error msg.
15:16:12.055 [pimatic] Starting pimatic version 0.8.45
15:16:15.227 [pimatic] Startup error: Error: Parse error on line 80:
15:16:15.227 [pimatic]>..."/dev/ttyUSB0", "#" "#""/dev/ttyUSBx" "i
15:16:15.227 [pimatic]>-----------------------^
15:16:15.227 [pimatic]>Expecting 'EOF', '}', ':', ',', ']', got 'STRING'
15:16:15.227 [pimatic]> at Object.parseError (/usr/local/pimatic-app/node_modules/pimatic/node_modules/cjson/node_modules/jsonlint/lib/jsonlint.js:55:11)
15:16:15.227 [pimatic]> at Object.parse (/usr/local/pimatic-app/node_modules/pimatic/node_modules/cjson/node_modules/jsonlint/lib/jsonlint.js:132:22)
15:16:15.227 [pimatic]> at Object.exports.parse (/usr/local/pimatic-app/node_modules/pimatic/node_modules/cjson/node_modules/jsonlint/lib/jsonlint.js:417:53)
15:16:15.227 [pimatic]> at Object.exports.parse (/usr/local/pimatic-app/node_modules/pimatic/node_modules/cjson/index.js:88:28)
15:16:15.227 [pimatic]> at Framework._loadConfig (/usr/local/pimatic-app/framework.coffee:96:24)
15:16:15.227 [pimatic]> at new Framework (/usr/local/pimatic-app/framework.coffee:54:8)
15:16:15.227 [pimatic]> at /usr/local/pimatic-app/startup.coffee:48:21
15:16:15.227 [pimatic]> at tryCatch1 (/usr/local/pimatic-app/node_modules/pimatic/node_modules/bluebird/js/main/util.js:43:21)
15:16:15.227 [pimatic]> at Function.Promise$_Try (/usr/local/pimatic-app/node_modules/pimatic/node_modules/bluebird/js/main/promise.js:233:11)
15:16:15.227 [pimatic]> at Object.module.exports.startup (/usr/local/pimatic-app/startup.coffee:47:10)
15:16:15.227 [pimatic]> at run (/usr/local/pimatic-app/node_modules/pimatic/pimatic.js:15:24)
15:16:15.227 [pimatic]> at Object.<anonymous> (/usr/local/pimatic-app/node_modules/pimatic/pimatic.js:20:3)
15:16:15.227 [pimatic]> at Module._compile (module.js:456:26)
15:16:15.227 [pimatic]> at Object.Module._extensions..js (module.js:474:10)
15:16:15.227 [pimatic]> at Module.load (module.js:356:32)
15:16:15.227 [pimatic]> at Function.Module._load (module.js:312:12)
15:16:15.227 [pimatic]> at Function.Module.runMain (module.js:497:10)
15:16:15.227 [pimatic]> at startup (node.js:119:16)
15:16:15.227 [pimatic]> at node.js:902:3
15:16:15.274 [pimatic] exiting... -
I removed the # #'/dev/ttyUSBx' if using serial Gateway
So I got this:
15:17:54.005 [pimatic] Starting pimatic version 0.8.45
15:17:58.403 [pimatic] loading plugin: "pimatic-cron" (0.8.5)
15:18:00.793 [pimatic] loading plugin: "pimatic-mobile-frontend" (0.8.44)
15:18:05.848 [pimatic] loading plugin: "pimatic-mail" (0.8.2)
15:18:08.301 [pimatic] Installing: "MySensors"
15:18:16.958 [pimatic, npm] http GET https://registry.npmjs.org/pimatic-MySensors
15:18:18.741 [pimatic, npm] http 404 https://registry.npmjs.org/pimatic-MySensors
15:18:18.848 [pimatic, npm] ERR! 404 'pimatic-MySensors' is not in the npm registry.
15:18:18.872 [pimatic, npm] ERR! 404 You should bug the author to publish it
15:18:18.896 [pimatic, npm] ERR! 404
15:18:18.914 [pimatic, npm] ERR! 404 Note that you can also install from a
15:18:18.955 [pimatic, npm] ERR! 404 tarball, folder, or http url, or git url.
15:18:18.964 [pimatic, npm] ERR! System Linux 3.12.28+
15:18:18.986 [pimatic, npm] ERR! command "/usr/local/bin/node" "/usr/local/bin/npm" "install" "pimatic-MySensors"
15:18:19.005 [pimatic, npm] ERR! cwd /usr/local/pimatic-app
15:18:19.025 [pimatic, npm] ERR! node -v v0.10.24
15:18:19.034 [pimatic, npm] ERR! npm -v 1.3.21
15:18:19.056 [pimatic, npm] ERR! code E404
15:18:19.161 [pimatic, npm] ERR!
15:18:19.192 [pimatic, npm] ERR! Additional logging details can be found in:
15:18:19.205 [pimatic, npm] ERR! /usr/local/pimatic-app/npm-debug.log
15:18:19.213 [pimatic, npm] ERR! not ok code 0
15:18:19.312 [pimatic] Error running "npm install pimatic-MySensors"
15:18:20.192 [pimatic-cron] the time is: Mon Feb 16 2015 15:18:20 GMT+0000 (UTC)
15:18:20.996 [pimatic-mobile-frontend] packing static assets
15:18:22.251 [pimatic-mobile-frontend] packing static assets finished
15:18:22.273 [pimatic-mobile-frontend] rendering html
15:18:44.851 [pimatic-mobile-frontend] rendering html finished
15:18:44.989 [pimatic] listening for http-request on port 80... -
Since i haven't register mysensors with npm. that's the reason it is giving you the error. As a work around try download & manually installing pimatic-MySensors in node_module in pimatic-app folder.. Here other plugins are also installed like Pimatic-mobile-fontend etc.. Pimatic should be able to pick it up..
I will try to fix this issue meanwhile.Let me know if it's works.
-
I manually installed the pimatic-mysensors, seems it works, but I'm receiving this message:
13:46:47.360 [pimatic] Cannot find module 'bluebird'
Later I added two devices, a PIR and a relay-switch, and I'm receiving this message:
13:46:49.289 [pimatic] no plugin found for device "Switch" of class "MySensorsSwitch"!
13:46:49.305 [pimatic] no plugin found for device "PIR" of class "MySensorsPIR"! -
I manually installed the pimatic-mysensors, seems it works, but I'm receiving this message:
13:46:47.360 [pimatic] Cannot find module 'bluebird'
Later I added two devices, a PIR and a relay-switch, and I'm receiving this message:
13:46:49.289 [pimatic] no plugin found for device "Switch" of class "MySensorsSwitch"!
13:46:49.305 [pimatic] no plugin found for device "PIR" of class "MySensorsPIR"!@ricardot said:
atic] Cannot find module 'bluebird'
Later I added two devices, a PIR and a relay-switch, and I'm receiving this message:
13:46:49.289 [pimatic] no plugin found for device "Switch" of class "MySensorsSwitch"!
13:46:49.305 [pimatic] no plugin found for device "PIR" ofgive me sometime will fix this issue.
-
I can´t make mysensors plugin works in pimatic. I added this lines at plugins session of config.json with no sucess:
{
"plugin": "MySensors",
"driver": "serialport",
"protocols": "1.4.1",
"driverOptions": {
"serialDevice": "/dev/ttyUSB0", # #'/dev/ttyUSBx' if using serial Gateway
"baudrate": 115200
}
}I received error messages like syntax error.
-
I have fixed the issues, plugin published to public npm registry . now i think it should work perfectly
-
Dheeraj,
When we can expect more variables available to mysensors plugin? I miss a simple on off switch.
Thanks!
-
This is my first try at getting MySensors to work.
I've connected a SerialGateway to the Pi, and configured a DHT22 sensor. But no values are recorded.
Logs from the pi:
<- I_LOG_MESSAGE 0;0;3;0;9;read: 255-255-0 s=255,c=3,t=3,pt=0,l=0:
<- I_ID_REQUEST 255;255;3;0;3;
<- I_LOG_MESSAGE 0;0;3;0;9;read: 255-255-0 s=255,c=3,t=3,pt=0,l=0:
<- I_ID_REQUEST 255;255;3;0;3;Serial output from the sensor:
req node id
send: 255-255-0-0 s=255,c=3,t=3,pt=0,l=0,st=ok:
T: 22.70
req node id
send: 255-255-0-0 s=255,c=3,t=3,pt=0,l=0,st=ok:
H: 31.10
req node id
send: 255-255-0-0 s=255,c=3,t=3,pt=0,l=0,st=ok:
H: 31.00What can I be doing wrong? Seems like the sensor is requesting a node ID but not getting any?
Thank you for any kind of response!
Regards, Martin
-
This is my first try at getting MySensors to work.
I've connected a SerialGateway to the Pi, and configured a DHT22 sensor. But no values are recorded.
Logs from the pi:
<- I_LOG_MESSAGE 0;0;3;0;9;read: 255-255-0 s=255,c=3,t=3,pt=0,l=0:
<- I_ID_REQUEST 255;255;3;0;3;
<- I_LOG_MESSAGE 0;0;3;0;9;read: 255-255-0 s=255,c=3,t=3,pt=0,l=0:
<- I_ID_REQUEST 255;255;3;0;3;Serial output from the sensor:
req node id
send: 255-255-0-0 s=255,c=3,t=3,pt=0,l=0,st=ok:
T: 22.70
req node id
send: 255-255-0-0 s=255,c=3,t=3,pt=0,l=0,st=ok:
H: 31.10
req node id
send: 255-255-0-0 s=255,c=3,t=3,pt=0,l=0,st=ok:
H: 31.00What can I be doing wrong? Seems like the sensor is requesting a node ID but not getting any?
Thank you for any kind of response!
Regards, Martin
Currently mysensors plugin only support static node id. Try configuring static node id in sensor code. Hint.. Gw. Begin (null, node id)
Let me know if it's works
-
hey,
I really like your plugin now that I finally managed to get everything working. :)
But I would also like to use a BH1750 Light sensor with your plugin. I made a sensorbox with PIR to switch on lights for a minute when movement is detected, but I only want to switch on light when it's dark enough. Is it planned to add support for this?