Page 1 of 1

Controlling Domotic by usb keyboard??

Posted: Wednesday 11 March 2015 13:58
by valve90210
Hi All

Just a quick question really, can domoticz be set up to be controlled by a usb keyboard, so for example pressing 'a' on the keyboard would switch lights to scene 1, 'b' would switch to scene 2 etc?

Re: Controlling Domotic by usb keyboard??

Posted: Wednesday 11 March 2015 17:45
by antwan
Nope

Re: Controlling Domotic by usb keyboard??

Posted: Wednesday 11 March 2015 18:19
by RayAmsterdam
Maybe you can use some of the python code found here: http://stackoverflow.com/questions/2920 ... -in-python

Re: Controlling Domotic by usb keyboard??

Posted: Wednesday 11 March 2015 21:03
by valve90210
Sadly that coding looks completely foreign to me, I not up on my coding :(

Tis a pity as I was hoping this might be possible to use a flirc device which shows up as a usb keyboard and translates infrared codes to button presses... back to the drawing board it seems

Re: Controlling Domotic by usb keyboard??

Posted: Friday 08 April 2016 13:30
by googanhiem
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

Code: Select all

thd --listevents
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&param=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.