Mappings on my items not working

  • Platform information:

    • Hardware:INTEL/4GIG/500GIG
    • OS: UBUNTU
    • openHAB version: 2.4 OPENHABAIN
  • Issue of the topic: I can’t use the mappings on my item as the system ignores the items file completely. it is for a Sonoff ifan2 with mqtt flashed with Tasmota .

    • Items configuration related to the issue
Group       MasterBedroom               "Master Bedroom"           <bedroom_red>                    (Home)

Switch      MasterBedroom_Light_Ingan   "Entrance Light"            <light>                          (MasterBedroom)                           ["Lighting"]                     {mqtt=">[flatcntr:HoofSlaapKamer/relay/0/set:command:*:MAP(OFF0ON1.map)],<[flatcntr:HoofSlaapKamer/relay/0:state:MAP(0OFF1ON.map)]"}
Switch      MasterBedroom_Light         "Room Light"                <light>                          (MasterBedroom)                           ["Lighting"]                     {mqtt=">[flatcntr:HoofSlaapKamer/relay/1/set:command:*:MAP(OFF0ON1.map)],<[flatcntr:HoofSlaapKamer/relay/1:state:MAP(0OFF1ON.map)]"} 
Number      MasterBedroom_Humidity      "Humidity"                  <humidity>                       (MasterBedroom, gHumidity)                       
Number      MasterBedroom_Temperature   "Temperature"               <temperature>                    (MasterBedroom, gTemperature)                    
Switch      MasterBedroom_Fan_Light     "Fan Light"                 <fan_ceiling>                    (MasterBedroom)                                                            {channel="mqtt:topic:mosquitto:MasterBedroom:Fan_Light"}
Number      MasterBedroom_Fan_spd       "Fan Speed"                 <fan_ceiling>    mappings=[0=“Off”, 1=“Slow”, 2=“Med”, 3=“High”]                (MasterBedroom)                                                            {channel="mqtt:topic:mosquitto:MasterBedroom:Fan_SPD"}
  • Sitemap configuration related to the issue
sitemap flat1 label="flat1" {
    Frame {
        Group item=Bathroom
        Group item=Speedtest
        Group item=FamilyRoom
        Group item=GuestRoom
        Group item=HomeCinema
        Group item=Hallway
        Group item=Kitchen
        Group item=MasterBedroom
        Group item=Outside
        Group item=Terrace
        Group item=test
        Group item=System
        Group item=Alarm
        Group item=Pool
        Group item=Apple
        Group item=gOpenWeatherMap
        Group item=Astro
        Group item=Sonoff
    }

    Frame {
        Text label="Light" icon="light" {
            Default item=Bathroom_Light label="Bathroom"
            Default item=Corridor_Light label="Corridor"
            Default item=FamilyRoom_Light label="Family Room"
            Default item=GuestRoom_Light label="Guest Room"
            Default item=Hallway_Light label="Hallway"
            Default item=Kitchen_Light label="Kitchen"
            Default item=MasterBedroom_Light label="Master Bedroom"
            Default item=Outside_Light label="Outside"
            Default item=Terrace_Light label="Terrace"
        }

        Text label="Fan" icon="fan_ceiling" {
            Default item=Bathroom_Fan label="Bathroom"
            Default item=FamilyRoom_Fan label="Family Room"
            Default item=GuestRoom_Fan label="Guest Room"
        }

        Text label="Heating" icon="heating" {
            Default item=Bathroom_Heating label="Bathroom"
        }

        Text label="Temperature" icon="temperature" {
            Default item=Bathroom_Temperature label="Bathroom"
            Default item=Corridor_Temperature label="Corridor"
            Default item=FamilyRoom_Temperature label="Family Room"
            Default item=GuestRoom_Temperature label="Guest Room"
            Default item=Kitchen_Temperature label="Kitchen"
            Default item=MasterBedroom_Temperature label="Master Bedroom"
            Default item=Outside_Temperature label="Outside"
        }

        Text label="Humidity" icon="humidity" {
            Default item=Bathroom_Humidity label="Bathroom"
            Default item=Corridor_Humidity label="Corridor"
            Default item=FamilyRoom_Humidity label="Family Room"
            Default item=GuestRoom_Humidity label="Guest Room"
            Default item=Kitchen_Humidity label="Kitchen"
            Default item=MasterBedroom_Humidity label="Master Bedroom"
            Default item=Outside_Humidity label="Outside"
        }
    }


}

  • Services configuration related to the issue
    MQtt 2.4
