When object stoped - do something

I have dice (with rigidbody) and script wich roll and detect dice position. I dont know how detect dice position after rolling. At firs i create variable speed which value is rigidbody velocity.magnitude (i think it detect speed of dice) and according to my plan when dice stoping after rolling in i must see their position in Console. But now when i roll dice i see their position in Console before rolling, not after. I think it because movement start not immediately, after a while. But I’m not sure. How i can resolve my problem?
My script:

using System.Collections;
using UnityEngine;
using System.Collections.Generic;

public class ApplyForceInRandomDirection : MonoBehaviour 
{
	public string buttonName = "Fire1";
	public float forceAmount = 10.0f;
	public float torqueAmount = 10.0f;
	public ForceMode forceMode;
	public List<Vector3> directions;
	public List<int> sideValues;
	public double speed;
	public Rigidbody rb;
	public int diceCount;

	void Start () 
	{
		rb = GetComponent<Rigidbody> ();
	}

	void Update () 
	{
		speed = rb.velocity.magnitude;
		Debug.Log ("The side world up has value: " + diceCount); // it is here temporarily for testing
	}
		
	void FixedUpdate() 
	{
		if (Input.GetButtonDown (buttonName)) 
		{	
			rb.AddForce(Random.onUnitSphere * forceAmount, forceMode);
			rb.AddTorque(Random.onUnitSphere * torqueAmount, forceMode);
			if (speed == 0) 
			{
				if (Vector3.Dot (transform.forward, Vector3.up) > 0.6f)
					diceCount = 6;
				if (Vector3.Dot (-transform.forward, Vector3.up) > 0.6f)
					diceCount = 1;
				if (Vector3.Dot (transform.up, Vector3.up) > 0.6f)
					diceCount = 2;
				if (Vector3.Dot (-transform.up, Vector3.up) > 0.6f)
					diceCount = 5;
				if (Vector3.Dot (transform.right, Vector3.up) > 0.6f)
					diceCount = 3;
				if (Vector3.Dot (-transform.right, Vector3.up) > 0.6f)
					diceCount = 4;
			}
		}	
	}
}

I did some minor changes to code. I moved Input part to Update function, where any inputs should be.
link text

void Update()
    {
        speed = rb.velocity.magnitude;
        Debug.Log("The side world up has value: " + diceCount); // it is here temporarily for testing

        if (Input.GetButtonDown(buttonName))
        {
            rb.AddForce(Random.onUnitSphere * forceAmount, forceMode);
            rb.AddTorque(Random.onUnitSphere * torqueAmount, forceMode);

        }
    }
    void FixedUpdate()
        {
            
                if (speed == 0)
                {
                    if (Vector3.Dot(transform.forward, Vector3.up) > 0.6f)
                        diceCount = 6;
                    if (Vector3.Dot(-transform.forward, Vector3.up) > 0.6f)
                        diceCount = 1;
                    if (Vector3.Dot(transform.up, Vector3.up) > 0.6f)
                        diceCount = 2;
                    if (Vector3.Dot(-transform.up, Vector3.up) > 0.6f)
                        diceCount = 5;
                    if (Vector3.Dot(transform.right, Vector3.up) > 0.6f)
                        diceCount = 3;
                    if (Vector3.Dot(-transform.right, Vector3.up) > 0.6f)
                        diceCount = 4;
                }
            
        }
  

}

I think you should be using rigidbody.IsSleeping() to detect if the dice is at rest.