JTK – Notes and Ramblings Things we have found …

2/6/2016

iPhone Locator for Openhab

Filed under: General,Home Automation — taing @ 5:00 pm

This is based on the work by many others.

Firstly, pyicloud – https://github.com/picklepete/pyicloud

For this you need:
sudo apt-get install python-pip
sudo apt-get install python-dev libffi-dev
sudo pip install pyopenssl ndg-httpsclient pyasn1
sudo pip install pyicloud

As the pyicloud documentation mentions, the first time you use this you will get a message from Apple letting you know your iCloud account was accessed.

To test I created location.py :
from pyicloud import PyiCloudService
api = PyiCloudService('myaccount@icloud.com','password')
print(api.devices)
print(api.devices[1])
print(api.devices[1].location())

python location.py

The second part of this is iphone-locator-bridge

I modified this a bit for my specific site. The includes changing the openhab items defined, passing back the actual longitude/latitude and distance and only running on demand.

I found the POST syntax in the original was giving me issues so I converted to the GET syntax:
url = '%s/CMD?%s=%s' % (gConfigurationOH['ohserver'], gConfigurationOH['ohitemdist'], dist)

It was necessary to add complete path info for the log file and the config file in roder for these to be found correctly when the script is called by an Openhab executeCommandLine().

The iPhone and home locations are then plotted on Google Maps using the info found at https://github.com/openhab/openhab/wiki/GoogleMap.

6/20/2015

MythTV mythlink.pl

Filed under: General,MythTV — taing @ 12:38 pm

mythlink.pl replaces the old functionality of mythrename.pl. It is far more useful once setup.

See https://www.mythtv.org/wiki/Mythlink.pl for the details.

For me this meant creating a folder as a peer to /var/lib/mythtv/recordings. My choice was /var/lib/mythtv/show_names. For this to work from Samba it was necessary to add “unix extensions = no” to the [Global] section of /etc/samba/smb.conf and “wide links = yes” to the specific share section. Without this the links will not be properly traversed when you access the share.

I then added two system events:

mythfilldatabase ran: /usr/share/doc/mythtv-backend/contrib/user_jobs/mythlink.pl --link /var/lib/mythtv/show_names

recording started: /usr/share/doc/mythtv-backend/contrib/user_jobs/mythlink.pl --link /var/lib/mythtv/show_names --chanid "%CHANID%" --starttime "%STARTTIMEUTC%"

Notice the %STARTTIMEUTC% as opposed the wiki suggested %STARTTIME%. This solution comes to us from http://www.gossamer-threads.com/lists/mythtv/users/564185.

I decided to attach to the mythfilldatabase event instead of recording deleted or instead of adding to crontab. It will run daily and keep things clean.

6/11/2015

Brother HL-L2380DW

Filed under: General,Router/PC Config — taing @ 2:19 am

Linux Printer:

You will need two packages from the Brother website. The lpr and the CUPS .deb files. Install the lpr package first. After installing both, restart cupsd. The Printers dialog should now show the printer. You may want to confirm the IP settings and print a test page.

Ignore the instructions to edit /etc/printcap.This file is auto generated and it makes no sense to edit it.

The installable .deb packages can be downloaded from http://support.brother.com/g/b/downloadlist.aspx?c=us&lang=en&prod=hll2380dw_us_as&os=128. As of today the current version 3.2.0-1 dated 2015-02-12.

Linux Scanner:
Instructions

This can be summarized as:

brsaneconfig4 -a name=(name your device) model=HL-L2380DW ip=xx.xx.xx.xx

Once installed the scanner should show up in simple-scan or xsane.

Note the links on the instruction page does not point to the latest driver and the instructions on the download page do not mention network scanning.

The driver and brsaneconfig4 can be downloaded from http://support.brother.com/g/b/downloadlist.aspx?c=us&lang=en&prod=hll2380dw_us_as&os=128. As of today the current version is 0.4.3-1 dated 2015-05-19.

4/3/2015

HomeAutomation

Filed under: General,Home Automation — taing @ 6:27 pm

Raspberry Pi with Rasbian

MQTT

Updated 2/2016

wget http://repo.mosquitto.org/debian/mosquitto-repo.gpg.key
sudo apt-key add mosquitto-repo.gpg.key
cd /etc/apt/sources.list.d/
sudo wget http://repo.mosquitto.org/debian/mosquitto-wheezy.list
sudo apt-get update
sudo apt-get install mosquitto mosquitto-clients libmosquitto-dev

wiringPi

