Controlling Domotic by usb keyboard??

Topics (not sure which fora)
when not sure where to post, post here and mods will move it to right forum.

Moderators: leecollings, remb0

Post Reply
valve90210
Posts: 2
Joined: Sunday 08 March 2015 11:22
Target OS: -
Domoticz version:
Contact:

Controlling Domotic by usb keyboard??

Post 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?
antwan
Posts: 116
Joined: Saturday 13 July 2013 13:28
Target OS: Linux
Domoticz version: Latest
Location: Hilversum, The Netherlands
Contact:

Re: Controlling Domotic by usb keyboard??

Post by antwan »

Nope
Rasp Pi 2B: 3x DS18S20 (1-wire), BME280 (i2c)
Cubietruck 1: Aeotec Z-Wave+, RFXtrx433XL+P1, RFXtrx868, TE923 display, SolarEdge API
Cubietruck 2: Aeotec Z-Wave, Voltcraft CO-20
RayAmsterdam
Posts: 115
Joined: Sunday 11 January 2015 16:40
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Controlling Domotic by usb keyboard??

Post by RayAmsterdam »

Maybe you can use some of the python code found here: http://stackoverflow.com/questions/2920 ... -in-python
valve90210
Posts: 2
Joined: Sunday 08 March 2015 11:22
Target OS: -
Domoticz version:
Contact:

Re: Controlling Domotic by usb keyboard??

Post 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
googanhiem
Posts: 1
Joined: Thursday 07 April 2016 13:00
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Controlling Domotic by usb keyboard??

Post 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.
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest