- Platform information:
- Hardware: Raspberry Pi 3 Model B Rev 1.2
- OS: Raspbian GNU/Linux 8 (jessie)
- Java Runtime Environment: don’t know
- openHAB version: openHAB 2.3.0-1 (Release Build)
- Issue of the topic: How to setup a FIFO queue to send commands
I am hoping to get some suggestions on how to solve this challenge.
Background: I have a ZMOTE device to control my TV and other entertainment devices. Through the use of HabPanel and rules those devices are being switched on, channel changed and so on.
The normal command to a device is as follows:
This is translated via the ZMOTE binding into an IR stream. The transmission of this commands takes some time as well as the processing/reaction at the receiving device (e.g. TV).
Since I have to send several commands in sequence (e.g. TV on, Receiver On, Change Channel to 7) I have a number of Thread::sleep() commands sprinkled throughout the rules (some lasting several hundred of ms).
Question: Instead of using discrete “zmote_ir1_sendcode.sendCommand” statements I would like to develop a sort of device driver that can handle the execution of these sendcode commands (which are strings) with associated wait times in between sendcode commands using a timer. I envision writing the sendcode commands and associated wait times into a FIFO, trigger the device driver and then let the device driver execute going through the FIFO, sending out the commands until the FIFO is empty.
An additional challenge would be the protection against quasi parallel calls of the device driver and handling the concurrency issues associated with that.
Any suggestions on how to do that are greatly appreciated