   (reify
     om/IRender
     (render [_]
-      (let [property-details (-> data :property-details :data)
-            property_data (:property_data property-details)]
-        (html [:div {:class (str "col-md-12" (if (:property_id (:property-details data)) "" " hidden"))}
+      (let [selected-property-id (-> data :active-components :properties)
+            properties           (-> data :properties :data)
+            property-details     (get-property-details selected-property-id properties)
+            property_data        (:property_data property-details)]
+        (html [:div {:class (str "col-md-12" (if selected-property-id "" " hidden"))}
                [:h2 "Property Details"]
                (bs/panel
                 (:slug property-details)

        (om/update! data [:properties :project_id] projects)
        (fetch-properties projects data))

      ;; property handling is special as it gets a tree of data
      (when (and (not= properties old-properties)
                 properties)
        (println "Setting property details to: " properties)
        (om/update! data [:properties :selected] properties)
        (om/update! data [:property-details :property_id] properties)
        ;; Handle flattened sensors
        (let [property-details (->> @data
                                    :properties
                                    :data
                                    (filter #(= (:id %) properties))
                                    first)
              devices (get property-details :devices [])]
          (om/update! data [:property-details :data] property-details)
          (om/update! data [:sensors :data] (extract-sensors devices))))
      
      ;; Update the new active components
      (om/update! data :active-components (-> nav-event :args :ids)))
    (recur)))

(defn selected-range-change

  (reify
    om/IRender
    (render [_]
      (let [sensors              (:sensors data)
            selected-property-id (-> data :active-components :properties)
            flattened-sensors    (get-sensors selected-property-id data)
            chart                (:chart data)
            history              (om/get-shared owner :history)
            table-id             "sensors-table"]
        (html
         [:table {:className "table table-hover"}
          [:thead
           [:tr [:th "Type"] [:th "Unit"] [:th "Period"] [:th "Device"] [:th "Status"]]]
          [:tbody
           (for [row (sort-by :type flattened-sensors)]
             (let [{:keys [device_id type unit period status]} row
                   id (str type "-" device_id)]
               [:tr {:onClick (fn [_ _]
