Set Homematic Value or Variable


I want to use Openhab as interface/bridge for several systems. My main controller and system is Homematic CCU2. I just installed OH and successfully connected my CCU2 and a RFXTRX433 to receiver temperature sensors.

First thing i wanna do: Put my sensors temperature into virtual devices from CUXd on my CCU. What would be the best approach? Can i set a CCU value directly from Openhab? I don’t think so, because normally sensors are for reading… Next best approach would be a variable on the CCU which is set from OH and then trigger a script on the CCU.

What do you think? Any ideas?

I am not totally sure when it comes to cuxd devices. Did you try it what happens when you send an update to a cux device. It the device really just read only?
If not maybe you can you bind both binding information to one item.

What was coming to my mind while I was reading your question was: why?

Why do you want to write values to the devices on the CCU?

The reason why I use openHAB is that I want to be independent from the CCU. So all the logic (programs/rules) is in openHAB not in the CCU.
From that perspective, I need the values in openHAB… So the cux devices need to send their updates via the binding to my items, but the other was around is not really important.

For actors the story is surely different.

@Tscherno If you have some patience, I can do some tests on my system. But this will not be possible until in 2 weeks.


reason behind the idea: Currently my complete setups runs via CCU, all scripts are there, working fast and stable. Also i really like the iOS app. The need to extend the system was coming from a missing Homematic sensor for wind speed to control my sundblind. I found the whole HM weather station just too big and ugly. Also i don’t have wires to connect a good wind sensor (at least not on the right position). There seemed to be NO battery or solar powered wind meter, but then i came across this:

Z-Wave always interested me because of the mesh based approach. Plus i love the design of the Fibraro plugs. => Bought a Z-Wave USB stick and a cheaper sensor (the motion eye) just to play around a little and test the direct signal reach.

Next thought: when i start to have the chance to use Openhab as “bridge”, why not use RFXtrx to use cheap temp/hum and also maybe wind sensors. I still own a lot of the Oregon temp/hums. Because i still wait for the Z-Wave stuff i started with those…

My maybe naive and stupid first try looks like that:

rule "Temp office => HM"
    Item Temperature received update
        var String tmp
    tmp = Temperature
    postUpdate(Var_Temp_Office, tmp)

But that results only in following error:

2015-08-16 12:31:20.560 [INFO ] [runtime.busevents             ] - Temperature state updated to 25.60000000000000142108547152020037174224853515625
2015-08-16 12:31:20.568 [ERROR] [o.o.c.s.ScriptExecutionThread ] - Error during the execution of rule 'Temp office => HM': Could not invoke method: org.openhab.model.script.actions.BusEvent.postUpdate(org.openhab.core.items.Item,java.lang.String) on instance: null

I’ve the same rule-problem. Are you sure, that you have an Item called “Var_Temp_Office” defined?

Ah okay. So your plan contrary to mine. I was willing and happen to move all my logic from the CCU2 to openHAB. My environment is with approximate 90 channels a pain to maintain via the CCU. Especially when it comes to the creation of programs with several devices. I really got tired of the many clicks I had to do on webUI.

But back to your problem.
Can you post your item definition?

Maybe I can see something…

Also I prefer a different syntax of the postUpdate or sendCommand method, even if the one you’ve used is the one which is shown in nearly each example. But I was running in similar problems using the syntax you have posted.




Items look like this:

 Number Temperature    "Temperatur [%.1f °C]"    <temperature>    (FF_Office,Status)        { rfxcom="<7425:Temperature" }
 Number Var_Temp_Office "Temp Office HM" {homematic="variable=TempOffice"}

Tried to change the rule to Var_Temp_Office.postUpdate(tmp), same result… Maybe some type conversion issue?

Both of your items are Numbers, but you try to send an String via postUpdate.
How is the variable “TempOffice” defined in webUI? String? Then you will have to define it here as String item as well und not number. Or is a number variable (which is likely)? Then the String in your rule doesn’t makes sense.

Edit: I forgot to mention… You can test the type of an item or state by using logInfo and the syntax item.class.toString (I.e. Var_Temp_Office.class.toString)

1 Like

I tried now both, setting the variable to number/string on both sides. No result. It seems that Var_Temp_Office is NIL, Var_Temp_Office.class.toString also gives an error.

But there is another problem: I tried to set a fixed value Var_Temp_Office.postUpdate(12) and Var_Temp_Office.postUpdate(“12”), log also says “Var_Temp_Office state updated to 12” but on HM it’s still 0.00 or empty, no matter if number or string.

Sounds like the “connection” to the Homematic world is not working probably. The variable name on the Homematic side is really “TempOffice”? And it is really a variable and not some kind of device?

If you start your openHAB instance, do you see log entries from the Homematic binding showing how many variables and channels have been read?

2015-08-17 19:56:42.615 [INFO ] [b.h.i.communicator.StateHolder] - Loading Homematic Server variables
2015-08-17 19:56:42.691 [INFO ] [b.h.i.communicator.StateHolder] - Finished loading 10 Homematic server variables

10 Variables exist in HM…

I also tried recreating the variable with another name. No improvement.

I just set the logging to debug. When the rule and the temp set is triggered, i get no output from the HM binding at all. Seems that it doesn’t trigger when i set the variable from the rule. All other HM devices i tried are working fine.

And i tried to add forceUpdate + sendCommand(Reload_Datapoints, ON)


rule “Temp office => HM”
Item Temperature received update
logInfo(“Test”, Var_Temp_Office.toString)
sendCommand(Reload_Datapoints, ON)

2015-08-18 16:53:28.641 [INFO ] [runtime.busevents             ] - Temperature state updated to 23.7000000000000028421709430404007434844970703125
2015-08-18 16:53:28.645 [INFO ] [org.openhab.model.script.Test ] - Var_Temp_Office (Type=NumberItem, State=123.0)
2015-08-18 16:53:28.651 [INFO ] [runtime.busevents             ] - Var_Temp_Office state updated to 123.0
2015-08-18 16:53:28.654 [INFO ] [runtime.busevents             ] - Reload_Datapoints received command ON
2015-08-18 16:53:31.452 [INFO ] [runtime.busevents             ] - Reload_Datapoints state updated to OFF

Hi guys,
any updates on that issue? I’m stuck with the same Problem right now…
Did you solve that somehow?

If someone else also finds this post…
The solution is to use sendCommand(Var_Temp_Office, 123.0)
postUpdate will not be sent to the bus (only used for display updates) while sendCommand will be sent to the bus and updates the bindings.