Bridge mqtt:broker:mosquitto "MQTT Broker"              [ host="192.168.1.5", port=1883, clientid="openhab", secure=false]
{
Thing topic materbedroom "MasterBedroom"{
    Channels:
    Type switch : lamp                              "Main_Light"                [ stateTopic="HoofSlaapKamer/relay/0:state", commandTopic="HoofSlaapKamer/relay/0/set" ]
    Type switch : downlight                         "downlight"                 [ stateTopic="HoofSlaapKamer/relay/1:state", commandTopic="HoofSlaapKamer/relay/1/set" ]
    Type number : temp                              "MasterBedroom Temp"        [ stateTopic="HoofSlaapKamer/Temperature"] 
    Type number : humi                              "MasterBedroom Humidity"    [ stateTopic="HoofSlaapKamer/Humidity"]
    Type switch : Fan_Light                         "Fan on/off"                [stateTopic="stat/sonoff_MBR_fan/POWER1", commandTopic="cmnd/sonoff_MBR_fan/power", transformationPattern="MAP:OFF0ON1.map" , on="ON", off="OFF"]
    Type number : Fan_SPD                           "Fan Speed"                 [stateTopic="stat/sonoff_MBR_fan/RESULT", commandTopic="cmnd/sonoff_MBR_fan/FanSpeed"]
      }
     
//Thing topic mything "Book_shelf"{
     //  Channels:
     //      Type switch : bookshelf                         "bookshels"                 [ stateTopic="Bookshelf/relay/0:state", commandTopic="HoofSlaapKamer/relay/0/set" ]
     //     Type switch : outside                           "outside"                   [ stateTopic="Bookshelf/relay/1:state", commandTopic="HoofSlaapKamer/relay/1/set" ]
     //}

Thing  topic switch_healty "Swiches_Health"{
     Channels:
     Type string : sparebedroom_ver                  "Version"                   [ stateTopic="SpaarKamer/version" ]
     Type string : sparebedroom_ip                    "IP"                       [ stateTopic="SpaarKamer/ip"]   
     Type string : sparebedroom_up                    "Up-time"                  [ stateTopic="SpaarKamer/uptime"]
     }
}

vs code gives me a problem like this :

{
	"resource": "/home/openhab/Desktop/Backups/05-04-2019/Edited/items/MasterBedroom.items",
	"owner": "_generated_diagnostic_collection_name_#0",
	"code": "org.eclipse.xtext.diagnostics.Diagnostic.Syntax",
	"severity": 8,
	"message": "missing EOF at 'mappings'",
	"startLineNumber": 8,
	"startColumn": 86,
	"endLineNumber": 8,
	"endColumn": 94
}

not sure what is to be done ? I have searched the forum. and came to this Topic. but looks like it is a dead topic. I tried to use this configs but still no luck.

This is wrong, there is no such option as mappings in an .items file. The Part

mappings=[0=“Off”, 1=“Slow”, 2=“Med”, 3=“High”]

is .sitemap only
Please be aware that even this is wrong, as there are wrong quotation marks used.

ok so i have to use the mappings in the site map and not in the items . sorry this is the first time I am trying the mappings link.

Thank you .
I am redoing my sitemap. as i only used groupes and pulled everything out of my item files. And everything is working now.