Hi
Is there a way to add a new attribute to an item?
I need to store the blind last direction (if it was going down or up) and don’t want to use global vars for that because I have tens of blinds around the house.
Hi
Is there a way to add a new attribute to an item?
I need to store the blind last direction (if it was going down or up) and don’t want to use global vars for that because I have tens of blinds around the house.
Why don’t you use the state that tells you if the Item is ON(Open) or OFF(Closed)
this automatically implies the last direction.
{
"link": "http://xxx.xxx.xxx.188:8080/rest/items/Shutter",
"state": "ON",
"editable": false,
"type": "Switch",
"name": "Shutter",
"label": "Shutter Living",
"category": "blinds",
"tags": [],
"groupNames": []
}
Through the rest API you could check all attributes on the item
Thank Charley for prompt response.
The blind is controlled by a dimmer and the state is never on or off, it’s just a number.
Today I check if the previousState > currentState to identify the direction.
{
"link":"http://10.0.0.10:8080/rest/items/GF_LivingRoom_Window_Patio_Blind",
"state":"1",
"editable":false,
"type":"Dimmer",
"name":"GF_LivingRoom_Window_Patio_Blind",
"label":"Blind",
"category":"blinds",
"tags":[
"Switchable",
"Blinds"
],
"groupNames":[
"GF_LivingRoom"
]
}
In that case you use this item
Rollershutter ShutterControl "Shutter living [%d %%]" (gBlinds) ["Blinds"] {channel="zwave:device:xxxxxxxxx:node32:blinds_control" }
Here are all attributes you can check the state again
{
"link": "http://xxx.xxx.xxx.xxx:8080/rest/items/ShutterControl",
"state": "0",
"stateDescription": {
"pattern": "%d %%",
"readOnly": false,
"options": []
},
"editable": false,
"type": "Rollershutter",
"name": "ShutterControl",
"label": "Shutter living",
"tags": [
"Blinds"
],
"groupNames": [
"gBlinds"
]
}
Not sure how I identify the blind last direction in this case, can you please let me know what am I missing?
If you are using persistence you could after the position change write a rule that finds the previous state.
<item>.previousState()
Find more info on persistence extensions here
This might be easier than you think, you can use a global “array” (actually a Map object) to store values keyed by Item name.
Usage shown here
You could also use metadata of the item.
Here is a tutorial for Item Metadata.