Using a Windows batch's output as an item

Hi all,

I’ve run into an issue setting something up. I have an Amazon Fire TV box and I’ve learned how to query it’s current state through ADB (I’ll share everything once I have it working). The batch finishes by echoing the word ‘Asleep’ ‘Dreaming’ or ‘Awake’.

Here is my item line:

String BR_FTV_Status “Fire TV Status” {exec="<[C:/OpenHAB/configurations/scripts/Check_BR_FTV.cmd:60000:MAP(]"}

The batch kicks off as the placeholder file in the batch gets updated, but OpenHAB isn’t pulling the output into the item. I just get a blank response along with the transform error (since my map doesn’t have an entry for a blank result):

2016-03-24 10:55:33.136 [INFO ] [runtime.busevents ] - BR_FTV_Status state updated to

The item doesn’t update at all if I remove the transform portion, but I also tried REGEX((.*?)) and got the same result (blank).

I tried changing the batch to output the result to >CON, but it does the same thing. What am I missing?

Thanks in advance!

I have no experience with exec on Windows but I think my standard advice still applies. Move the exec part to an executeCommandLine in a rule and log anything that gets returned. I don’t know if Windows has the concept of stderr/stdout but if it does there can be error messages that are being generated that won’t be picked up.


String BR_FTV_Status "Fire TV Status"
Switch Get_BR_FTV_Status "Get FTV Status"


rule "FTV Status"
    Item Get_BR_FTV_Status received command
    val String results = executeCommandLine("C:/OpenHAB/configurations/scripts/Check_BR_FTV.cmd", 5000)
    logInfo("FTV", results)

Look in your logs for what the command is producing. I can’t say this will help but it is always my first step to debugging exec problems.

Hello everyone,
I set up a basic installation of openHAB and got my config working pretty well. Now I want to tweak it a little bit and want to set up a TVScene which should be triggered when the Amazon-Fire-TV-Stick is activated from “sleep”.
The approach of laboye seems to be a good start.
@laboye: Have you got it working already? Can you share your findings?

Thanks in advance.

Hello everyone,

i want to check the current state of my fire tv.
With ADB i can send commands to the fire tv. But i cannot check the current state (on, sleep, off).
Does anyone has a solution for me ?

Thanks in advantage