Homematic systemvariable refresh in openhab2


I’m new to openhab, so maybe I have the wrong idea. I try to sync the variable from a ccu2 to openhab. To do it I defined a cron rule which sends a REFRESH to a ccu2 variable:

Excerpt from my items file:

String CCU_Reload    "CCU Reload Vars"  { channel="homematic:GATEWAY-EXTRAS-CCU:ccu:GWE00000000:1#ReloadEventVar" }
Switch Test          "Test"             { channel="homematic:GATEWAY-EXTRAS-CCU:ccu:GWE00000000:1#TestVar" }

Excerpt from my rules file:

rule "Test"
	/* Seconds, Minutes, Hours, Day-of-Month, Month, Day-of-Week, Year (optional field)*/
	Time cron "0 * * ? * * *"
	logInfo("Test", "Rule executed...")

If I modify TestVar on the ccu2 and everything works, the Test item in openhab is update as expected. But unfortunately in most case I get a concurrent modification exception while running the cron job:

	at java.util.Collections$UnmodifiableMap.<init>(Collections.java:1446)[:1.8.0_112]
	at java.util.Collections.unmodifiableMap(Collections.java:1433)[:1.8.0_112]
	at com.beowulfe.hap.impl.HomekitRegistry.getCharacteristics(HomekitRegistry.java:75)[186:org.openhab.io.homekit:]
	at com.beowulfe.hap.impl.json.CharacteristicsController.put(CharacteristicsController.java:70)[186:org.openhab.io.homekit:]
	at com.beowulfe.hap.impl.connections.HttpSession.handleAuthenticatedRequest(HttpSession.java:75)[186:org.openhab.io.homekit:]
	at com.beowulfe.hap.impl.connections.ConnectionImpl.doHandleRequest(ConnectionImpl.java:51)[186:org.openhab.io.homekit:]
	at com.beowulfe.hap.impl.connections.ConnectionImpl.handleRequest(ConnectionImpl.java:46)[186:org.openhab.io.homekit:]
	at com.beowulfe.hap.impl.http.impl.AccessoryHandler.channelRead0(AccessoryHandler.java:47)[186:org.openhab.io.homekit:]
	at com.beowulfe.hap.impl.http.impl.AccessoryHandler.channelRead0(AccessoryHandler.java:15)[186:org.openhab.io.homekit:]
	at io.netty.channel.SimpleChannelInboundHandler.channelRead(SimpleChannelInboundHandler.java:105)[186:org.openhab.io.homekit:]
	at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:308)[186:org.openhab.io.homekit:]
	at io.netty.channel.AbstractChannelHandlerContext.access$600(AbstractChannelHandlerContext.java:32)[186:org.openhab.io.homekit:]
	at io.netty.channel.AbstractChannelHandlerContext$7.run(AbstractChannelHandlerContext.java:299)[186:org.openhab.io.homekit:]
	at io.netty.util.concurrent.DefaultEventExecutor.run(DefaultEventExecutor.java:36)[186:org.openhab.io.homekit:]
	at io.netty.util.concurrent.SingleThreadEventExecutor$2.run(SingleThreadEventExecutor.java:112)[186:org.openhab.io.homekit:]
	at io.netty.util.concurrent.DefaultThreadFactory$DefaultRunnableDecorator.run(DefaultThreadFactory.java:137)[186:org.openhab.io.homekit:]
	at java.lang.Thread.run(Thread.java:745)[:1.8.0_112]

What am I doing wrong? Am I missing something? Or is there another way to refresh all variables?



no one has an idea? Is there another way to refresh Systemvariables?


I am also looking for a solution. did anyone find one?

Refresh of system variables is included in the snapshot builds.


thanks for your reply.

I am using open hab snapshot 2.2.0.
I can change the system variable from ccu through OH2. But when a variable in ccu changes it does not sync back to oh2. Also if I reload datapoint.

Any ideas?



The CCU does not send an event when a variable content changes in the CCU. You need to perform a “manual refresh” e.g. by creating a rule that regularly executes a refresh.

You can find more information the HomeMatic binding doc: http://docs.openhab.org/addons/bindings/homematic/readme.html#troubleshooting

Hello and thanks for your reply.

I tried several solutions and got it finally to work with this one:

import org.eclipse.smarthome.core.types.RefreshType
sendCommand(Var_1, RefreshType.REFRESH)
rule "Reload datapoints"
    Time cron "0/1 * * * * ?"  // every second
	sendCommand(EndDaySwitch, RefreshType.REFRESH)

do you think it is a good idea to do the cron job every second? or is there any better solution for that?
thank you for your help!


It depends :-). If you don’t need the current value within a second you could use a larger time difference between the checks.
If possible you could try to implement it completely in openHAB without using system variables. But this depends on the use case.

Just one question on this refresh issue: can one run some Code on the CCU to actually trigger this refresh or maybe update an item via REST?

Interesting idea. I would guess that it’s possible to write an add-on for the CCU that can perform a REST call but I don’t have enough knowledge about CCU programming.
Maybe somebody in the Homematic forum can help.

What do you think @gerrieg?

I don’t have any knowledge to write a CCU add-on. I use the CCU as a dumb interface to the devices, no variables and logic in the CCU. I recommend doing everything in openHab.

i am looking for a solution since weeks and found only a couple of hints in the internet, also covers a program to run on the ccu. But all did not work.
I have not worked with rules so far.
So could you please be a bit more detailed what exactly you have done to get the values updated.
Did you create this rule via PaperUI or via file?
Can you maybe please share a screenshot or explain the steps a bit more in detail.
Have you written any program in ccu or done any mods in the ccu to get this working?
Is this rule using any homematic thing or item? Has any thing or item be prepared to get this working?

Also what OH Version do you use to get this working and what is your CCU Firmware?


Hello Andreas,

I am using OH 2.2.0 and CCU 2.29.18. but it should work with any other versions, as this solutions is very basic. ^^

in the item file i configured a switch which points to a systemvariable from the ccu:

Switch EndDaySwitch "Gute Nacht" (Wohnzimmer, Homematic) {channel="homematic:GATEWAY-EXTRAS-46A75714:46a75714:GWE00000000:1#Gute_Nacht"}

the problem was i could change the state from the variable in the ccu by using the switch in OH, but it did not work in the other direction. So when the variable in the ccu changed, it did not change in OH2, which is due to the limited functionality in the ccu. the provided workarounds with virtual remote did not work for me.

so i created a rule:

import org.eclipse.smarthome.core.types.RefreshType

rule "Reload datapoints"
    Time cron "0/1 * * * * ?"  // every second
	sendCommand(EndDaySwitch, RefreshType.REFRESH)

every second OH refreshes the switch with the variable.
it is working, but i dont know if this is a good solution ^^

many thanks for the reply.
I could get it working finally :slight_smile:
But the Key here is OH 2.2.x, currently i am using openHAB 2.2.0~20170810035435-1 (Build #1008)
I tested it first with OH 2.1 and there nothing happens.

One more observation was the rule will update all Systemvariables even only one is specified in the rule for refresh.


Thanks for the workaround. I got the same situation with some of my HMW-IO-4-FM.
The binding does not report any change of state for these devices (at least for me). Especially in case they are configured to “Output”, that would be quite useful, though. So I created some CCU-system-Variable to mirror the state of the channels.