     :else :night))
 
 
-(defn time-sm [state day-fn! night-fn!]
+(defn time-sm [component state day-fn! night-fn!]
   (let [dusk 0.03
         dawn 0.13]
     {:state state

          polling-interval 1000]
      (go-loop [light-state-machine
                (time-sm
                  (init-state! floor-button roof-button light-sensor)
                  (partial >! (:door channels) :open)
                  (partial >! (:door channels) :close))]
        (let [[message _] (async/alts! [kill-chan (async/timeout polling-interval)])]
          (if-not (= message :kill)
            (let [light-level (bb/safe-read! light-sensor)]
              (notify ::measurement {:light-level light-level})
              (recur (trans-sm! light-state-machine light-level)))
            (notify ::info "LightMonitor recieved kill signal; ending polling loop.")))))
    (assoc component :kill-chan kill-chan))

  (stop [component]

              (if (> brightness dawn)
                ; state side effects
                (do
                  (notify component ::info "Switching from night to day and running morning routine")
                  (day-fn!)
                  :day)
                ; Don't change anything
