[SOLVED] Dummy Item with predefined value / state

Hi Guys,
this is my actual item for a HomeMatic Wireless Window Rotary Handle Sensor:

String Emily_Fenster_Status “Fenster Emily Status [MAP(fenster_de.map):%s]” (gBad, gFenster) {channel=“homematic:HM-Sec-RHS:6d1a3e28:NEQ1760269:1#STATE”}

My transformation:

Based on these information i enable or disable my heating control widget.
So far so good.

But now i have some rooms without window sensor and would like to avoid to create 2 separate widgets and therefor i was looking for a way to create an item without binding but with predefined value,

This is just a sample format i was thinking of:
String Flur_Fenster_Status "Fenster Flur Status = CLOSED (gFlur, gFenster)

Can someone please help me in finding the correct format?


Hi Rich,
thanks for sharing this. But i failed to implement it so far.
I even tried to simply use the sample with the switch, but what i get back is always NULL when i print it out in a template via {{itemValue(‘DUMMY_Fenster_Status’)}}.

I tested as Item:
Switch DUMMY_Fenster_Status “Fenster DUMMY Status” (gFenster) {state = “ON”}
Switch DUMMY_Fenster_Status “Fenster DUMMY Status” (gFenster) {value = “ON”}
String DUMMY_Fenster_Status “Fenster DUMMY Status” (gFenster) {state = “CLOSED”}
String DUMMY_Fenster_Status “Fenster DUMMY Status” (gFenster) {value = “CLOSED”}

Nothing has worked. Or is for the virtual item really a rule required?


As documented in the linked Design Pattern, you have to use a rule. You cannot initialize the state of an Item in the .itmes file. The { } are for binding configs and nothing else.

1 Like

Hi Rich,
thanks again! You are the code expert :slight_smile:
But based from this post

and this sample:

Switch RFID_12345 "Bob's ID" (Authorized) { expire="1m,state=OFF" }

and this text

This approach is well suited for situations where

no system started rule required to boot strap the value, value is coded into the Item so only the Items need to be changed to add, remove, modify the values.

i thought hardcoding a simple value would be possible.

But i got it working now:
My final String item:

String DUMMY_Fenster_Status "Fenster DUMMY Status [MAP(fenster_de.map):%s]" <window> (gFenster)

My rule running every minute

rule "set dummy values"
    Time cron "0 * * * * ?" //every minute


Why are you setting the dummy item every minute?

I think it is better to use a “system started” triggered rule. Then the dummy item is set once (and is not changed anymore).


Hi Andreas,
thanks for the hint.

I am not that familiar with these rules (yet), so i try to avoid using them as much as possible.
My homematic system variables are updated every minute via a rule, so i just took this one and modified it.

I have now changed to when “System started”.

Thank you

If you read that post and look at the examples you will see that none of them attempts to set the state of the Item from the .items file.

Expire is a binding. That is a binding configuration, not the setting of an Item’s state from the .items file.

Should have read “encoded into the Item’s name”. I’ve updated the post to add that one important word.

If it were possible I would not have needed the DP and the three different approaches to do it.

I’m glad you got it working but also ask why you do not use a System started the like the DP linked to above demonstrates in example 1.

Hi Rich, i blame the fact not beeing a nativ english speaker for having some issues to understand this the first try.

Now it is clear :slight_smile:

Perfect, thanks. So it might be easier to understand it.

But it would be cool and handy to set a definded state directly in the item definition. Maybe room for a Feature Request?

I changed now to System started. I had this rule running every minute already in place and so it was the easiest for me to just add it. But well simply creating a new rule file was also easy and quick done afterwards :slight_smile:

Many thanks again for your help. Your support and this great community is much appreciated!


1 Like