BroadLink Mark II plugin

Mr, Lurker, I have the below code (in large part re-purposed from your code posting :slight_smile: ) that creates a table of raw IR codes and a table of steps to run the codes.
Everything works except the mini IR does not respond to the program. I can copy the sent code from my openLuup log, paste it into the “Actions” sendCode action on the Altui screen, and the code works. However the codes do not work programmatically. I’m running this test code on the latest openLuup development version (in the test screen).

Beyond excessive verbosity in my code :P, can you see if anything is amiss here. I tried calling the SendCode method using both a command table key/value reference and a variable created from the command table— with no joy.

Edit: problem was that I was passing a string to the action method and not a table. It’s now fixed in the below code and all works well. Thx for the plugin

--function turnOnBedroomActi ()
  
local TVdeviceID = 10516 -- Bedroom Vizio power outlet 
local IRDeviceID = 143 -- Broadlink RM3


-- Steps to turn on your device (using broadlink codes)

local bSteps = {
-- Turn TV ON from now live outlet (should match 5 second delay from above for correct log info)
{bDelay = 5, bCommand = "OnOff"},

-- wait another 60 seconds for TV and firestick to boot from tv on/off
--Assume Firestick is on screen  - no way to know with broadlink
-- Press down and 
{bDelay = 60,  bCommand = "Down"},

-- Press down and 
{bDelay = 1,  bCommand = "Down"},

-- Press down and 
{bDelay = 1,  bCommand = "Down"},

-- Press OK on Acti app and 
{bDelay = 1,  bCommand = "OK"},

--  Press OK on NVR and 
{bDelay = 4,  bCommand = "OK"},

-- wait 4 seconds Press down and 
{bDelay = 4,  bCommand = "Down"},

-- wait 1 second Press down and 
{bDelay = 1,  bCommand = "Down"},

-- wait 1 second Press down and 
{bDelay = 1,  bCommand = "Down"},

-- wait 1 second Press OK on Acti view 
{bDelay = 1,  bCommand = "OK"}

}
local BroadLinkCodes={
	OnOff={
	buttonId= 1,
  bName="OnOff",
	bCode= {38, 0, 88, 0, 0, 1, 42, -108, 20, 18, 20, 17, 20, 55, 19, 18, 20, 17, 20, 17, 20, 18, 25, 12, 20, 54, 20, 55, 20, 17, 20, 55, 19, 55, 20, 55, 19, 56, 20, 54, 19, 18, 21, 17, 19, 18, 19, 56, 20, 17, 20, 17, 20, 18, 19, 18, 19, 55, 20, 55, 20, 55, 20, 17, 20, 54, 21, 54, 19, 55, 21, 54, 20, 0, 5, 11, 0, 1, 43, 73, 20, 0, 12, 83, 0, 1, 41, 74, 19, 0, 13, 5}},
	Down={
	buttonId= 2,
  bName="Down",
	bCode= {38, 0, 88, 0, 0, 1, 44, -108, 21, 17, 19, 18, 20, 55, 20, 17, 19, 18, 20, 17, 20, 18, 19, 18, 19, 55, 21, 54, 20, 17, 20, 55, 20, 54, 20, 55, 20, 54, 21, 54, 20, 17, 20, 55, 20, 54, 20, 18, 19, 18, 20, 17, 20, 54, 21, 17, 19, 56, 20, 17, 19, 18, 20, 55, 20, 54, 20, 55, 19, 18, 19, 56, 19, 0, 5, 12, 0, 1, 41, 74, 20, 0, 12, 83, 0, 1, 42, 73, 22, 0, 13, 5}}, 
  Up={
	buttonId= 3,
  bName="Up",
	bCode= {38, 0, -112, 0, 0, 1, 42, -108, 19, 18, 20, 17, 19, 56, 20, 17, 20, 17, 22, 16, 19, 18, 19, 18, 20, 55, 20, 54, 20, 17, 20, 55, 20, 55, 19, 55, 20, 55, 20, 54, 20, 55, 20, 17, 19, 56, 20, 17, 19, 18, 20, 18, 20, 54, 20, 17, 20, 18, 20, 54, 20, 17, 21, 54, 20, 54, 21, 54, 19, 18, 20, 55, 20, 0, 9, -34, 0, 1, 41, -107, 20, 17, 20, 17, 19, 56, 20, 17, 19, 18, 20, 18, 19, 18, 19, 18, 19, 56, 19, 55, 19, 18, 21, 54, 19, 56, 20, 54, 20, 55, 20, 54, 20, 55, 20, 17, 19, 56, 20, 17, 20, 17, 20, 17, 20, 55, 20, 17, 20, 18, 20, 54, 20, 17, 20, 55, 20, 55, 20, 54, 20, 17, 20, 55, 20, 0, 13, 5, 0, 0, 0, 0, 0, 0, 0, 0}}, 
	Right={
	buttonId = 4,
  bName="Right",
	bCode= {38, 0, 80, 0, 0, 1, 41, -108, 21, 17, 20, 17, 19, 56, 19, 18, 19, 18, 19, 18, 20, 18, 19, 18, 20, 54, 21, 54, 20, 17, 20, 55, 20, 54, 20, 55, 20, 54, 20, 55, 20, 17, 20, 18, 20, 17, 20, 54, 20, 18, 19, 18, 20, 55, 20, 17, 19, 55, 20, 55, 20, 55, 20, 17, 19, 55, 20, 55, 20, 17, 20, 55, 20, 0, 5, 11, 0, 1, 42, 73, 20, 0, 13, 5, 0, 0, 0, 0, 0, 0, 0, 0}}, 
	Left={
	buttonId = 5,
  bName="Left",
	bCode= {38, 0, 80, 0, 0, 1, 41, -110, 23, 17, 20, 17, 20, 55, 20, 17, 19, 18, 19, 18, 20, 18, 20, 17, 19, 56, 19, 55, 19, 18, 20, 55, 20, 54, 21, 54, 19, 56, 19, 55, 20, 55, 20, 54, 19, 56, 19, 18, 19, 18, 19, 19, 19, 55, 19, 18, 20, 18, 20, 17, 20, 17, 19, 56, 19, 55, 19, 56, 19, 18, 19, 56, 19, 0, 5, 12, 0, 1, 41, 74, 19, 0, 13, 5, 0, 0, 0, 0, 0, 0, 0, 0}}, 
	OK={
	buttonId= 6,
  bName="OK",
	bCode= {38, 0, 80, 0, 0, 1, 41, -108, 20, 18, 20, 17, 20, 54, 20, 18, 19, 18, 20, 17, 20, 17, 20, 18, 19, 55, 20, 55, 20, 17, 19, 56, 20, 54, 20, 55, 20, 54, 20, 55, 20, 17, 19, 18, 20, 55, 20, 17, 20, 17, 20, 18, 19, 55, 20, 17, 20, 55, 20, 54, 21, 17, 22, 52, 20, 55, 19, 55, 20, 18, 20, 54, 20, 0, 5, 11, 0, 1, 42, 74, 20, 0, 13, 5, 0, 0, 0, 0, 0, 0, 0, 0}}, 
	Back={
	buttonId= 7,
  bName="Back",
	bCode= {38, 0, 80, 0, 0, 1, 42, -108, 20, 17, 19, 18, 20, 55, 20, 17, 20, 17, 20, 18, 20, 17, 20, 17, 19, 56, 19, 55, 20, 18, 20, 54, 20, 55, 20, 54, 20, 55, 19, 55, 20, 55, 20, 17, 19, 19, 19, 55, 20, 17, 20, 18, 19, 55, 20, 17, 20, 18, 19, 55, 20, 55, 20, 17, 20, 55, 19, 55, 20, 18, 19, 55, 20, 0, 5, 11, 0, 1, 42, 74, 20, 0, 13, 5, 0, 0, 0, 0, 0, 0, 0, 0}}, 
  One={
	buttonId= 8,
  bName="One",
	bCode= {38, 0, 80, 0, 0, 1, 42, -109, 21, 17, 20, 17, 19, 56, 20, 17, 20, 17, 20, 17, 20, 18, 20, 17, 20, 54, 20, 55, 20, 17, 19, 56, 20, 54, 20, 55, 20, 54, 21, 54, 20, 55, 19, 18, 19, 18, 20, 17, 20, 55, 20, 17, 19, 18, 21, 17, 20, 17, 20, 55, 19, 55, 19, 56, 20, 17, 20, 54, 20, 55, 20, 54, 20, 0, 5, 12, 0, 1, 42, 73, 20, 0, 13, 5, 0, 0, 0, 0, 0, 0, 0, 0}}, 
	Two={
	buttonId= 9,
  bName="Two",
	bCode= {38, 0, 80, 0, 0, 1, 43, -109, 20, 18, 19, 18, 19, 55, 21, 17, 19, 18, 19, 18, 20, 18, 20, 17, 19, 55, 20, 55, 20, 17, 20, 55, 20, 54, 20, 55, 20, 54, 20, 55, 19, 18, 19, 56, 20, 17, 20, 17, 20, 55, 20, 17, 20, 17, 20, 18, 20, 54, 20, 18, 19, 55, 20, 55, 20, 17, 19, 55, 20, 55, 20, 54, 20, 0, 5, 11, 0, 1, 42, 74, 20, 0, 13, 5, 0, 0, 0, 0, 0, 0, 0, 0}}, 
	Three={
	buttonId= 10,
  bName="Three",
	bCode= {38, 0, 80, 0, 0, 1, 42, -108, 20, 17, 19, 18, 20, 55, 19, 18, 20, 17, 20, 17, 20, 18, 19, 18, 19, 56, 20, 54, 19, 18, 20, 55, 20, 54, 21, 54, 19, 56, 20, 54, 19, 56, 20, 54, 19, 19, 19, 18, 19, 55, 20, 18, 20, 17, 20, 17, 19, 18, 20, 18, 20, 54, 19, 56, 20, 17, 19, 56, 20, 54, 19, 56, 19, 0, 5, 12, 0, 1, 42, 73, 20, 0, 13, 5, 0, 0, 0, 0, 0, 0, 0, 0}}, 
	Four={
	buttonId= 11,
  bName="Four",
	bCode= {38, 0, 80, 0, 0, 1, 42, -108, 20, 18, 20, 17, 19, 55, 20, 18, 19, 18, 19, 18, 20, 18, 19, 18, 19, 55, 20, 55, 19, 18, 20, 55, 20, 54, 20, 55, 19, 55, 21, 54, 19, 18, 20, 18, 19, 55, 19, 18, 20, 55, 19, 18, 20, 17, 21, 17, 20, 54, 20, 55, 20, 17, 19, 56, 19, 18, 20, 54, 21, 54, 20, 54, 21, 0, 5, 11, 0, 1, 42, 73, 20, 0, 13, 5, 0, 0, 0, 0, 0, 0, 0, 0}}, 
	Five={
	buttonId= 12,
  bName="Five",
	bCode= {38, 0, 80, 0, 0, 1, 42, -108, 20, 17, 19, 19, 20, 54, 19, 18, 20, 18, 20, 17, 19, 18, 20, 17, 20, 55, 20, 55, 20, 17, 19, 55, 20, 55, 20, 54, 21, 54, 19, 56, 20, 54, 20, 17, 20, 55, 20, 17, 20, 55, 19, 18, 20, 17, 19, 19, 20, 17, 19, 55, 20, 18, 19, 55, 20, 17, 21, 54, 19, 56, 20, 54, 20, 0, 5, 11, 0, 1, 43, 73, 20, 0, 13, 5, 0, 0, 0, 0, 0, 0, 0, 0}}, 
	Six={
	buttonId= 13,
  bName="Six",
	bCode= {38, 0, 80, 0, 0, 1, 42, -108, 20, 18, 20, 17, 19, 55, 21, 17, 19, 18, 20, 17, 19, 19, 19, 18, 20, 54, 20, 55, 19, 18, 20, 55, 19, 55, 20, 55, 20, 54, 20, 55, 20, 17, 19, 56, 20, 54, 20, 18, 20, 54, 20, 17, 20, 18, 20, 17, 20, 54, 20, 18, 20, 17, 19, 55, 20, 18, 19, 55, 20, 55, 20, 54, 20, 0, 5, 11, 0, 1, 43, 73, 19, 0, 13, 5, 0, 0, 0, 0, 0, 0, 0, 0}}, 
	Seven={
	buttonId= 14,
  bName="Seven",
	bCode= {38, 0, 80, 0, 0, 1, 42, -108, 20, 17, 20, 17, 20, 55, 20, 17, 19, 18, 20, 18, 19, 18, 20, 17, 20, 55, 19, 55, 20, 18, 20, 54, 20, 55, 19, 55, 20, 55, 19, 55, 21, 54, 20, 55, 20, 54, 19, 18, 20, 55, 20, 17, 20, 17, 21, 17, 19, 18, 20, 17, 20, 18, 20, 54, 20, 17, 20, 55, 20, 54, 20, 55, 19, 0, 5, 12, 0, 1, 42, 74, 20, 0, 13, 5, 0, 0, 0, 0, 0, 0, 0, 0}}, 
	Eight={
	buttonId= 15,
  bName="Eight",
	bCode= {38, 0, 80, 0, 0, 1, 43, -109, 20, 17, 20, 18, 19, 55, 20, 17, 20, 18, 19, 18, 20, 17, 20, 18, 19, 55, 20, 55, 20, 17, 19, 55, 21, 54, 19, 56, 19, 55, 20, 55, 19, 18, 20, 17, 19, 18, 20, 55, 20, 55, 19, 16, 21, 18, 19, 18, 20, 55, 19, 55, 20, 55, 20, 17, 20, 18, 20, 54, 20, 55, 20, 54, 20, 0, 5, 11, 0, 1, 42, 74, 20, 0, 13, 5, 0, 0, 0, 0, 0, 0, 0, 0}}, 
	Nine={
	buttonId= 16,
  bName="Nine",
	bCode= {38, 0, 80, 0, 0, 1, 41, -108, 21, 16, 21, 17, 19, 56, 19, 18, 19, 18, 19, 18, 20, 18, 20, 17, 19, 55, 20, 55, 20, 17, 20, 55, 20, 54, 20, 55, 19, 55, 20, 55, 20, 54, 20, 18, 19, 18, 19, 56, 20, 54, 20, 17, 20, 18, 20, 17, 19, 18, 19, 56, 19, 55, 20, 18, 19, 18, 19, 55, 20, 55, 20, 54, 20, 0, 5, 11, 0, 1, 43, 73, 19, 0, 13, 5, 0, 0, 0, 0, 0, 0, 0, 0}}, 
	Zero={
	buttonId= 17,
  bName="Zero",
	bCode= {38, 0, 80, 0, 0, 1, 42, -108, 20, 17, 21, 17, 19, 55, 20, 17, 21, 17, 20, 17, 19, 18, 20, 18, 20, 54, 19, 56, 20, 17, 20, 54, 21, 54, 19, 55, 21, 54, 20, 55, 19, 18, 20, 17, 19, 18, 20, 18, 19, 55, 19, 18, 20, 18, 19, 18, 19, 55, 21, 54, 19, 56, 20, 54, 20, 17, 19, 56, 19, 55, 20, 55, 20, 0, 5, 11, 0, 1, 42, 73, 20, 0, 13, 5, 0, 0, 0, 0, 0, 0, 0, 0}}, 
	Menu={
	buttonId= 18,
  bName="Menu",
	bCode= {38, 0, 88, 0, 0, 1, 43, -109, 20, 17, 20, 17, 20, 55, 20, 17, 19, 19, 20, 17, 19, 18, 19, 18, 20, 55, 20, 54, 20, 18, 19, 55, 20, 55, 19, 55, 20, 55, 20, 54, 20, 55, 20, 54, 21, 54, 20, 55, 19, 18, 20, 17, 19, 56, 20, 17, 20, 17, 19, 19, 19, 18, 19, 18, 19, 56, 19, 55, 20, 17, 20, 55, 19, 0, 5, 12, 0, 1, 42, 72, 21, 0, 12, 83, 0, 1, 41, 74, 19, 0, 13, 5}}, 
	Exit={
	buttonId= 19,
  bName="Exit",
	bCode= {38, 0, 88, 0, 0, 1, 43, -109, 20, 17, 20, 18, 19, 55, 19, 18, 21, 17, 19, 18, 19, 18, 20, 18, 19, 55, 20, 55, 19, 18, 20, 55, 20, 54, 20, 55, 20, 54, 19, 56, 19, 55, 21, 17, 20, 17, 19, 55, 21, 17, 19, 18, 20, 55, 19, 18, 19, 18, 20, 55, 20, 54, 20, 18, 19, 55, 19, 56, 20, 17, 20, 54, 21, 0, 5, 11, 0, 1, 42, 73, 20, 0, 12, 83, 0, 1, 42, 73, 20, 0, 13, 5}}, 
	Info={
	buttonId= 20,
  bName="Info",
	bCode= {38, 0, 88, 0, 0, 1, 43, -109, 20, 17, 20, 17, 21, 54, 20, 17, 19, 19, 20, 17, 20, 17, 19, 18, 20, 55, 19, 56, 20, 17, 20, 54, 26, 49, 19, 55, 20, 55, 19, 56, 20, 54, 19, 56, 19, 18, 19, 56, 19, 55, 20, 17, 20, 18, 19, 18, 19, 18, 20, 18, 20, 54, 20, 17, 20, 18, 19, 55, 20, 55, 19, 55, 20, 0, 5, 11, 0, 1, 43, 73, 20, 0, 12, 82, 0, 1, 43, 73, 20, 0, 13, 5}}
}


