              (bs/text-input-control nil owner [:sensor :type] "Type" true)
              (bs/text-input-control nil owner [:sensor :alias] "Header Rows")
              (bs/text-input-control nil owner [:sensor :unit] "Unit" true)
-             (sensor-period-dropdown owner)
+             (sensor-period-dropdown owner [:sensor :period] "Select period")
              (bs/text-input-control nil owner [:sensor :resolution] "Resolution")
              (bs/checkbox nil owner [:sensor :actual_annual] "Calculated Field")]]]])))))
 

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; Adding new sensor

(defn sensor-period-dropdown [owner]
  [:div.form-group
   [:label.control-label {:for "period-select"} "Period"]
   [:div.required
    [:select.form-control {:on-change #(om/set-state! owner [:sensor :period] (.-value (.-target %)))}
     (for [item ["Select period" "CUMULATIVE" "INSTANT" "PULSE"]]
       [:option item])]]])

(defn put-new-sensor [event-chan refresh-chan owner sensor property_id device_id]
  (common/put-resource (str "/4/entities/" property_id "/devices/" device_id)

     (text-input-control cursor owner [:sensors sensor_id] :type "Type")
     (text-input-control cursor owner [:sensors sensor_id] :alias "Header Rows")
     (text-input-control cursor owner [:sensors sensor_id] :unit "Unit")
     [:div {:style {:padding-left "15px"}}
      (sensor-period-dropdown owner [:sensors sensor_id :period] (:period cursor))]
     (text-input-control cursor owner [:sensors sensor_id] :resolution "Resolution")
     (checkbox cursor owner [:sensors sensor_id] :actual_annual "Calculated Field")]))

