Device combining CBT with analytics for remote diagnosis of sleep disorders