local function allmatching(tbl, kvs)
  return function(t, key)
    repeat
      key, row = next(t, key)
      if key == nil then
        return
      end
      for k, v in pairs(kvs) do
        if row[k] ~= v then
          row = nil
          break
        end
      end
    until row ~= nil
    return key, row
  end, tbl, nil
end


local function decIR2Hex(decCode)

    local hexTab = {}
   
    for _,val in ipairs(decCode) do
        -- handle negative values: eg 433MHz leadin sendCode is 0xb2 ie 178dec, In the e-control json, it is -78dec. So 256+(-78) = 178dec = 0xb2
        if (val < 0) then val = 256 + val end
        table.insert(hexTab, string.format('%02x', val))
    end
  -- send converted hexTab to action
   return (table.concat(hexTab,' '))
end

local function BroadLinkConverter(commandName)
-- search table for command, return code as listed (you obtain the codes from the Broadlink app)

  for _, r in allmatching(BroadLinkCodes, { bName= commandName}) do
    local myCode =r.bCode
    myCode = decIR2Hex(myCode)
  return myCode --translated command code
  end
 
end

function sendCommand(stepNumber)
  stepNumber = tonumber(stepNumber)
  luup.log('INC STEP NUMBER ' .. stepNumber,50)
  luup.log('CALL DELAY COMMAND '.. myCommandTable[stepNumber][1],50)   
  luup.log('CALL DELAY TIME ' .. myCommandTable[stepNumber][2],50)  
  luup.log('COMMAND CODE ' .. myCommandTable[stepNumber][3],50)
  local resultCode, resultString, job = luup.call_action('urn:a-lurker-com:serviceId:IrTransmitter1', 'SendCode', {Code =myCommandTable[stepNumber][3]} , IRDeviceID)
  luup.log('RETURN MESSAGES '.. resultCode .. ' ' .. resultString .. ' ' .. job)
  stepNumber = stepNumber + 1
  if (not myCommandTable[stepNumber]) then luup.log('IR FINISHED',50) return end
  local timeString = ""
  if  myCommandTable[stepNumber][2] > 1 then timeString = " SECONDS" else timeString = " SECOND" end
  luup.log('WILL NOW WAIT ' .. myCommandTable[stepNumber][2] .. timeString,50)  
  luup.call_delay('sendCommand', myCommandTable[stepNumber][2], tostring(stepNumber))
