Expect script to ssh into MMI

Guys,
I know this is tricky.. I'm trying to write a script to pull info from a MMI device.
Following script logins into the server and then changes to super user. Opens MMI session and then exits out. I need to run the command under the MMI session "dsp_alarm_span all" Is there any other way to do this?

 
#!/usr/bin/env expect -f
set timeout -1
set stty_init -echo
spawn ssh 10.242.112.100 -l loginuser
#match_max 100000
expect "Password:"
send -- "asdfgh\r"
send -- "\r"
expect "loginuser@mcoa:~$ "
send -- "su - root\r"
expect "Password:"
send -- "qwerty\r"
 
expect "root@mcoa:~#"
send -- "/usr/local/bin/mmi_cmd\r"
 
 
expect -exact "MMI>"
 
send -- "dsp_alarm_span all\r"
 
send -- "exit\r"

You can try...

ssh -l root 10.242.112.100  '/usr/local/bin/mmi_cmd;dsp_alarm_span all'

but ssh will prompt for the password, so you're still in expect territory if you want it fully automated. You can get around this by using public/private keys.

No luck with the above command.

can I atleast automate till loging as root. By the way I can't login directly as root. I need to be loginuser first.

using expect script it exits out