I had this problem as well, and figured out a way to control domoticz with a keyboard (or in my case Flirc, which acts as a keyboard). The secret is using thd, also known as triggerhappy ( more on it here
http://manpages.ubuntu.com/manpages/qua ... thd.1.html )
Step 1: choose keys you won't necessarily need as they will be completely taken over. For me I used F8 to F12
To find out what keys are available type
Step 2: Write a triggerhappy conf file to run a script/command, here is my example,
Code: Select all
# /etc/triggerhappy/triggers.d/lights.conf
#
# lights control
KEY_F11 1 /home/pi/domoticz/scripts/hue_lr_on.sh
KEY_F12 1 /home/pi/domoticz/scripts/hue_lr_off.sh
KEY_F9 1 /home/pi/domoticz/scripts/hue_lr_dim.sh
This will run the following scripts when the key is pressed, when F9 is pressed it dims the livingroom lights (nothing better than dimming the lights with a tv remote control press). You can write more than one conf file as long as they don't contradict. I wrote a second one to pause and play VLC on my laptop. You could also access a domoticz switch using..
Code: Select all
# /etc/triggerhappy/triggers.d/switch.conf
#
# switch 9 control
KEY_F8 1 /usr/bin/curl -s "http://192.168.0.101:8080/json.htm?
type=command¶m=switchlight&idx=9&switchcmd=Toggle"
Step 3: Place the configuration files in /etc/triggerhappy/triggers.d/
Step 4: Make sure the keyboard or flirc is plugged in and run the following lines.
Code: Select all
thd --triggers /etc/triggerhappy/triggers.d/ /dev/input/event*
which parses the triggers
Code: Select all
sudo /etc/init.d/triggerhappy reload
which restarts thd
The keys should now start the scripts.