end
local function buildTransmitTable(bStepTable)
  local myCommand = "" myDelay = 0 sendCode = ""
  myCommandTable = {}
  for k, v in pairs(bStepTable) do
    if v ~= nil then
      myCommand = v.bCommand
      myDelay = v.bDelay
      sendCode = BroadLinkConverter(myCommand)
      local myData = {myCommand, myDelay, sendCode}
      myCommandTable[k] = myData -- table of sequential codes to send along with delay times.
    end
  end
      -- Turn TV power on 
local resultCode, resultString, job, returnArguments = luup.call_action("urn:upnp-org:serviceId:SwitchPower1","SetTarget",{ newTargetValue="1" },TVdeviceID)
if resultCode ~= 0 then luup.call_action("urn:upnp-org:serviceId:SwitchPower1","SetTarget",{ newTargetValue="1" },TVdeviceID) end

local afterPowerOnDelay = myCommandTable[1][2]  -- wait 5 seconds for TV to boot from electric power on
--wait afterPowerOnDelay seconds to allow power-up and start sending broadlink commands
luup.call_delay('sendCommand', afterPowerOnDelay,"1")

return true
end

buildTransmitTable(bSteps)
--end  

Hello Buxton

Edit: Looks like you beat me to it but:

Minor mod here should help:

