Fixed: revert back (removed long ajax polling) and fixed the getting values from devicevalues (thanks to Matt)