lördag 26 september 2015

1Wire på Raspberry Pi


NOTE!! Seems to not work on Jessie!

#***************************************************
#**********            INSTALL            **********
#***************************************************

#Install One Wire File System (OWFS)
sudo apt-get install -y owfs

#Create Mount point
sudo mkdir /mnt/1wire

#fuse.conf really needed?
sudo nano /etc/fuse.conf
user_allow_other

#***************************************************
#**********           CONFIGURE           **********
#***************************************************

#Either configure your /etc/owfs.conf with yur favourite text editor (vim/nano) or run below comands for my configuration

#Replace: "server: FAKE = ..." with your device in /etc/owfs.conf, e.g:
sudo sed -i 's/^server\:.*/server: device =\/dev\/ttyUSB0/g' /etc/owfs.conf

#Uncomment mountpoint = /mnt/1wire
sudo sed -i 's/^#mountpoint.*/mountpoint = \/mnt\/1wire/g' /etc/owfs.conf

#Uncomment allow_other
sudo sed -i 's/^#allow_other.*/allow_other/g' /etc/owfs.conf

#Test start
sudo owfs

#Test
ls /mnt/1wire/
cat /mnt/1wire/28.746FE0020000/temperature

#http://pi1:2121/

#***************************************************
#**********            AUTOSTART          **********
#***************************************************
#(only half finished)
 

#Copy autostart skeleton
sudo cp /etc/init.d/skeleton /etc/init.d/switchkingd
sudo sed -i 's/^# Provides: .*/# Provides:          OWFS/g' /etc/init.d/owfs

sudo sed -i 's/^# Short-Description: .*/# Short-Description: OneWireFileSystem service daemon/g' /etc/init.d/
owfs


# Provides:          start1wire
# Required-Start:    $local_fs $syslog
# Required-Stop:     $local_fs $syslog
# Default-Start:     2 3 4 5
# Default-Stop:      0 1 6
# Short-Description: Start OWFS at boot time
# Description:       Start OWFS at boot time
### END INIT INFO

# Starts OWFS
owfs

#

sudo chmod +x /etc/init.d/start1wire.sh

sudo update-rc.d start1wire.sh defaults

#Remove binaries
sudo apt-get remove mysql-server

#Remove config
sudo rm /etc/owfs.conf

#Removemount point
sudo rmdir /mnt/1wire
 

#Source:
#http://wiki.m.nu/index.php/OWFS_p%C3%A5_Rasperry_Pi

fredag 25 september 2015

Install SwitchKing on Raspbery Pi

#***************************************************
#**********         INSTALL               **********
#***************************************************


#install mono
sudo apt-get install -y mono-complete

#Download zipped SwitchKing to tmp
#Latest source can be found here:
#http://www.switchking.se/sv/downloads
sudo wget http://www.switchking.se/sv/downloads?download=91%3Aserver-setup-linux-v3.2.1 -O /tmp/switchking.zip

#Unzip SwitchKing to /bin/switchking
sudo unzip /tmp/switchking.zip -d /bin/switchking/

#Remove zipped SwitchKing from tmp
sudo rm /tmp/switchking.zip

#Untar internal database sudo tar xvf /bin/switchking/Bin/DB/switchKing.server.db3.tar.gz -C /bin/switchking/Bin/DB/

#Change permission on internal database
sudo chmod 777 /bin/switchking/Bin/DB/switchKing.server.db3

#***************************************************
#**********              TEST             **********
#***************************************************


#Start SwitchKing in terminal mode
mono /bin/switchking/Bin/SwitchKing.exe terminal 8080 8800

#Connect to server with SwitchKing Client

#***************************************************
#**********             AUTOSTART         **********
#***************************************************

sudo cp /etc/init.d/skeleton /etc/init.d/switchkingd

sudo sed -i 's/^# Provides: .*/# Provides:          SwitchKing/g' /etc/init.d/switchkingd

sudo sed -i 's/^# Short-Description: .*/# Short-Description: SwitchKing service daemon/g' /etc/init.d/switchkingd 

sudo sed -i 's/^PATH=.*/PATH=\/sbin:\/usr\/sbin:\/bin:\/usr\/bin:\/bin\/switchking\/Bin/g' /etc/init.d/switchkingd

sudo sed -i 's/^DESC=.*/DESC="SwitchKing service daemon"/g' /etc/init.d/switchkingd

sudo sed -i 's/^NAME=.*/NAME=switchkingd/g' /etc/init.d/switchkingd

sudo sed -i 's/^DAEMON=.*/DAEMON=\/usr\/bin\/mono/g' /etc/init.d/switchkingd

sudo sed -i 's/^DAEMON_ARGS=.*/DAEMON_ARGS=" $INSTALLDIR\/$EXENAME daemon 8080 8800 \&"/g' /etc/init.d/switchkingd

sudo sed -i '/^DAEMON_ARGS=.*/i INSTALLDIR=\/bin\/switchking\/Bin' /etc/init.d/switchkingd


sudo sed -i '/^DAEMON_ARGS=.*/i EXENAME=SwitchKing.exe' /etc/init.d/switchkingd

sudo sed -i 's/^PIDFILE=.*/PIDFILE=\/var\/run\/$NAME.pid/g' /etc/init.d/switchkingd


sudo sed -i 's/^SCRIPTNAME=.*/SCRIPTNAME=\/etc\/init.d\/$NAME/g' /etc/init.d/switchkingd

sudo chmod +x /etc/init.d/switchkingd


sudo update-rc.d switchkingd defaults

#***************************************************
#**********          UNINSTALL         **********
#***************************************************

#Remove SwitchKing
sudo rm -R /bin/switchking/

#Remove startup scripts
sudo update-rc.d switchking remove

#Remove startup script
sudo rm /etc/init.d/switchkingd





#Source:
#http://www.danieloldberg.se/?p=33

Install telldusCenter on Raspberry Pi

Not working guide!!!!

## Telldus repository & public key needed first!
## http://it-jocke.blogspot.com/2015/02/tellstick-pa-raspberry-pi.html
## Always make a simple try with just install first. Things go forward!
## sudo apt-get install tellduscenter

#Install  libqt4-dev (neceserry?)
sudo apt-get install -y libqt4-dev

mkdir ~/FTD2XX && cd ~/FTD2XX
wget http://www.ftdichip.com/Drivers/D2XX/Linux/libftd2xx1.1.12.tar.gz
sudo tar xvf libftd2xx1.*.tar.gz
sudo cp ~/FTD2XX/release/build/arm926/lib* /usr/local/lib
sudo chmod 0755 /usr/local/lib/libftd2xx.so.1.1.12


#Create download folder
mkdir ~/telldus-center && cd ~/telldus-center

#Download and compile source
sudo apt-get --compile source tellduscenter

#Remove temporary compile folder
sudo rm -rf telldus-center

sudo cmake .





#Download latest telldus-gui
#http://download.telldus.se/TellStick/Software/telldus-gui/
wget http://download.telldus.se/TellStick/Software/telldus-gui/telldus-gui-2.1.2.tar.gz

#Un-tar
tar -xvf telldus-gui*.tar.gz

cd telldus-gui*

Source:
http://www.danieloldberg.se/?p=33

Usefull unix commands


apt-cache search keyword