Exec binding returning proper DateTime value


I have a DateTime item with an exec binding which calls a python script which returns a DateTime value:

DateTime Consumo_date "Actualizado [%s]" <calendar> {exec="<[myscript.py:10000:REGEX((.*?))]"}

Which should be the format of the returned DateTime value from the script in order to be recognized by the DateTime item?

ISO 8601 format.


E.g. 2016-15-04T08:04:15

I have changed the item definition as follows:

DateTime Consumo_date "Actualizado [%1$ta %1$tR]" <calendar> {exec="<[date@@-r@@/opt/varios/ih.log@@+%%Y-%%m-%%dT%%T:10000:REGEX((.*?))]"}

I have checked the executed command and the returned value follows the ISO format.

The debug log says the following:

21:19:14.781 [DEBUG] [.o.b.exec.internal.ExecBinding:177  ] - transformed response is '2016-04-15T17:00:20'
21:19:14.807 [DEBUG] [ore.internal.items.ItemUpdater:73   ] - Received update of a not accepted type (StringType) for item Consumo_date

What I am doing wrong?

I don’t see anything on the wiki page but it is possible the Exec binding doesn’t know how to populate a DateTime Item. You can try using a String and a rule to populate the DateTime type.

Beyond that I have nothing else to suggest.

The 1.8 version of the binding had hardcoded state types.

Try the 1.9.0-SNAPSHOT version of the Exec binding, where I had changed the binding to allow all item types.

Now is working prefectly. Thanks to both of you!

1 Like