exports.vacant = function (inputs) {
  if (inputs.people_awake)
    return inputs.sun_is_set ? 'active_night' : 'active_day';
  if (inputs.people_home)
    return inputs.sun_is_set ? 'sleeping' : 'active_day';
};

exports.active_night = function (inputs) {
  if (!inputs.people_home)
    return 'vacant';
  if (!inputs.people_awake)
    return 'sleeping';
};

exports.active_day = function (inputs) {
  if (inputs.sun_is_set)
    return 'active_night';
  if (!inputs.people_home)
    return 'sleeping';
};

exports.sleeping = function (inputs) {
  if (inputs.people_awake)
    return 'active_night';
  if (!inputs.sun_is_set)
    return 'vacant';
  if (!inputs.people_asleep)
    return 'vacant';
};

@@ -631,32 +631,124 @@
 return '
-vacant';
+morning';%0A  if (!inputs.people_asleep)%0A    return 'vacant';%0A%7D;%0A%0Aexports.morning = function (inputs) %7B
 %0A  if (
-!
 inputs.p
@@ -758,35 +758,133 @@
 le_a
-sleep)%0A    return 'vacant';%0A%7D;
+wake)%0A    return 'active_day';%0A  if (!inputs.people_home)%0A    return 'vacant';%0A  if (inputs.sun_is_set)%0A    return 'sleeping';%0A%7D
 %0A

Improve the states a little