Sitemap > mapping value from item

Hi,

I have currently following item in my Sitemap

Default item=test
Switch item=test mappings=[0="up", 80="open", 65="half", 100="down"] icon="rollershutter"

Items definition:

Number test_nb_1
Number test_nb_2
Rollershutter test

now I am trying to make this a bit “interactive”, interactive means that the positions of “half” and “open” can be changed via Sitemap. Setting the state of half and open is not the problem.

is it possible to map the value of test_nb_1.state to “open” like this?

Switch item=test mappings=[0="up", test_nb_1.state="open", test_nb_2="half", 100="down"] icon="rollershutter"
Setpoint item=test_nb_1
Setpoint item=test_nb_2

Sitemap ist working when I add the Item without “.state” , but when selecting a warning is generated in log:

10:45:30.195 [WARN ] [.rest.core.internal.item.ItemResource] - Received HTTP POST request at 'items/test ' with an invalid status value 'test_nb_1'.

Openhab 2.5.10 btw

The quick answer is no.

Switch item=test label="Rollershutter []" icon="rollershutter" mappings=[ 0="open", 65="half", 100="down"]

The syntax (order) needs to be correct for it to work.

and the long one? :wink:

The mapping itself is workling.
Of course it would be possible to setup a rule to change but that would be my last wish :wink:

I guess I am not sure what you are trying to achieve here.

Are you using a binding to control the roller shutter?
What is the number items for?

okay.
It is a Homematic setup - so yes. via binding.

And I used the mappings to get the RS to predefined states, like heatprotection.
But in the current solution the value is hardcoded in the sitemap an a normal user is not able to change the value.

With defining a Numberitem and add it to a sitemap I am trying to change this.
The user could change the Value of the numberitem.

Oh you can use another item in sitemap no need for extra item

Try this under your current sitemap item.

Setpoint item=test label="Rollershutter [%s]" minValue=0 maxValue=100 step=10

yes of course.
But I was asked to predefine States that can be called again and again with just one click. That’s why i choosed a mapping

Yes this is how a map works you call a state

Roller shutter is UpDown, StopMove, Percent

Switch item=test label="Rollershutter " icon="rollershutter" mappings=["STOP"="STOP", "DOWN"="DOWN", "UP"="UP", 0="Open", 50="half", 100="Closed"]

we are turning arround, as you can see in my first post I am using absoute percent values already.
these are hardcoded in the sitemap and not changable by a non administrator.

therefore I am looking for a way to user the value of a number-item (that can be changed via sitemap).

No.
test_nb_1.state="open"
The bit on the left is the command that is sent when you poke the button marked “open”. You cannot coerce it to any other meaning.

I don’t really follow what you are trying to do, but visibility= is a useful sitemap tool.

People will commonly use this to display one widget when some other Item has ‘this’ state, and a different widget when the other Item has ‘that’ state.

Switch item=myblinds mappings=[0="open",50="half"] visibility=[someControl==ON]
Switch item=myblinds mappings=[50="half",100="close"] visibility=[someControl!=ON]

No it is not possible by using a sitemap. Very few aspects of a sitemap are dynamic. Mappings in the sitemap are static. @rossko57’s advice to use [visibility=...] is an option if you only have two or three discrete mapping patterns that you anticipate you will want. If you want to have full, arbitrary control of the mapping levels you’ll need an intermediary item on the sitemap and a rule that translates the the sitemap item to your myblinds item.

Sitemap:
Switch someSitemapItem [0="up", 1="half", 2="open", 3="down"]
Setpoint item=blindsHalfLevel

Then your rules files should contain some logic such as: When someSitemapItem changes,
if someSitemapItem state is 1 (i.e. “half”) set myblinds to blindsHalfLevel state.

2 Likes

Thank you!