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:
rule "Test"
when
/* Seconds, Minutes, Hours, Day-of-Month, Month, Day-of-Week, Year (optional field)*/
Time cron "0 * * ? * * *"
then
logInfo("Test", "Rule executed...")
CCU_Reload.send(RefreshType.REFRESH)
end
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:
java.lang.NullPointerException
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:2.1.0.201702121957]
at com.beowulfe.hap.impl.json.CharacteristicsController.put(CharacteristicsController.java:70)[186:org.openhab.io.homekit:2.1.0.201702121957]
at com.beowulfe.hap.impl.connections.HttpSession.handleAuthenticatedRequest(HttpSession.java:75)[186:org.openhab.io.homekit:2.1.0.201702121957]
at com.beowulfe.hap.impl.connections.ConnectionImpl.doHandleRequest(ConnectionImpl.java:51)[186:org.openhab.io.homekit:2.1.0.201702121957]
at com.beowulfe.hap.impl.connections.ConnectionImpl.handleRequest(ConnectionImpl.java:46)[186:org.openhab.io.homekit:2.1.0.201702121957]
at com.beowulfe.hap.impl.http.impl.AccessoryHandler.channelRead0(AccessoryHandler.java:47)[186:org.openhab.io.homekit:2.1.0.201702121957]
at com.beowulfe.hap.impl.http.impl.AccessoryHandler.channelRead0(AccessoryHandler.java:15)[186:org.openhab.io.homekit:2.1.0.201702121957]
at io.netty.channel.SimpleChannelInboundHandler.channelRead(SimpleChannelInboundHandler.java:105)[186:org.openhab.io.homekit:2.1.0.201702121957]
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:308)[186:org.openhab.io.homekit:2.1.0.201702121957]
at io.netty.channel.AbstractChannelHandlerContext.access$600(AbstractChannelHandlerContext.java:32)[186:org.openhab.io.homekit:2.1.0.201702121957]
at io.netty.channel.AbstractChannelHandlerContext$7.run(AbstractChannelHandlerContext.java:299)[186:org.openhab.io.homekit:2.1.0.201702121957]
at io.netty.util.concurrent.DefaultEventExecutor.run(DefaultEventExecutor.java:36)[186:org.openhab.io.homekit:2.1.0.201702121957]
at io.netty.util.concurrent.SingleThreadEventExecutor$2.run(SingleThreadEventExecutor.java:112)[186:org.openhab.io.homekit:2.1.0.201702121957]
at io.netty.util.concurrent.DefaultThreadFactory$DefaultRunnableDecorator.run(DefaultThreadFactory.java:137)[186:org.openhab.io.homekit:2.1.0.201702121957]
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?
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.
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.
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.
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.
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.
Hi,
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?
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"
when
Time cron "0/1 * * * * ?" // every second
then
sendCommand(EndDaySwitch, RefreshType.REFRESH)
end
every second OH refreshes the switch with the variable.
it is working, but i dont know if this is a good solution ^^
Hi,
many thanks for the reply.
I could get it working finally
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.