in you .lircrc file add..
begin
prog = irexec
remote = RM-887
button = SHUTDOWN
config = sudo shutdown -h now
end
get the button from irw – my on off was called off/on <- i suspect the backslash causes issues so i renamed it SHUTDOWN in my lircd.conf.