Difference between revisions of "User:Posde"

From LinuxMCE
Jump to: navigation, search
(This page does not contain any user setup)
(Home Automation)
Line 326: Line 326:
 
=== Z-Wave Motion Detector ===
 
=== Z-Wave Motion Detector ===
 
* ACT ZIR010 (Battery lasts between 6month and two years)
 
* ACT ZIR010 (Battery lasts between 6month and two years)
* Seluxit Multisensor
+
* [[Seluxit Multisensor]]
  
 
== Security ==
 
== Security ==

Revision as of 10:22, 20 July 2010

Links

Modeline generator for X.org [1]

Notes on Orbited

Orbited is a server providing Comet functionality via HTTP. It needs twisted to run, and is written in Python.

apt-get install python-setuptools
easy_install twisted
easy_install orbited
easy_install stompservice
easy_install simplejson

We need a configuration file for orbited

[global]
session.ping_interval = 300
user = www-data
group = www-data 
[listen] 
http://:9001
stomp://:61613 
[access]
* -> localhost:61613

Above copied from http://thingsilearned.com/2009/06/25/starting-out-with-comet-orbited-part-2-installation-and-stomp/

Goal with Orbited

An interface where clients can register and receive constant information feedback about what is going on in a given room, and/or with a given device.

Plan of action

  1. Create an Orbiter device on the dcerouter for each of the rooms
  2. Have a PHP script register to the dcerouter, and receive all messages for the current room. These messages are send to Orbited via STOMP protocol using the STOMP Client for PHP.
  3. Have a Javascript client, modeled after STOMP test client, which registers to Orbited to receive each Event message when the router sends it. The JavaScript frontend uses a call to a PHP script modeled after the PHP MessageSend lib of the iOrbiter to send commands to the DCERouter.

Note

  • Each time the PHP script starts, it must check if there is an Orbiter (that can be used exclusively by us), is available for each room.
  • All data, that is available via MySQL should be requested via MySQL
  • It needs to be found out, if we able to receive arrays from DCE via messagesend

Activate Orbiter from KDE

This is VERY simple. All that is needed, is a simple message to the DCE router to NOT activate PC desktop:

/usr/pluto/bin/MessageSend dcerouter 0 153 1 912 119 "0"

where 153 is the device ID of the Orbiter on the current machine

EIB-eibd

The eibd based KNX/EIB device template is currently not plug and play, and not part of the regular install. The application needs to be build on a builder, and installed manually.

  • add the tuwien repo to your builder AND to your core
deb http://www.auto.tuwien.ac.at/~mkoegler/debian eib main 
apt-get update

Build the EIB-eibd package

  • install the needed client development package
apt-get install libeibclient-dev
  • create the binary
cd src/EIB-eibd
make all

Install eibd-server

On your core, you need to install the eibd server package.

apt-get install eibd-server

Modify the eibd configuration files to suit your needs (needs more details).

Install the EIB-eibd package

  • First install the EIB device template (PK_DeviceTemplate=49)using the web admin
  • Make sure eibd is running (for tests, start it manually, later it should be started during system startup)
  • After installing the EIB device template, copy the builders output file EIB to /usr/pluto/bin and quick reload the router

Thoughts about the Orbiter

Looking at the current devices Orbiter is running on, the Mobile Orbiter and the Cisco orbiter are special. The Mobile Orbiter, because it needs to intercept incoming calls, and the Cisco orbiter because the phone itself does not have much local intelligence to display stuff All other Orbiter can be exchanged for a HTML based orbiter without any problem. And even the Mobile Orbiter could be stripped down to be a small program running in the background, and upon incoming calls call a specific web page. So, the only thing really causing a problem is the Cisco orbiter And the Cisco could be used via a proxy based on a browser, transferring touches on the Cisco touchscreen as clicks to the dcerouter

Notes on DCE Whisperer

