Hi, I have a theoretical question about how to map an item. This item has no binding, i created from a .items file. The scenario would be the following:
I want to use tasker and autolocation to set my posicion using geofence, this is already done. Tasker will set where I am, a place using a string (home, work, street, etc) and stored this string in and item:
Then to establish persistence created the following group:
A group that already have another members.
But the item CellphoneAuto is a string a not a switch so i creat a second item a proxyitem (i belive)
Switch CellphoneAuto_home (gMyself)
So this item is part of the group gMyself which establish precense the other item will be use for other things to.
So the question is how i define CellphoneAuto_home so when CellphoneAuto is “home” CellphoneAuto_home is map to ON.
I do not know if I explain well, also if someone comes up with a better way is welcome.
This is the sort of thing that Rules are for. See Design Pattern: Proxy Item for an example. When CellphoneAuto changes, it triggers a Rule. Based on the state of CellphoneAuto it turns CellphoneAuto_home ON or OFF.
ok, so I do the mapping with the rule. Perfect
Just for curiosity, can i create an item with a map opcion?
Label usage here examples here, for UI display purposes
Yes a read it, but i don’t want to transform it in the label, but the content. I understan i can do it with a rule, but can i do it in the item definitiom like a thing?
Things cannot randomly transform themselves either.
Consider what you ask for. When shall we do this transform? When the Item state gets updated, I suppose. So your transform looks at the Item state, transforms it into something else, and updates the same Item. Now the Item state has been updated, so we will run the transform, update the Item again. The Item state has been updated, so …
It doesn’t cost you anything to have two Items and a rule. There is no more or less processing to be done, in the end. And there is the advantage of having both “raw” and “transformed” states available at any time.
Thank you very much, I will do as you say. It was more or less what I had in mind.