Problem with MAP in rule

  • Platform information:
    • Hardware: Rpi4 4GB
    • OS: OH 3.1

Hello

I’m ussing Wemos + IR + Tasmota to power ON/OFF my old TV.

Wemos and connection to OH mqqt broker work fine. I can send ir codes from mainUI but I would like to create rule to send difrend codes from map file and it is not working :frowning:

rule "TV on/off"
when 
    Item Dummy_TV_Samsung_POWER changed to OFF 
    WemosIRTVSamsung_TVSamsungIRCMD.sendCommand("MAP","tvsamsung.map",receivedCommand.toString)
    //logInfo("RULE","<-- TV on/off")
end
TVON        = {"Protocol":"SAMSUNG","Bits":32,"Data":"0xE0E09966","DataLSB":"0x7079966","Repeat":0}
TVOFF       = {"Protocol":"SAMSUNG","Bits":32,"Data":"0xE0E019E6","DataLSB":"0x7079867","Repeat":0}
MUTE        = {"Protocol":"SAMSUNG","Bits":32,"Data":"0xE0E0F00F","DataLSB":"0x7070FF0","Repeat":0}
VOLUP       = {"Protocol":"SAMSUNG","Bits":32,"Data":"0xE0E0E01F","DataLSB":"0x70707F8","Repeat":0}
VOLDOWN     = {"Protocol":"SAMSUNG","Bits":32,"Data":"0xE0E0D02F","DataLSB":"0x7070BF4","Repeat":0}
CHUP        = {"Protocol":"SAMSUNG","Bits":32,"Data":"0xE0E048B7","DataLSB":"0x70712ED","Repeat":0}
CHDOWN      = {"Protocol":"SAMSUNG","Bits":32,"Data":"0xE0E008F7","DataLSB":"0x70710EF","Repeat":0}
INPUT_TV    = {"Protocol":"SAMSUNG","Bits":32,"Data":"0xE0E0D827","DataLSB":"0x7071BE4","Repeat":0}
INPUT_HDMI  = {"Protocol":"SAMSUNG","Bits":32,"Data":"0xE0E09768","DataLSB":"0x707E916","Repeat":0}



Maybe someone could help me ?

Your rule appears to missing a then statement.

There is no receivedCommand implicit variable unless the rule has a received command trigger, it just doesn’t exist.

If you want to transform you must use the transform() keyword
someItem.sendCommand( transform("MAP", etc etc) )

I’ve got then statement i my rule but THANK YOU VERY MUCH :slight_smile:

I forget TRANSFORM() keyword :confused: :flushed: :disappointed:

I lost half a day trying …

Working rule:

rule "TV on/off"
when 
    Item Dummy_TV_Samsung_POWER changed to OFF
    then
        WemosIRTVSamsung_TVSamsungIRCMD.sendCommand(transform("MAP","tvsamsung.map","TVOFF"))
    //logInfo("RULE","<-- TV on/off")
end