суббота, 2 января 2016 г.

Smart Home on Raspberry PI 2



1. Install Debian using Noobs
The default login for Raspbian is username pi with the password raspberry.
2. Install VNC Server from https://www.raspberrypi.org/documentation/remote-access/vnc/
3. Install Openhab using instruction from https://github.com/openhab/openhab/wiki/Linux---OS-X

Install following Bindings:
sudo apt-get install openhab-addon-persistence-rrd4j
sudo apt-get install openhab-addon-persistence-logging
sudo apt-get install openhab-addon-persistence-exec 
sudo apt-get install openhab-addon-binding-z-wave 
sudo apt-get install openhab-addon-binding-mqtt 
sudo apt-get install openhab-addon-binding-http 
sudo apt-get install openhab-addon-binding-ntp
sudo apt-get install openhab-addon-binding-weather
 
Change time zone to Berlin 
sudo dpkg-reconfigure tzdata 

To autostart on reboot use Init based on systemd
sudo systemctl daemon-reload
sudo systemctl enable openhab 
 

File locations

  • service configuration /etc/default/openhab
  • site configuration /etc/openhab
  • log files /var/log/openhab
  • userdata like rrd4j databases /var/lib/openhab
  • openHAB engine, addons and /webapps folder /usr/share/openhab
  • Node RED USer Dierctory /home/pi/.node-red
4. Install HABMIN (use updated path to OH above)
 
cd /usr/share/openhab 
sudo wget https://github.com/cdjackson/HABmin/releases/download/0.1.3-snapshot/habmin.zip
sudo unzip habmin.zip
sudo rm habmin.zip
sudo rm addons/org.openhab.binding.zwave-1.5.0-SNAPSHOT.jar
 
HABMIN Path: 
http://raspberry_IP:8080/habmin/ 
 
5. Configure SMB to access configuration and log files
http://raspberrypihq.com/how-to-share-a-folder-with-a-windows-computer-from-a-raspberry-pi/

sudo nano /etc/samba/smb.conf - append at the end
[OpenHAB]
 comment=OpenHAB Folder share
 path= /usr/share/openhab
 browseable=Yes
 writeable=Yes
 only guest=no
 create mask=0777
 directory mask=0777
 public=no

[Openhab_Configuration]
 comment=OpenHAB Config
 path= /etc/openhab
 browseable=Yes
 writeable=Yes
 only guest=no
 create mask=0777
 directory mask=0777
 public=no

[Openhab_Logs]
 comment=OpenHAB Logs
 path= /var/log/openhab
 browseable=Yes
 writeable=Yes
 only guest=no
 create mask=0777
 directory mask=0777
 public=no
 
[Mosquitto_Logs]
 comment=Mosquitto Logs
 path= /var/log/mosquitto
 browseable=Yes
 writeable=Yes
 only guest=no
 create mask=0777
 directory mask=0777
 public=no 
 
 
6. Z-wave binding
sudo usermod -a -G dialout openhab
Usb Stick port - dev/ttyACM0 



8. Install my.openhab
https://klenzel.de/3687 
 
9. Set Date and Time
apt-get purge ntp
apt-get install openntpd
Next I append -s at the DAEMON_OPTS at /etc/default/openntpd
DAEMON_OPTS="-f /etc/openntpd/ntpd.conf -s"
systemctl enable openntpd.service 
systemctl start openntpd.service 
If starting the ‘openntpd’ service does not help, then try this.
ntpd -s -d 
ntpdate -s ntp.obspm.fr
     

Commands:

sudo /etc/init.d/openhab start 
sudo /etc/init.d/openhab stop 
sudo /etc/init.d/openhab status
 
systemctl status homebridge -l
systemctl start homebridge 
 
tail -f /var/log/openhab/openhab.log
tail -f /var/log/openhab/events.log
mosquitto_pub -t /myhome/command/Temperature_Setpoint/state -m 18
mosquitto_sub -v -t /#
mosquitto_sub -v -t /# | xargs -d$'\n' -L1 sh -c 'date "+%D %T.%3N $0"' 

 
Finally, stock Android does have a hidden setting to keep the screen on indefinitely, but only while charging. You need to activate Developer 
Mode first (tap the Build number entry in the About phone menu in Settings seven times) and then choose Developer options from the Settings menu. Choose Stay awake and as long as your phone or tablet is plugged in, the screen won't go to sleep after a certain period of time.
 
 
Remove SWAP
https://tino.cc/2016/05/07/raspbian-ueber-nfs-netzwerk-share-booten/
 
sudo dphys-swapfile swapoff

sudo systemctl disable dphys-swapfile

sudo update-rc.d dphys-swapfile remove

sudo apt-get purge dphys-swapfile

sudo rm /var/swap 




Комментариев нет:

Отправить комментарий