<commit_before>{{define "content"}}

  {{with .Marvin}}

<div ng-controller="MarvinCtrl">

  <div class="alert alert-error" ng-repeat="error in errors">
    [[error]]
  </div>

  <div class="row-fluid">
    <div class="span3">

      <h2>Activity</h2>

      <div class="alert alert-info">[[state.Activity]]</div>
      <p>
	<a ng-repeat="(next, v) in state.Activities[state.Activity].Next" ng-click="updateActivity(state.Activity, next)" class="btn btn-large btn-block btn-primary" data-transition="[[next]]">[[next]] <i class="icon-play"></i></a>
      </p>

      <form ng-submit="updateActivity(state.Activity, targetActivity)" autocomplete="off">
	<fieldset>
	  <input class="input-block-level" type="text" typeahead="activity for activity in allActivities() | filter:$viewValue" ng-model="targetActivity" placeholder="activity name">
	  <input type="hidden" ng-model="state.Activity">
	  <!--<button type="submit" class="btn">Add</button>-->
	</fieldset>
      </form>

    </div>

    <div class="span3">
      <h2>Switches</h2>
      <form ng-submit="changeState()">
	{{range $k, $v := .Switch}}
	<label class="checkbox"><input type=checkbox ng-model="state.Switch['{{$k}}']" ng-change="changeState('{{$k}}', state.Switch['{{$k}}'])">{{$k}}</label>{{end}}
      </form>
    </div>

    <div class="span3">
      <h2>Light Groups</h2>
      <table class="table">
	<thead>
	  <tr>
	    <th>Name</th>
	    <th><i class="icon-off"></i> On</th>
	    <th><i class="icon-adjust"></i> Color</th>
	  </tr>
	</thead>
	<tbody>
	  <tr ng-repeat="(name, group) in state.Hue.Groups">
	    <td>[[group.Name]]</td>
	    <td ng-switch on="group.Action.On">
	      <a ng-switch-when="true" class="btn btn-success" ng-click="setHue('/groups/'+name+'/action', OFF)">On</a>
	      <a ng-switch-when="false" class="btn btn-danger" ng-click="setHue('/groups/'+name+'/action', ON)">Off</a>
	    </td>
	    <td class="dropdown">
	      <a style="color: black; background-color: [[getColor(group.Action)]]" class="dropdown-toggle btn btn-block btn-link">
		[[getBrightness(group.Action)]]%
	      </a>
	      <ul class="dropdown-menu">
		<li ng-repeat="choice in allStates()">
		  <a ng-click="setHue('/groups/'+name+'/action', state.Hue.States[choice])">[[choice]]</a>
		</li>
	      </ul>
	    </td>
	  </tr>
	</tbody>
      </table>
    </div>

    <div class="span3">
      <h2>Lights</h2>
      <table class="table">
	<thead>
	  <tr>
	    <th>Name</th>
	    <th><i class="icon-off"></i> On</th>
	    <th><i class="icon-adjust"></i> Color</th>
	  </tr>
	</thead>
	<tbody>
	  <tr ng-repeat="(name, light) in state.Hue.Lights">
	    <td>[[light.Name]]</td>
	    <td ng-switch on="light.State.On">
	      <a ng-switch-when="true" class="btn btn-success" ng-click="setHue('/lights/'+name+'/state', OFF)">On</a>
	      <a ng-switch-when="false" class="btn btn-danger" ng-click="setHue('/lights/'+name+'/state', ON)">Off</a>
	    </td>
	    <td class="dropdown">
	      <a style="color: black; background-color: [[getColor(light.State)]]" class="dropdown-toggle btn btn-block btn-link">
		[[getBrightness(light.State)]]%
	      </a>
	      <ul class="dropdown-menu">
		<li ng-repeat="choice in allStates()">
		  <a ng-click="setHue('/lights/'+name+'/state', state.Hue.States[choice])">[[choice]]</a>
		</li>
	      </ul>
	    </td>
	  </tr>
	</tbody>
      </table>
    </div>
  </div>

    <hr>

  <div class="row-fluid">

    <div class="row-fluid">
      <div class="span3">
	<h2>Sensors</h2>
	<form>
	  {{if .MotionSensor}}
          <span ng-switch on="state.Motion">
	    <span ng-switch-when="true" class="label label-success">motion</span>
	    <span ng-switch-when="false" class="label label-important">no motion</span>
	    <span ng-switch-default>-</span>
	  </span>{{else}}<div class="alert alert-warning">no motion sensor</div>{{end}}
	</form>
	{{if .LightSensor}}<span ng-switch on="state.DayLight">
	  <span ng-switch-when="true" class="label label-success">daylight</span>
	  <span ng-switch-when="false" class="label label-inverse">dark</span>
	  <span ng-switch-default>-</span>
	</span>{{else}}<div class="alert alert-warning">no ambient light sensor</div>{{end}}
      </div>

      <div class="span3">
	<h2>Presence</h2>
	<table class="table">
	  <thead>
	    <tr>
	      <th>Name</th>
	      <th>Status</th>
	    </tr>
	  </thead>
	  <tbody>
	    <tr ng-repeat="(k, v) in state.Present">
	      <td>[[k]]</td>
	      <td ng-switch on="v">
		<span ng-switch-when="true" class="label label-success">Home</span>
		<span ng-switch-when="false" class="label label-important">Away</span>
		<span ng-switch-default>-</span>
	      </td>
	    </tr>
	  </tbody>
	</table>
      </div>

      <div class="span3">
	<div class="alert alert-info">
	  <strong>Last transition:</strong> [[state.LastTransition]]
	</div>
      </div>
    </div>

  </div>

  {{end}}