<Uplink_> in SVN, under /branches/LinuxMCE-0810/src/DCE-Whisperer
<Uplink_> it was committed at revision 22089
<Uplink_> if you have a SVN checkout, look in src/DCE-Whisperer
<Uplink_> there, you have a self-contained deb package that you can build
<Uplink_> dpkg-buildpackage -rfakeroot -b -us -uc -tc
<Uplink_> and you get a deb
<K0K05> Stop right there. Do not let me waste more of your time. I'm putting together a new VirtualBox development installation
<Uplink_> if you install that deb, then you can read the script Test231.sh to get an idea of how to write a DCE device with it
<K0K05> That was crystal clear
<Uplink_> put this in a text file or something :)
<Uplink_> when you get the hang of it, write a Wiki page too
<K0K05> I promise to do that
<K0K05> And is it obvious how to write a device for TCP/IP ?
<Uplink_> it should be
<Uplink_> there a function at the top of the file, called Configure, and it has all the communication parameters that you need to set for any application
<Uplink_> basically, you say DeviceConnection_Type=inet
<Uplink_> and then find the relevant variables to set the IP address and port, below, in the same function
<Uplink_> everything that the device sends will be passed to the ProcessDeviceStream function (which is below Configure)
<Uplink_> also in configure, you can set some pre-processing parameters if you like
<Uplink_> for example, if the protocol is all text, and all the messages end up with the same character (\r for example), you can tell the framework that
<Uplink_> and it will split it at the terminator into lines before calling ProcessDeviceStream

The package shell-io in src/shell-io needs to be build as well.

The packages have been build are available from possy:

Media List

Who is responsible for filling out the media list?

It is filled from the table File at the moment. The table File is filled by UpdateMedia. But, there is media, which needs to be added to the list, which is not physically available in the file system.

How can this be added?

The principal has been outlined in the MediaSourcePlugin page.

Maemo Orbiter

echo deb http://maemo-sdk.garage.maemo.org/download/host ubuntu-intrepid free>>/etc/apt/sources.list
aptitude update
aptitude install maemo-sdk
maemo-sdk install tools etch-2008
maemo-sdk install rootstrap diablo4.1.2_armel
sb2 -eR apt-get update
sb2 -eR apt-get install

Add a Debian src repository to the scratchbox2

apt-get source libsdl-ttf2.0-dev libsdl-gfx1.2-dev 
apt-get source libgle3-dev libsdl-sge-dev libhid-dev 
apt-get source libmysqlclient12-dev libhttpfetcher-dev 

How to build the above source packages ???

forcedeth problems

As my NICs driver (forcedeth) has problems with random MAC addresses, due to a reverse MAC address detection bug (even in 2.26), modify the rules

editor /etc/udev/rules.d/30_persistent_net.rules
remove the last 6 digits of the mac address and replace with *
reboot

Notes On The Orbiter Generation

Scenario Buttons On The Main Menu

All scenarios are in the table CommandGroup.

The list of scenarios displayed on the main menu is derived from

  • CommandGroup_Entertain
    • Media
  • CommandGroup_Room
    • Lighting
    • Security
    • Telecom
    • Climate

Menu Items Which NEED Graphics

  • Media Remote
  • DVD Menue support (graphic is stored in /tmp/file.jpg on the corresponding MD)
  • Security Cameras (latest picture is in /tmp/ip_camera_img<device-id>.png or .jpg on the MD)
  • Floorplan support (floorplans are in /home/floorplans, details about them in the DB)
  • Application Desktop objects (only for On-Screen orbiters)

Media Remote

The media remote is basically just a bunch of buttons, so no real need for graphics here.

DVD Menues and Screenshots

The DVD menu images are stored in the MDs /tmp directory in file.jpg, ie. while watching the DVD menue, every few seconds a new file

/tmp/file.jpg

gets created. That is the file that is sent to the orbiter for display.

Screen Location Of Objects

Text Objects

The location of text objects is stored in DesignObjVariation_Text_Skin_Language via DesignObjVariation_Text.

Other Objects (buttons etc)

The location of other design object is stored in DesignObjVariation_DesignObj_Skin_Language.

Media File List

There is no Goto Screen for the file lists of the medias off the main menu. Instead, it uses Show File List with the PK_MediaType parameter. Show File List looks up the screen to be displayed based upon the current UI and the PK_MediaType in the table MediaType_DesignObj. For example, 47 is the screen that gets displayed. For UI1 it is the variation with ID 4684.

Select FK_Screen_FileList From MediaType_DesignObj Where FK_MediaType = 5

Main Menu

The starting screen is defined in the Skin table

Select FK_Screen_MainMenu From Skin Where PK_Skin = (SELECT IK_DeviceData As Skin FROM Device_DeviceData D Where FK_Device = <id of orbiter> And FK_DeviceData = 24 {DeviceData ID for PK_Skin})

The sleeping screen is also defined in the Skin table

Select FK_Screen_Sleeping From Skin Where PK_Skin = (SELECT IK_DeviceData As Skin FROM Device_DeviceData D Where FK_Device = <id of orbiter> And FK_DeviceData = 24 {DeviceData ID for PK_Skin})

User Status

The UserMode table has a list of all available modus of a user.

Floorplan Information