[code]-- Old
local resultCode, resultString, job = luup.call_action(‘urn:a-lurker-com:serviceId:IrTransmitter1’, ‘SendCode’, mySendCode , IRDeviceID)

– New
local resultCode, resultString, job = luup.call_action(‘urn:a-lurker-com:serviceId:IrTransmitter1’, ‘SendCode’, {Code=mySendCode} , IRDeviceID)
[/code]

Also be careful that IRDeviceID is the actual IR transmitter, not the parent BroadLink device.

Another trap with this:
If you run the code above, in the AltUI run window on a Vera device, it will fail to load at all.
If you run the code in the UI7 run window on a Vera device, it will execute (plus/minus any bugs).
If you run the code above, in the AltUI run window on an openLuup device, it will execute (plus/minus any bugs).

It’s something to do with the Vera Firmware and the length of the overall code or the maximum length of a line. I’m not sure which but I suspect the latter.

Happy New Year

OK, cool. Thank you for looking at it. The code seems to be running fine on openLuup. Are you saying that because of the length of the codes, the script might not run natively on a Vera?

Happy New Years to you too!!

Are you saying that because of the length of the codes, the script might not run natively on a Vera?

No - it appears to be just a problem of transferring the code text from the browser to the hardware, when using the Lua test window.

Ok

