new code from Jeremie to get the alarm api alarm handling working