OH2 with Homematic systemvariables, only leaves me with error

Hi there,

I’m a well versed OH user in versions 1.x.
I’m migrating to OH an a parallel set up Pi.
All my bindings are working with all their items, even homematic.

But I don’t get the systemvariables working.
Setting TRACE for the homematic binding give me this:

foreach (sys_var_id, dom.GetObject(ID_SYSTEM_VARIABLES).EnumUsedIDs()) {
  object var_obj = dom.GetObject(sys_var_id);
  if (var_obj.Visible() == true) {
    Write("  <entry");
    Write(" name='");           WriteXML(var_obj.Name());
    Write("' description='");   WriteXML(var_obj.DPInfo());
    Write("' info='");          WriteXML(var_obj.Name());
    Write("' value='");         WriteXML(var_obj.Value());
    
    var var_type = "UNKNOWN";
    if (var_obj.ValueType() == 2   ) { var_type = "BOOL";  }
    if (var_obj.ValueType() == 16  ) { var_type = "ENUM";  }
    if (var_obj.ValueType() == 4   ) { var_type = "FLOAT"; }
    if (var_obj.ValueType() == 6   ) { var_type = "FLOAT"; }
    if (var_obj.ValueType() == 8   ) { var_type = "INTEGER"; }
    if (var_obj.ValueType() == 20  ) { var_type = "STRING"; }
    Write("' valueType='");     WriteXML(var_type);

    if (var_type == "ENUM") {
      Write("' options='");     WriteXML(var_obj.ValueList());
    }

    if ((var_type == "FLOAT") || (var_type == "INTEGER")) {
      Write("' min='");         WriteXML(var_obj.ValueMin());
      Write("' max='");         WriteXML(var_obj.ValueMax());
    }
    Write("' unit='");         WriteXML(var_obj.ValueUnit());
    Write("' readOnly='false'");
    Write(" />\n");
  }
}
Write("</list>");
2017-02-18 18:11:50.857 [TRACE] [tic.internal.communicator.CcuGateway] - Result TclRegaScript: <?xml version="1.0" encoding="ISO-8859-1" standalone="yes"?>
<list>
  <entry name='Anwesenheit' description='Anwesenheit' info='Anwesenheit' value='true' valueType='BOOL' unit='' readOnly='false' />
  <entry name='Gaszaehler' description='Gaszaehler' info='Gaszaehler' value='109713.000000' valueType='FLOAT' min='0' max='1.700000000000001e+308' unit='dl' readOnly='false' />
  <entry name='Leistung' description='Leistung' info='Leistung' value='307.000000' valueType='FLOAT' min='0' max='1.700000000000001e+308' unit='W' readOnly='false' />
  <entry name='Stromzaehler' description='Stromzaehler' info='Stromzaehler' value='223281.199951' valueType='FLOAT' min='0' max='1.700000000000001e+308' unit='Wh' readOnly='false' />
  <entry name='TVSanja' description='TVSanja' info='TVSanja' value='false' valueType='BOOL' unit='' readOnly='false' />
  <entry name='Wasserzaehler' description='Wasserzaehler' info='Wasserzaehler' value='4972.000000' valueType='FLOAT' min='0' max='1.700000000000001e+308' unit='l' readOnly='false' />
  <entry name='WWHysterese' description='WW Hysterese' info='WWHysterese' value='5.000000' valueType='FLOAT' min='5' max='20' unit='°C' readOnly='false' />
  <entry name='WWSolltemperatur' description='WW Solltemperatur' info='WWSolltemperatur' value='0.000000' valueType='FLOAT' min='0' max='75' unit='°C' readOnly='false' />
</list>
2017-02-18 18:11:50.884 [ERROR] [very.HomematicDeviceDiscoveryService] - java.lang.String cannot be cast to java.lang.Number
java.lang.ClassCastException: java.lang.String cannot be cast to java.lang.Number
	at org.openhab.binding.homematic.internal.communicator.parser.CcuVariablesAndScriptsParser.parse(CcuVariablesAndScriptsParser.java:46)[200:org.openhab.binding.homematic:2.1.0.201702180650]
	at org.openhab.binding.homematic.internal.communicator.CcuGateway.loadVariables(CcuGateway.java:107)[200:org.openhab.binding.homematic:2.1.0.201702180650]
	at org.openhab.binding.homematic.internal.communicator.AbstractHomematicGateway.loadChannelValues(AbstractHomematicGateway.java:464)[200:org.openhab.binding.homematic:2.1.0.201702180650]
	at org.openhab.binding.homematic.internal.communicator.CcuGateway.loadChannelValues(CcuGateway.java:134)[200:org.openhab.binding.homematic:2.1.0.201702180650]
	at org.openhab.binding.homematic.internal.communicator.AbstractHomematicGateway.loadAllDeviceMetadata(AbstractHomematicGateway.java:383)[200:org.openhab.binding.homematic:2.1.0.201702180650]
	at org.openhab.binding.homematic.discovery.HomematicDeviceDiscoveryService$1.run(HomematicDeviceDiscoveryService.java:108)[200:org.openhab.binding.homematic:2.1.0.201702180650]
	at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)[:1.8.0_65]
	at java.util.concurrent.FutureTask.run(FutureTask.java:266)[:1.8.0_65]
	at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$201(ScheduledThreadPoolExecutor.java:180)[:1.8.0_65]
	at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:293)[:1.8.0_65]
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)[:1.8.0_65]
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)[:1.8.0_65]
	at java.lang.Thread.run(Thread.java:745)[:1.8.0_65]
2017-02-18 18:11:50.926 [DEBUG] [very.HomematicDeviceDiscoveryService] - Homematic device discovery scan finished
2017-02-18 18:11:50.931 [TRACE] [nal.communicator.client.BinRpcClient] - Client BinRpcRequest:
rssiInfo()

All my variables come in the list, but after that nothing from GATEWAY EXTRAS is there.

After

[ERROR] [very.HomematicDeviceDiscoveryService] - java.lang.String cannot be cast to java.lang.Number

nothing useful is in the log.

The thing is shown as “undefined” if I configure it.
I tried all variants: manual configuration via *.things and *.item files, minimal conf and auto discovery, all with the same result.

Please help, what am I doing wrong here?

Thanks, Thomas

Same behaviour on my System.

There seems to be a problem in the routine that parses the “min” and “max” values. Please create an issue in the Githup repo.

@gerrieg As far as I can see, the regular expression that checks for floating values (https://github.com/openhab/openhab2-addons/blob/master/addons/binding/org.openhab.binding.homematic/src/main/java/org/openhab/binding/homematic/internal/communicator/parser/CcuVariablesAndScriptsParser.java#L76) is not correct. The plus sign of the exponent is missing.

fixed with https://github.com/openhab/openhab2-addons/pull/1886