Hello,

I had replaced on warranty two of my RM PRO devices after they failed (hardware).

The new Rm Pro(S) (same type of devices) are working ok but the deffective ones remains as “ghosts” in the interface (UI7).
Despite I delete them from time to time they appear back (a temperature sensor with no indication and ir device from same mac address)
How can I get rid of those ghost devices?

I delete them from time to time they appear back

Delete the contents of the variable “BroadLinkDevices”, save that and then restart the Luup Engine. After that takes effect (can take a few minutes), restart your browser. Basically the plugin still thinks you have the old devices installed and needs to be told they are gone.

Hello, thank you for help. It worked last fix that you suggested.

I had to reset to factory my vera unit and after restoring a backup I can’t get working the Broadlink Mark II. It appears in devices, i see the devices but the temperature is fixed (on RM PRO) SC1 doesn’t do anything.
What I have tried:
restarted unit / router and each broadlink device…

  • edit variable “BroadlinkDevices” with the correct ips form my router after identifying their macs. (no succes)
  • deleted all the contents “broadlinkdevices” + luup engine restart (no succes)
  • deleted the SC1 device (did not appear back)

i mention that all devices are working fine from other sources (ihc app, alexa…etc)
what should I try next?

@alurker, thanks for the excellent plugin - I have used it for quite a while now and it works great. That said, I have modified the plugin to support RM4 devices and the new RM3 devices that require a payload header/prefix for certain requests and responses. I have tested the modified plugin on an RM3 Pro+, and RM3a Mini and an RM4b Mini. I have submitted a GitHub pull request to your repo for your review. Cheers.

