How AI-controlled sensors could save lives in 'smart' hospitals and homes