Floorplan images are stored in /home/pluto/floorplans

For each device put onto a floorplan, an entry in Device_DeviceData points to the location. I.e. my light is has a Device ID of 63. To find out, where the light is on a floorplan it is

Select IK_DeviceData from Device_DeviceData Where FK_Device = 63 and FK_DeviceData = 10

FK_DeviceData = 10 is the floorplan info.

Security Camera Images

The latest security camera image(s) are also stored in temp with the name ip_camera_img<device-id-of-camera>.jpg, i.e. for a camera with device ID 164 it is

/tmp/ip_camera_img164.jpg

or if you want better quality

/tmp/ip_camera_img164.png

PythonMO

The PythonMO is going to work on all Nokia Symbian S60v2 and S60v3 phones. S60v1 won't be supported, as one of the main objects (graphics.Image) is not supported on it. As Python is supported on a lot of other devices as well, it should be easy to move it to other devices as well. The PythonMO is a Bluetooth server talking to the BD service running on the LinuxMCE Media Director.

Flow

  • All conversation work the same way. The server and the client talk using the following syntax.
4-byte long CommandID
4-byte long length of CommandText
0x00 delimited CommandText
  • It provides a service names "Pluto"
  • Upon connecting from a client, it sends out
    • A 4 byte version of a long BD_PC_REPORT_MY_VERSION
    • A 4 byte length definition of the BD_VERSION string
    • The BD_VERSION string, delimited with a NULL
  • The client sends back
    • A 4 byte version of a long BD_CP_....*
    • A 4 byte length definition of the command text
    • The word OKAY ended with a NULL
  • The server sends BD_PC_WHAT_DO_YOU_HAVE
  • The client tells the server, what the server should display or send back.

Personal Goals for 0810

EPG and channel list on orbiter

The average user expects the electronic program guide to be viewable on the orbiter, and not only the on-screen orbiter. (Maemo Orbiter, Web Orbiter, Flash Orbiter [maybe Mobile Orbiter])

Working VDR

VDR integration as promised for 0710. LiveTV on all media directors, without an ugly hack.

Python Orbiter

As mentioned on top of this page, I want an orbiter realised in Python, especially for the Symbian S60 phones. But it can also be the basis, for a mobile orbiter runnning under Maemo.

LVM and RAID

Partition The First Disk

Currently, the installer does not work with previously created software RAID devices. Therefor, one of the three disks is used to create the boot device. DVD Install and Custom Partitions

Create a RAID 1

As the boot partition we will create a raid 0 array. First create partitions on two of the disks using fdisk

fdisk /dev/sda
n - new partition
1 - start of partition
+80000M - we take about 80GB of space. Enough for the initial / of LinuxMCE and a couple of MDs
t - change type of partition
fd - to a raid array
w - write changes to disk.

same for /dev/sdb.

Now we create the raid devices

mdadm --create /dev/md0 --level=1 --raid-devices=2 /dev/sda1 /dev/sdb1

If you receive an error, device /dev/md0 not found, make sure, the kernel module md is loaded, do

modprobe md

and try mdadm --create again.

Now, wait for the array creation to finish. Watch it with

cat /proc/mdstat

Now we have the initial device for LinuxMCE. Look at the wiki page [[2]] regarding custom partitioning, and create the three relevant partitions within the device /dev/md0 instead of /dev/sda and the relevant file and dir.

Now it is time to install LinuxMCE as outlined in the above wiki. When done, come back here.

Create a RAID-5 MD with LVM2 on top

LinuxMCE is installed and Sarah did his show and dance, and most of the stuff is configured. Now we will setup the array for the media. This array will be the foundation for an LVM2. Ontop of LVM2 will be an xfs file system. This will ensure ease in growing our media repository.

Install LVM2

aptitude install lvm2

takes of care of installing the needed programs

Create LVM2

A logical volume consists of physical volume groups and logical volume groups. First we mark our big RAID 5 array as a physical volume.

pvcreate /dev/md1

Next we need to create a volume group consisting of our array

vgcreate mediapv /dev/md1

The name 'mediagroup' is purely out of the blue. Name it pamela if you like. Next, after assigning the RAID array to the volume group, we add a logical volume group ontop of that volume group of physical volumes

lvcreate --name medialv --size 1700G mediapv

If you get an error during the above command, make sure the module dm_mod is loaded.

Format The LVM2 Partition

Now we have an LVM2 partition, that we can format. As we will put mostly large files ontop the drive, and use lots of disk space, we choose xfs

mkfs.xfs /dev/mediapv/medialv

