Based on my poor experience in coding in a linux enviroment, I'm quite pround to have been able to install a full function iRTrans server on my rPI3 running Domoticz.
Most of the information here came form a deep reading of the iRTrans nonsupport forum (in deutch! ... while I'm italian and I don't nothing about german language)
I would like to share my personal guide in order to help other users.
Here's what I did:
SCENARIO
- Raspberry PI3,
- Domoticz SD Card image
Use iRTans LAN with NO DB Support to control devices (Sky, air cond/heat split, TV and any other iR Device)
The choice of iRTrans is because... I have this available....
IRSERVER SETUP
In case of device with no buit-in iRDB support, iRTrans can be used via iRServer software.
iRServer, in a linux enviroment, is available in 2 option:
Compiled for x86 and x64 Intel enviroments (rPI is ARM) or Source Code witch need to be recompiled (this is my case)
first I created a temp directory named irserver and another folder named arm under /home/pi and then I downloaded and unpack the server source code
Code: Select all
mkdir /home/pi/irserver
mkdir /home/pi/irserver/arm
cd /home/pi/irserver
wget http://www.irtrans.de/download/Server/Linux/irserver-src.tar.gz
tar -xvf irserver-src.tar.gz
Code: Select all
nano makefile
Code: Select all
SHELL = /bin/sh
CC = gcc
CFLAGS =
CPPFLAGS = -DLINUX -DMEDIACENTER
LDFLAGS =
LIBS =
#ODIR = x86
#ODIR64 = x64
ODIRARM = arm
_OBJS = fileio.o linuxserio.o lowlevel.o server.o errormessage.o flashrom.o webserver.o xap.o lanio.o ascii.o mce.o xbmc.o
#OBJS = $(patsubst %,$(ODIR)/%,$(_OBJS))
#OBJS64 = $(patsubst %,$(ODIR64)/%,$(_OBJS))
OBJSARM = $(patsubst %,$(ODIRARM)/%,$(_OBJS))
#irserver: $(OBJS) $(ODIR)/ccf.o
# $(CC) $(CFLAGS) $(OBJS) $(ODIR)/ccf.o -m32 -o irserver $(LDFLAGS)
#irserver_noccf: $(OBJS) $(ODIR)/noccf.o
# $(CC) $(CFLAGS) $(OBJS) $(ODIR)/noccf.o -m32 -o irserver $(LDFLAGS)
#irserver64: $(OBJS64) $(ODIR64)/ccf.o
# $(CC) $(CFLAGS) -DX64 $(OBJS64) $(ODIR64)/ccf.o -m64 -o irserver64 $(LDFLAGS)
#irserver64_noccf: $(OBJS64) $(ODIR64)/noccf.o
# $(CC) $(CFLAGS) -DX64 $(OBJS64) $(ODIR64)/noccf.o -m64 -o irserver64 $(LDFLAGS)
#irserver_arm: $(OBJSARM) $(ODIRARM)/ccf.o
# $(CC) $(CFLAGS) $(OBJSARM) $(ODIRARM)/ccf.o -o irserver $(LDFLAGS)
irserver_arm_noccf: $(OBJSARM) $(ODIRARM)/noccf.o
$(CC) $(CFLAGS) $(OBJSARM) $(ODIRARM)/noccf.o -o irserver $(LDFLAGS)
#all: irserver irserver64
#arm: irserver_arm
arm_noccf: irserver_arm_noccf
clean:
# -rm $(OBJS) x86/noccf.o
# -rm $(OBJS64) x64/noccf.o
-rm $(OBJSARM) arm/noccf.o
#$(ODIR)/%.o: %.c dbstruct.h fileio.h lowlevel.h network.h serio.h pictures.h remote.h makefile
# $(CC) $(CPPFLAGS) $(CFLAGS) -m32 -c $< -o $@
#$(ODIR64)/%.o: %.c dbstruct.h fileio.h lowlevel.h network.h serio.h pictures.h remote.h makefile
# $(CC) $(CPPFLAGS) $(CFLAGS) -DX64 -m64 -c $< -o $@
$(ODIRARM)/%.o: %.c dbstruct.h fileio.h lowlevel.h network.h serio.h pictures.h remote.h makefile
$(CC) $(CPPFLAGS) $(CFLAGS) -c $< -o $@
irclient: client.c
$(CC) $(CPPFLAGS) $(CFLAGS) client.c -o irclient $(LDFLAGS)
save and overwrite the file with CTRL-X
we are now ready to compile:
Code: Select all
sudo make
if everythig went fine you should have irserver file in the current directory
irserver came with a internal www server witch is almost useless and crash often
a simple syntax to test it is: irserver <irTransLAN ip address>
try to run it, but first have it executable:
Code: Select all
sudo chmod +x irserver
sudo ./irserver 192.168.0.124
Code: Select all
sudo ./irserver -daemon 192.168.0.124
GUIClient use in quite simple, I will not talk about it here, but you can read the handbook
IRCLIENT SETUP
once you have learned all the needed irCodes and organized them in remote/commands, it's time to install irClient witch is needed to send commands to the server.
Like for the server, irClient for ARM cames in source code and needs to be compiled.
The process is almost the same:
Code: Select all
mkdir /home/pi/irclient
mkdir /home/pi/irclient/arm
cd /home/pi/irclient
wget http://www.irtrans.de/download/Client/irclient-src.tar.gz
tar -xvf irclient-src.tar.gz
Code: Select all
nano makefile
Code: Select all
SHELL = /bin/sh
CC = gcc
CFLAGS =
CPPFLAGS = -DLINUX
LDFLAGS =
LIBS =
#ODIR = x86
#ODIR64 = x64
ODIRARM = arm
_OBJS = client.o
#OBJS = $(patsubst %,$(ODIR)/%,$(_OBJS))
#OBJS64 = $(patsubst %,$(ODIR64)/%,$(_OBJS))
OBJSARM = $(patsubst %,$(ODIRARM)/%,$(_OBJS))
#irclient: $(OBJS)
# $(CC) $(CFLAGS) $(OBJS) -m32 -o irclient $(LDFLAGS)
#irclient64: $(OBJS64)
# $(CC) $(CFLAGS) -DX64 $(OBJS64) -m64 -o irclient64 $(LDFLAGS)
irclient_arm: $(OBJSARM)
$(CC) $(CFLAGS) $(OBJSARM) -o irclient $(LDFLAGS)
all: irclient irclient64
arm: irclient_arm
clean:
# -rm $(OBJS)
# -rm $(OBJS64)
-rm $(OBJSARM)
#$(ODIR)/%.o: %.c flash.h errcode.h network.h remote.h makefile
# $(CC) $(CPPFLAGS) $(CFLAGS) -m32 -c $< -o $@
#$(ODIR64)/%.o: %.c flash.h errcode.h network.h remote.h makefile
# $(CC) $(CPPFLAGS) $(CFLAGS) -DX64 -m64 -c $< -o $@
$(ODIRARM)/%.o: %.c flash.h errcode.h network.h remote.h makefile
$(CC) $(CPPFLAGS) $(CFLAGS) -c $< -o $@
now, let's compile it!
Code: Select all
sudo make
now let's make it executable
Code: Select all
sudo chmod +x irclient
the syntax is simple: irclient <ip> <remote> <command> where:
- ip: the SERVER ip address (127.0.0.1 is your're running ir server on the same rPI), not hte LAN device
- remote: remote name you use in the GUI Client (ie: myskyhd)
- command: learned irCode name under GUIClient (ie: KEY_POWER)
Code: Select all
./irclient 127.0.0.1 myskyhd KEY_POWER
now let's integrate it in Domoticz!
after having create a virtual switch and named as you like (mine is 'TestIR'), create a LUA script (under events) name script_device_<something>.lua witch contain:
Code: Select all
commandArray = {}
- - change the name of the sensor
local sensor = 'TestIR'
if (devicechanged[sensor] == 'On') then
os.execute ("/home/pi/irclient/irclient 127.0.0.1 myskyhd KEY_POWER")
end
return commandArray
I home this would help!
ciao
M