@blacey

Pleased to see you are making good use of the plugin. You might want to give us some idea of what all these black beans are doing. You seem to have your hand on a few of them.

Thanks for the pull request. I’ve been slow to act on it. Seems there is a bigger problem in the world at this time. I also wanted to add some of my own mods. Regardless GitHub has now been updated and thank you for your contribution. Have you any idea why Broadlink now needs the header stuff for some the new devices?

My sensors is still going along nicely, so that’s great work.

2 Likes

I use most of them to turn my wife’s candles on and off throughout our home. She loves the ambiance and tuning them by sunset/sleep works much better than the candles fairly unintelligent built-in timer.

No worries - thank for incorporating it into your main version. The delay allowed me to add a couple more broad link devices that require the new headers :wink:

Broadlink has evolved the protocol to require these new headers and in some cases, once an IR blaster is paired with the cloud, it no longer accepts local network requests - users have to actually remove it from their cloud account using the Broadlink App.

Hi,

First time poster to this forum.

Just trying to get to grips with using the plugin and the first question is if it will work with the RM4 Pro. I am running this under ALTUI as recommended

I have uploaded the files from GitHub as described in one of the earlier emails, using version 0.55

  1. Restarted Luup engine
  2. Create device using D_BroadLink_Mk2_1.xml and Upnp Implementation Filename: I_BroadLink_Mk2_1.xml
  3. run the code luup.reload()

Device created but no devices found

  1. Added to device variable
    {“24:df:a7:d3:2c:05”: {“blInternalId”: “???”,“blKey”:“097628343fe99e23765c1513accf8b02”,“blDeviceType”: 10119,“blIp”:“192.168.1.111”,“blDesc”: “RM4 PRO”}}
    using MAC address and IP address of Broadlink RM4 unit
  2. Restarted Luup engine

Still no devices found?

If I need to post logs do I just tail the last 50 lines or use a search string?

Thanks

The RM4 Pro appears to be a fairly recent model. When was it purchased? I suspect I need to provide support for it.

Here’s a list of current models:

