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:
CLOSED=geschlossen
OPEN=offen
TILTED=gekippt
NULL=undefiniert
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’)}}.
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.
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"
when
Time cron "0 * * * * ?" //every minute
then
DUMMY_Fenster_Status.sendCommand("CLOSED")
end
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.
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
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
Many thanks again for your help. Your support and this great community is much appreciated!