openhab / org.openhab.ui.habmin

HABmin - a graphical user interface for openHAB 2
231 stars 91 forks source link

Switch with mapping not displayed as expected #92

Closed ddoll closed 8 years ago

ddoll commented 9 years ago

I'm using a switch within the sitemap to view a number item. The switch is configured with a mappings attribute like this:

sitemap example:

Switch item=vLueftungStufeUi label="Lüftung" mappings=[0="Aus", 1="1", 2="2", 3="3", 4="60m"]  labelcolor=[==0="red"] valuecolor=[>=0="white"]

The problem is, that i only get an on/off switch instead of the defined mappings. In the classic UI i'll get a list of buttons. The function of the classic UI is really cool, because I can use the buttons as a direct input to select the required value.

ClassicUI: classic

HABmin: habmin

ddoll commented 9 years ago

I have extracted the XML part of the sitemap. I've analysed the source code and saw that there is no part to render the mapping attributes. Also there should be a case for the NumberItem type (in sitemapSwitchWidget.js). Maybe there should be a new angular component created to handle this special use case.

<widget>
    <widgetId>0302_0_0</widgetId>
    <type>Switch</type>
    <label>Lüftung</label>
    <icon>none</icon>
    <mapping>
        <command>0</command>
        <label>Aus</label>
    </mapping>
    <mapping>
        <command>1</command>
        <label>1</label>
    </mapping>
    <mapping>
        <command>2</command>
        <label>2</label>
    </mapping>
    <mapping>
        <command>3</command>
        <label>3</label>
    </mapping>
    <mapping>
        <command>4</command>
        <label>60m</label>
    </mapping>
    <item>
        <type>NumberItem</type>
        <name>vLueftungStufeUi</name>
        <state>Uninitialized</state>
        <link>http://localhost:8080/rest/items/vLueftungStufeUi</link>
    </item>
</widget>
cdjackson commented 9 years ago

As you have identified this is not currently implemented. I wi take a look at it I the near future

cdjackson commented 8 years ago

This has been implemented as a dropdown. It won't be available until the next release which will be when the OH2 zwave binding is released.