GitHub BroadLink Python

and here’s what this plugin supports:

GitHub BroadLink Mk2

Set the ‘DebugEnabled’ flag to 1, save and restart the Luup Engine and search the log for the string: ‘is not known to this plugin’.

You’ll probably find that it says:

‘The BroadLink device at IP address … and of type 0x61a2 is not known to this plugin’

Don’t forget to turn debugging off again.

I need to know the the value shown - I expect it to be: 0x61a2

Some of the new Broadlink devices seem to allow some weird lead that has a humidity & temp sensor to be plugged in. I have no plans to support this lead.

2 Likes

^^^ The RM4 has been around for about 12 months now, it’s main bitch is that the protocols have been changed and don’t work with either Vera Plug In, it also appears not to come with an AC adaptor as the RM3 did and doesn’t work with other equipment that the RM3 worked with, consequently up take has been slow.
I’ve been debating whether to stock these again but with the poor exchange rate it’s not feasible presently.
Painful really as the RM3 was perfect for HA use and there was no need for an upgraded version, it also appears after months of searching there are few if any alternatives that are certified FCC. (if anyone knows of any I’d be delighted to hear from you)

It seems according to the GitHub BroadLink Python there are a few RM4 Pro versions. The Vera plugin was updated to suit a change in protocol for some of the RM3’s, so I suspect the RM4 Pros have the same protocol changes. If I get the ID number (eg like the 0x61a2 discussed above) we can try it out.

In variables I set

  1. Broadlink devices set to {“24:df:a7:d3:2c:05”:{“blInternalId”:“???”,“blKey”:“097628343fe99e23765c1513accf8b02”,“blDeviceType”:10119,“blIp”:“192.168.1.111”,“blDesc”:“RM4 Pro”}}
  2. set the DebugEnabled’ flag to 1
  3. reloaded Luup Engine
  4. OS command search for ‘is not know to this plugin’
    command succeed but nothing came back
  5. Also in the message tab it says ‘Controller did not respond
  6. OS command search for ‘Broadlink’ and got back
09 07/01/20 10:25:46.425 JobHandler_LuaUPnP::Run device 57 ptr 0xefc768 Broadlink RM4 PRO room 1 type urn:schemas-a-lurker-com:device:BroadLink_Mk2:1 cat 11:-1 id parent 0/0xf9bf20 upnp: 0 plugin:0 pnp:0 mac: ip: <0x77c55320>
10 07/01/20 10:26:07.476 XXX-UpdateSystemMessagesTasks now 1=Broadlink RM4 PRO[57]: Running Lua Startup timeout 0 (-1593595567) count: 8 pend:Running Lua Startup/err:(null)/done:(null) <0x7707e520>
10 07/01/20 10:26:07.480 XXX-UpdateSystemMessagesTasks now 1=Broadlink RM4 PRO[57]: Running Lua Startup timeout 0 (-1593595567) count: 8 pend:Running Lua Startup/err:(null)/done:(null) <0x7707e520>
10 07/01/20 10:26:07.484 XXX-UpdateSystemMessagesTasks now 1=Broadlink RM4 PRO[57]: Running Lua Startup timeout 0 (-1593595567) count: 8 pend:Running Lua Startup/err:(null)/done:(null) <0x7707e520>
10 07/01/20 10:26:59.335 mg_callback from IP:127.0.0.1:49905 /port_3480/data_request id=lr_ALTUI_Handler&command=oscommand&oscommand=cat%20%2Fvar%2Flog%2Fcmh%2FLuaUPnP.log%20%7C%20grep%20%22Broadlink%22&_=1593595238918 start id: 45 <0x73223520>
12 07/01/20 10:26:59.336 luvd_get_info_data_request starting /data_request?id=lr_ALTUI_Handler&command=oscommand&oscommand=cat%20%2Fvar%2Flog%2Fcmh%2FLuaUPnP.log%20%7C%20grep%20%22Broadlink%22&_=1593595238918 pMem 0x1655000/23416832 diff: 7766016 <0x73223520>

Not sure if I have done something wrong?

in step 4 I did copy and paste your ‘is not known to this plugin’

This won’t help:

{“24:df:a7:d3:2c:05”:{“blInternalId”:“???”,“blKey”:“097628343fe99e23765c1513accf8b02”,“blDeviceType”:10119,“blIp”:“192.168.1.111”,“blDesc”:“RM4 Pro”}}

Just delete it and save.

