Answering my own question, I realise I was over-thinking it. The items line can remain unchanged from original and there is no need for a corresponding “things” line.
I.e. Number DS18B20ESP “Temperature ESP2 [%.2f °C]” (Temperature,HouseTemps) {mqtt="<[localbrokerrb:/DeviceESP12E/Room1/Temperature:state:default]"}
in the .items file and no line added to the .things file and all is working well with mqtt alongside Exec 2.0.
Still need to find an answer to Number vs String issue.
Hi all,
Anything new on the number vs string issue? I have the same problem as everybody else here…
Here is my workaround (rule to convert the string to a double…):
import java.lang.Double.*
import java.lang.String.*
rule "SHT11 Converter"
when
Item SHT11_Data changed
then
val String data = SHT11_Data.state.toString
var String[] dataParts = data.split(":")
postUpdate(SHT11_Temperature, Double::parseDouble(dataParts.get(0)))
postUpdate(SHT11_Humidity, Double::parseDouble(dataParts.get(1)))
end
My items are
String SHT11_Data "Data [%s]" <temperature> {channel="exec:command:05ff2016:output"}
Number SHT11_Temperature "SHT11 Temperature [%.2f C]" <temperature>
Number SHT11_Humidity "SHT11 Humidity [%.2f %%]" <humidity>
HI,
so it’s not possibile to use exec binding with Switch item by executing one script for ON and another one for OFF ?
Is it possibile to run older 1.8 exec binding under openhab 2.0 ?
Thanks, but i get this error:
[ERROR] [hab.binding.exec.handler.ExecHandler] - An exception occurred while formatting the command line with the current time and input values : ‘Format specifier ‘%2$s’’
Honestly, no idea. I found my working configuration by searching the forums. I do not really understand the OH2 configuration concepts yet. Here is an intermediate version which actually worked at the time of writing but had some limitations: Trigger Exec Binding switch with HUE Emulation [SOLVED]
My current configuration is much more complex but I can post it if you need it.
Ok, here we go. That configuration allows me to start my NAS using the Amazon Echo and it actually represents the current state of the switch by querying if the device is online:
Any idea if there’s been a resolution of this problem yet? (exec 2 requiring String objects and no longer working with Number objects)?
I’m trying to migrate from OH1.8 to OH2 but I can’t bring over all my sensor data as Numbers, and every attempt to parse the Strings into Floats etc fails.
My current workaround is to create a stub String item that is bound to the exec binding channel and a second Number item that is populated from the String by a simple rule.