<div>
{{end}}
<commit_msg>Added schedule to home page.<commit_after>{{define "content"}}

  {{with .Marvin}}

<div ng-controller="MarvinCtrl">

  <div class="alert alert-error" ng-repeat="error in errors">
    [[error]]
  </div>

  <div class="row-fluid">
    <div class="span3">

      <h2>Activity</h2>

      <div class="alert alert-info">[[state.Activity]]</div>
      <p>
	<a ng-repeat="(next, v) in state.Activities[state.Activity].Next" ng-click="updateActivity(state.Activity, next)" class="btn btn-large btn-block btn-primary" data-transition="[[next]]">[[next]] <i class="icon-play"></i></a>
      </p>

      <form ng-submit="updateActivity(state.Activity, targetActivity)" autocomplete="off">
	<fieldset>
	  <input class="input-block-level" type="text" typeahead="activity for activity in allActivities() | filter:$viewValue" ng-model="targetActivity" placeholder="activity name">
	  <input type="hidden" ng-model="state.Activity">
	  <!--<button type="submit" class="btn">Add</button>-->
	</fieldset>
      </form>

    </div>

    <div class="span3">
      <h2>Switches</h2>
      <form ng-submit="changeState()">
	{{range $k, $v := .Switch}}
	<label class="checkbox"><input type=checkbox ng-model="state.Switch['{{$k}}']" ng-change="changeState('{{$k}}', state.Switch['{{$k}}'])">{{$k}}</label>{{end}}
      </form>
    </div>

    <div class="span3">
      <h2>Light Groups</h2>
      <table class="table">
	<thead>
	  <tr>
	    <th>Name</th>
	    <th><i class="icon-off"></i> On</th>
	    <th><i class="icon-adjust"></i> Color</th>
	  </tr>
	</thead>
	<tbody>
	  <tr ng-repeat="(name, group) in state.Hue.Groups">
	    <td>[[group.Name]]</td>
	    <td ng-switch on="group.Action.On">
	      <a ng-switch-when="true" class="btn btn-success" ng-click="setHue('/groups/'+name+'/action', OFF)">On</a>
	      <a ng-switch-when="false" class="btn btn-danger" ng-click="setHue('/groups/'+name+'/action', ON)">Off</a>
	    </td>
	    <td class="dropdown">
	      <a style="color: black; background-color: [[getColor(group.Action)]]" class="dropdown-toggle btn btn-block btn-link">
		[[getBrightness(group.Action)]]%
	      </a>
	      <ul class="dropdown-menu">
		<li ng-repeat="choice in allStates()">
		  <a ng-click="setHue('/groups/'+name+'/action', state.Hue.States[choice])">[[choice]]</a>
		</li>
	      </ul>
	    </td>
	  </tr>
	</tbody>
      </table>
    </div>

    <div class="span3">
      <h2>Lights</h2>
      <table class="table">
	<thead>
	  <tr>
	    <th>Name</th>
	    <th><i class="icon-off"></i> On</th>
	    <th><i class="icon-adjust"></i> Color</th>
	  </tr>
	</thead>
	<tbody>
	  <tr ng-repeat="(name, light) in state.Hue.Lights">
	    <td>[[light.Name]]</td>
	    <td ng-switch on="light.State.On">
	      <a ng-switch-when="true" class="btn btn-success" ng-click="setHue('/lights/'+name+'/state', OFF)">On</a>
	      <a ng-switch-when="false" class="btn btn-danger" ng-click="setHue('/lights/'+name+'/state', ON)">Off</a>
	    </td>
	    <td class="dropdown">
	      <a style="color: black; background-color: [[getColor(light.State)]]" class="dropdown-toggle btn btn-block btn-link">
		[[getBrightness(light.State)]]%
	      </a>
	      <ul class="dropdown-menu">
		<li ng-repeat="choice in allStates()">
		  <a ng-click="setHue('/lights/'+name+'/state', state.Hue.States[choice])">[[choice]]</a>
		</li>
	      </ul>
	    </td>
	  </tr>
	</tbody>
      </table>
    </div>
  </div>

  <div class="row-fluid">

    <div class="span3">
      <h2>Schedule</h2>
      <table class="table table-condensed table-striped">
	<thead>
	  <tr>
	    <th scope="col">Time</th>
	    <th scope="col">On</th>
	    <th scope="col">Except</th>
	    <th scope="col">Transition</th>
	  </tr>
	</thead>
	<tbody>{{range .Schedule}}
	  <tr>
	    <td>{{.When}}</td>
	    <td>{{if .On}}{{.On}}{{end}}</td>
	    <td>{{if .ExceptOn}}{{.ExceptOn}}{{end}}</td>
	    <td><a class="transition btn btn-block" data-transition="{{.What}}">{{.What}} <i class="icon-play"></i></a></td>
	  </tr>{{end}}
	</tbody>
      </table>
    </div>

    <div class="span3">
      <h2>Sensors</h2>
      <form>
	{{if .MotionSensor}}
        <span ng-switch on="state.Motion">
	  <span ng-switch-when="true" class="label label-success">motion</span>
	  <span ng-switch-when="false" class="label label-important">no motion</span>
	  <span ng-switch-default>-</span>
	</span>{{else}}<div class="alert alert-warning">no motion sensor</div>{{end}}
      </form>
      {{if .LightSensor}}<span ng-switch on="state.DayLight">
	<span ng-switch-when="true" class="label label-success">daylight</span>
	<span ng-switch-when="false" class="label label-inverse">dark</span>
	<span ng-switch-default>-</span>
      </span>{{else}}<div class="alert alert-warning">no ambient light sensor</div>{{end}}
    </div>

    <div class="span3">
      <h2>Presence</h2>
      <table class="table">
	<thead>
	  <tr>
	    <th>Name</th>
	    <th>Status</th>
	  </tr>
	</thead>
	<tbody>
	  <tr ng-repeat="(k, v) in state.Present">
	    <td>[[k]]</td>
	    <td ng-switch on="v">
	      <span ng-switch-when="true" class="label label-success">Home</span>
	      <span ng-switch-when="false" class="label label-important">Away</span>
	      <span ng-switch-default>-</span>
	    </td>
	  </tr>
	</tbody>
      </table>
    </div>

    <div class="span3">
      <div class="alert alert-info">
	<strong>Last transition:</strong> [[state.LastTransition]]
      </div>
    </div>
  </div>

  {{end}}

<div>
{{end}}

{'fraction_non_alphanumeric': 0.23413736316962122, 'fraction_numerical': 0.003971713649133004, 'mean_word_length': 3.298084929225645, 'pattern_counts': {'":': 0, '<': 404, '<?xml version=': 0, '>': 404, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7515911', 'n_tokens_mistral': 4004, 'n_tokens_neox': 3732, 'n_words': 682}