If you are using AltUI go to Misc–>OsCommand then select ‘Tail logs’ Tab. You get this command:

tail -n 50 /var/log/cmh/LuaUPnP.log

You can change the 50 to say 500 to see more from the log. Do this after a Luup Engine restart. If doing correctly there will be many mentions of BroadLink_Mk2

  1. Deleted {“24:df:a7:d3:2c:05”:{“blInternalId”:“???”,“blKey”:“097628343fe99e23765c1513accf8b02”,“blDeviceType”:10119,“blIp”:“192.168.1.111”,“blDesc”:“RM4 Pro”}}

  2. saved

  3. Reloaded Luup engine

  4. tail -n 1500 /var/log/cmh/LuaUPnP.log

  5. Searched for ‘Broadlink_Mk2’ within tail results

25 07/01/20 13:51:22.510 LuImplementation::StartLua device: 57 file:I_BroadLink_Mk2_1.xml startup:luaStartUp pLuaInterface: 0x1356208 ip: port 0 protocol: raw <0x766d8520>
25 07/01/20 13:51:22.511 LuImplementation::StartLua running startup code for 57 I_BroadLink_Mk2_1.xml <0x766d8520>
50 07/01/20 13:51:22.512 luup_log:57: BroadLink_Mk2 debug: Initialising plugin: BroadLink_Mk2 <0x766d8520>
50 07/01/20 13:51:22.512 luup_log:57: BroadLink_Mk2 debug: Using: Lua 5.1 <0x766d8520>
50 07/01/20 13:51:22.512 luup_log:57: BroadLink_Mk2 debug: 0.55 → PluginVersion <0x766d8520>
50 07/01/20 13:51:22.533 luup_log:57: BroadLink_Mk2 debug: Using: dkjson <0x766d8520>
50 07/01/20 13:51:22.533 luup_log:57: BroadLink_Mk2 debug: 300 → PollInterval <0x766d8520>
50 07/01/20 13:51:22.537 luup_log:57: BroadLink_Mk2 debug: Broadcasting discovery message <0x766d8520>
50 07/01/20 13:51:22.538 luup_log:57: BroadLink_Mk2 debug: 192.168.0.54 <0x766d8520>
50 07/01/20 13:51:23.539 luup_log:57: BroadLink_Mk2 debug: {} → BroadLinkDevices <0x766d8520>
10 07/01/20 13:51:23.544 XXX-UpdateSystemMessagesTasks StartupTask #7 = 4 All OK / BroadLink_Mk2 <0x764d8520>
10 07/01/20 13:51:23.565 XXX-UpdateSystemMessagesTasks StartupTask #7 = 4 OK / BroadLink_Mk2 <0x764d8520>
10 07/01/20 13:51:35.442 mg_callback from IP:127.0.0.1:51882 /port_3480/data_request id=lr_ALTUI_Handler&command=oscommand&oscommand=tail%20-n%201500%20%2Fvar%2Flog%2Fcmh%2FLuaUPnP.log%20%7C%20grep%20-i%20Broadlink_Mk2&_=1593606102636 start id: 32 <0x7247d520>
12 07/01/20 13:51:35.442 luvd_get_info_data_request starting /data_request?id=lr_ALTUI_Handler&command=oscommand&oscommand=tail%20-n%201500%20%2Fvar%2Flog%2Fcmh%2FLuaUPnP.log%20%7C%20grep%20-i%20Broadlink_Mk2&_=1593606102636 pMem 0x182d000/25350144 diff: 7602176 <0x7247d520>

@ Seeker That’s useful info. The ‘Broadcasting discovery message’ was issued but no BroadLink device was found, as indicated by:

50 07/01/20 13:51:23.539 luup_log:57: BroadLink_Mk2 debug: {} --> BroadLinkDevices <0x766d8520>

However some device was found at this debug line (ip address redacted and you may want to do the same in your replies if possible).

50 07/01/20 13:51:22.538 luup_log:57: BroadLink_Mk2 debug: redacted <0x766d8520>

but it could be anything that responds to broadcasts. What is it - your Vera? Then in your previous post, you have:

{“24:df:a7:d3:2c:05”:{“blInternalId”:"???",“blKey”:“097628343fe99e23765c1513accf8b02”,“blDeviceType”:10119,“blIp”:“Redacted”,“blDesc”:“RM4 Pro”}}

given the ip address mentioned; it appears that the Broadlink device is on another sub net? Where it is unlikely to be detected.