If you get an error during the above command, saying command not found, install the xfsprogs using aptitude install Compared to formatting an ext2 or ext3 file system, the creation of the filesystem with xfs is very fast, as only a little bit of information is written to the disk.

Door bell and security camera

<simn_bx> TSCHAK, all... what does it mean in WIzard-Reaction to sensors, if i set for Generic analog camera under "disarmed" as "as Security??
<TSCHAK> simon_b, that only works if the camera is a child of the motion wrapper
<TSCHAK> simon_b, but if you do that, then motion will watch the camera and try to extrapolate motion, and send security events, that you can trigger off of.
<simon_bx> yes, the camera is a child of motion wrapper
<TSCHAK> okay, sooo
<TSCHAK> that means any time that camera detects motion, you can for example, trigger a security event
<simon_bx> hmmm, ok... trying to uderstand that...

[..]

<simon_bx>[..]i'm trying to add camera notivifacation on the orbiter, when doorbell button is triggered

[..]

<TSCHAK> since I have a supported mobile orbiter
<TSCHAK> all I did was drop a cam outside, and hook a door phone to an analog telephone adaptor, and set the ATA up to be extension 996

996 is the extension for Movement detected...

<TSCHAK> it shows it on my phone, but i also added a respond to events "someone rings doorbell" which triggers my door cam scenario under security.
<simon_bx> aha... ok, will play a little bit...
<TSCHAK> I used DCERouter Execute Command Group command, and gave it the scenario # of the panasonic IP camera scenario button
<simon_bx> well, that is already too deep for me... " DCERouter Execute Command Group command" (sorry for asking)
<TSCHAK> if you look at the list of commands
<TSCHAK> under DCERouter, there is a command, called execute command group
<TSCHAK> a command group, is the internal name for a scenario
<TSCHAK> it takes one parameter, the scenario number to run...
<TSCHAK> which you get by looking at a scenario, it will say, "Scenario #8: Sleep" etc...
<TSCHAK> you get the # ,and put it in that fiel.
<TSCHAK> d.
<simon_bx> guys, is this possible: Scenario, Device (OnScreenOrbiter) -- Command (Goto Screen) -- and then set a path to the camera frame?
<TSCHAK> try it.
<simon_bx> hmmm, but where to put the path in? #10 ID (string) -- #159 PK_Screen (int), nothing seems logical atm
<simon_bx> add. Question: MD in room 1... can i set two commands for it for the same time? 
(like: 1- play sound ring.wav and 2. show picture(object) xy.jpg)?? or should i use for 1. xine and 2. mplayer?

Designing screens and objects

The following is some additional information, that might get handy, if you are working with HADesigner (or the upcoming JAVA-based QuickDesigner) (directly from a chat session with Tschak)

  1. MediaType_DesignObj .. that specifies designobjs and screens for a media type
  2. Screen .. for specifying screens.. changes to this table require running ScreenGen
  3. Screen_DesignObj which specifies what designobj to use for a screen...
  4. and there is DeviceTemplate_MediaType_DesignObj which allows you to override a designobj/screen mapping for a specific type of device.

What media type is MythTV and/or VDR

There are two TV media types. The built in TV is pluto_TV. The other media type np_LiveTV is used for external receivers that bypass the LinuxMCE system and directly connect to a TV set.

Changing Channels

<TSCHAKeee> changing channels isn't that difficult
<TSCHAKeee> command, tune to channel, destination -106, the program parameter is I believe <%=35%> ...
the exact variable is in the onActivate for the instance of the datagrid on the ui2 screen.

Assigning Screens To MediaTypes

If you want a specific screen to be shown for example for TV, the relevant place is MediaType_DesignObj. That table links a media type to a corresponding screen. FK_SCREEN for UI1, and FK_DesignObj_Popup for UI2.

What is needed

Core

2 NICs

MD

PXE bootable nVidia board

Home Automation

Z-Wave dongle

  • Seluxit
  • MiCasaVerde

Z-Wave Switches

  • Merten single rocker 505119
  • Merten dual rocker 505219

Z-Wave Actors

  • Merten Dimmer 507900
  • Merten Switch 507001

Z-Wave Motion Detector

Security

  • D-Link IP camera DCS3500 G
  • Axis 207 (better low-light performance)

Telecom

  • Patton SmartNode for ISDN connectivity
  • Cisco 7970 as hardwired phones (and orbiters)
  • Grandstream HT-286 ATA for analog door phone
  • Door phone (model?)

Climate

  • Z-Wave Merten 509201 for radiator set-back