(from http://wiringpi.com/download-and-install/)
For the first time: git clone git://git.drogon.net/wiringPi
For updates:
cd wiringPi
git pull origin

To Build:
cd wiringPi
./build

Java 8

sudo su
echo "deb http://ppa.launchpad.net/webupd8team/java/ubuntu trusty main" | tee /etc/apt/sources.list.d/webupd8team-java.list
apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys EEA14886
apt-get update
apt-get purge openjdk* (to remove previously installed lower versions)
apt-get install oracle-java8-installer
exit

OpenHab

(from https://github.com/openhab/openhab/wiki/Linux—OS-X)
Add repo signature: wget -qO - 'https://bintray.com/user/downloadSubjectPublicKey?username=openhab' | sudo apt-key add -
Add sources to list: echo "deb http://dl.bintray.com/openhab/apt-repo stable main" | sudo tee /etc/apt/sources.list.d/openhab.list
Update apt data and install:
sudo apt-get update
sudo apt-get install openhab-runtime

Install optional Addons:
sudo apt-cache search openhab
sudo apt-get install openhab-addon-binding-xy

Gateway code

start with the code from https://github.com/abouillot/HomeAutomation/tree/master/piGateway

git clone https://github.com/abouillot/HomeAutomation
cd ~/HomeAutomation/piGateway
g++ Gateway.c rfm69.cpp -o Gateway -lwiringPi -lmosquitto -DRASPBERRY -DDEBUG

9/10/2013

PPTP – route UDP

Filed under: General,Router/PC Config — taing @ 10:13 am

Quick notes on adding BCP Bridging to PopTop PPTP server:

• We are using pptpd version 1.2.1 since it has better support for broadcasting than the earlier 1.1.4 version.
• When building pptpd use the following configure option: ./configure –with-bcrelay to enable the bcrelay module.
• In /etc/pptpd.conf, add bcrelay eth0 (replace eth0 with the name of your internal interface) This will enable broadcast forwarding between the ppp interfaces as well as the interface you specify.
• In /etc/ppp/options-pptp, make sure that the mppe required option is commented. Since we will be playing games over this VPN connection, encryption is not necessary.

More can be found at http://non-standard.net/freebsd/game-vpn/vpnfaq.html.

VMWare vs Multicast

Filed under: General,Router/PC Config — taing @ 10:02 am

Found this discussion where the problem of no multicast is solved by disabling the VMware adapters in the host.

http://social.msdn.microsoft.com/Forums/windowsdesktop/en-US/4e5a4725-e1b7-4ea3-a1db-be8ad1a19f34/why-cant-vista-receive-multicast-but-xp-can

1/5/2013

Mythbuntu / XFCE and CRTL-ESC

Filed under: General,MythTV — taing @ 8:45 pm

After the latest upgrade to Mythbuntu 12.04 we found the previous keyboard shortcut to open the main menu was no longer working. Our solution was to remove the shortcut for CTRL-ESC from

/etc/xdg/xfce4/xfconf/xfce-perchannel-xml/xfce4-keyboard-shortcuts.xml
/etc/xdg/xdg-mythbuntu/xfce4/xfconf/xfce-perchannel-xml/xfce4-keyboard-shortcuts.xml

We then adjusted

~/.config/xfce4/xfconf/xfce-perchannel-xml/xfce4-keyboard-shortcuts.xml

to include the line

<property name=”&lt;Primary&gt;Escape” type=”string” value=”xfce4-popup-applicationsmenu”></property>

in the <property name=”custom” type=”empty”> section.

This can be confirmed in the keyboard section of xfce4-settings-manager. xfce4-settings-manager is not to be run remotely. If you run it with “sudo” you will adjust the wrong settings file.

12/30/2012

Mythbuntu Autologin

Filed under: General,MythTV — taing @ 11:34 pm

After upgrading to 12.04LTS we found autologin no longer worked. The secret was to add:

autologin-user=username
autologin-user-timeout=20

to /etc/lightdm/lightdm.conf.

Refer to the post at http://www.mattfischer.com/blog/?p=343 for more info. Or look in /usr/share/doc/lightdm/lightdm.conf.gz.

Reset the Haupauge WinTV unit

Filed under: General,MythTV — taing @ 11:24 pm

Once again after a restart the Haupauge unit was not seen by the backend.

The systems here are all upgraded to mythbuntu 12.04LTS and Myth .26.

I tried:

sudo usb_modeswitch -v 2040 -p 7501 -R

And had success. A “sudo shutdown -r now” with no sucess. In the past a power cycle of the devvice and the PC were required.

1/22/2012

hostapd and mythbuntu

Filed under: General,MythTV — taing @ 10:16 pm

We were looking to use the wireless card in the Acer Revo mythbuntu box as a wireless access point to extend the wifi coverage in the system. The solution is the hostapd package and a bit of configuration.

In our setup, there is a separate machine acting as primary gateway/router to the internet/DSL modem. We want the new “access point” to have the same SSID and security settings as the existing WAP. We will configure it to use a different B/G channel. The Acer Revo is connected to the main WAP and the router/gateway by wired ethernet so we will bridge the wired ethernet to the wireless interface. In this configuration the existing router/gateway will provide the DHCP services and gateway to the internet.

There were two main articles on the web I used as reference: http://www.su-root.eu/computing/turn-your-linux-computer-in-a-wireless-access-point-using-hostapd and http://blog.robin.smidsrod.no/2008/08/08/how_to_setup_an_atheros_based_access_poi.

The basic steps are to install hostapd, enable IP forwarding disable “NetworkManager” and configure the bridge. The final step is to make this automatic at startup. Our systems are running Mythbuntu Lucid (10.4) and all went well.

The Avec Revo units have a wireless card based on an Atheros chipset. This allows you to use the ath9k kernel driver. For this driver the you must use hostapd to set Master mode for the card. You will not be able to do this with iwconfig alone.

After installing hostapd via apt-get, the second part of the setup is to disable “NetworkManager” and create the appropriate bridge configuration is /etc/network/interfaces :
auto lo
iface lo inet loopback

iface eth0 inet manual

auto br0
iface br0 inet dhcp
#for testing you may want to leave wlan0 out of the bridge and add manually when hostapd is running
bridge-ports eth0 wlan0

iface wlan0 inet manual

For testing you can add or remove the wlan0 interface from the bridge using brctl addif br0 wlan0 or brctl delif br0 wlan0.

You will need to enable IP forwarding with echo 1 > /proc/sys/net/ipv4/ip_forward. If you have iptables or other firewall setup you will need to edit the config to allow the correct traffic.

The sample /etc/hostapd/hostapd.conf file from the link article worked well:
#wireless interface to use as AP
interface=wlan0

#bridge device (needed for madwifi & nl80211 drivers)
bridge=br0

#driver interface type (hostapd/wired/madwifi/prism54/test/none/nl80211/bsd)
# Use nl80211 for wifi drivers that implement MAC80211 interface
#You should set this to your relevant driver interface type
driver=nl80211

#Enables logging to standard output (useful for debugging)
logger_stdout=-1
logger_stdout_level=2

#Set SSID to use
ssid=YOUR_SSID

# Operation mode (a = IEEE 802.11a, b = IEEE 802.11b, g = IEEE 802.11g)
# note your card may not support every mode.
hw_mode=g

#Channel to use (1-13)
channel=6

auth_algs=3

max_num_sta=5

#Enable WPA2
wpa=2

#Set passphrase for WPA
wpa_passphrase=YOUR_PASSWORD
wpa_key_mgmt=WPA-PSK

# Set of accepted cipher suites (encryption algorithms) for pairwise keys
wpa_pairwise=TKIP CCMP
# Pairwise cipher for RSN/WPA2 (default: use wpa_pairwise value)
rsn_pairwise=CCMP

For testing you can start hostapd with sudo hostapd -d /etc/hostapd/hostapd.conf. Once all is working well you can make this a bit more automatic. If you have wlan0 set as part of br0 in /etc/network/interfaces, the only step left is to edit /etc/defaults/hostapd to set RUN_DAEMON="yes". This will allow hostapd to start at boot and allow you to use /etc/init.d/hostapd start|stop|restart to control.

For debugging you can use brctl show to view the members of the bridge. You can use hostapd_cli to control the operation of the WAP service.

1/15/2012

Change the Master Google Account for an Android Phone

Filed under: General — taing @ 9:46 pm

For my Samsung Moment from Sprint I wanted to change the main Google account without factory defaulting the phone. I followed the instructions found at http://androidforums.com/ally-all-things-root/337386-remove-main-google-account-android-without-doing-factory-reset.html.

The core is to rename /data/system/account.db to /data/system/account.db.bak. You will ten need to enter the new account info when you attempt to access any of the google services – for example Market.

1/4/2012

Problem after Mythbuntu 11.10 upgrade

Filed under: General,MythTV — taing @ 10:28 pm

After upgrading Mythbuntu to 11.10 we encountered an error that showed in syslog as a segfault in Unity-Greeter. Fortunately the system was still accessible via SSH and console. The solution was found in a thread on ubuntuforums.com.

The core of the solution is to edit /etc/lightdm/lightdm.conf and remove this line:
greeter-session=unity-greeter

« Newer PostsOlder Posts »

Powered by WordPress