Skip to content

Commit

Permalink
Add water level event and gauge.
Browse files Browse the repository at this point in the history
  • Loading branch information
JakeHartnell committed Aug 30, 2017
1 parent 0340b82 commit 9847780
Showing 1 changed file with 21 additions and 8 deletions.
29 changes: 21 additions & 8 deletions imports/things/BioReactor.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,6 @@ import MoreVertIcon from 'material-ui/svg-icons/navigation/more-vert';
import moment from 'moment';



// Should there be a base thing component that has methods like setProperty and sendcommand?
class BioReactor extends BaseThing {
constructor(props) {
super(props);
Expand Down Expand Up @@ -122,15 +120,14 @@ class BioReactor extends BaseThing {
unit: 'wi wi-celsius',
max: 40,
},
{
type: 'water_level',
title: 'Water level',
max: 100,
},
]
};



takePicture = () => {
this.sendCommand('picture');
}

render() {
const styles = {
oneHundred: {
Expand Down Expand Up @@ -401,6 +398,7 @@ BioReactor.propTypes = {
luxEvents: PropTypes.array,
dissolved_oxygenEvents: PropTypes.array,
water_temperatureEvents: PropTypes.array,
water_levelEvents: PropTypes.array,
ready: PropTypes.bool,
alerts: PropTypes.array,
}
Expand All @@ -418,34 +416,48 @@ export default BioReactorContainer = createContainer(({ thing }) => {

const alerts = Events.find({'event.type': 'alert',
'thing._id': thing._id}).fetch();

const phEvents = Events.find({'event.type': 'ph',
'thing._id': thing._id}, {
sort: { insertedAt: -1 }
}).fetch();

const ecEvents = Events.find({'event.type': 'ec',
'thing._id': thing._id}, {
sort: { insertedAt: -1 }
}).fetch();

const luxEvents = Events.find({
'event.type': 'lux',
'thing._id': thing._id
}, {
sort: { insertedAt: -1 }
}).fetch();

const water_levelEvents = Events.find({
'event.type': 'water_level',
'thing._id': thing._id
}, {
sort: { insertedAt: -1 }
}).fetch();

const dissolved_oxygenEvents = Events.find({
'event.type': 'dissolved_oxygen',
'thing._id': thing._id
}, {
sort: { insertedAt: -1 }
}).fetch();

const tempEvents = Events.find({'event.type': 'temperature',
'thing._id': thing._id}, {
sort: { insertedAt: -1 }
}).fetch();

const humidityEvents = Events.find({'event.type': 'humidity',
'thing._id': thing._id}, {
sort: { insertedAt: -1 }
}).fetch();

const water_temperatureEvents = Events.find({'event.type': 'water_temperature',
'thing._id': thing._id}, {
sort: { insertedAt: -1 }
Expand All @@ -461,6 +473,7 @@ export default BioReactorContainer = createContainer(({ thing }) => {
luxEvents,
alerts,
water_temperatureEvents,
water_levelEvents,
ready
}
}, BioReactor);

0 comments on commit 9847780

Please sign in to comment.