diff --git a/app/assets/scripts/actions/action-types.js b/app/assets/scripts/actions/action-types.js index 4549a0a..852745d 100644 --- a/app/assets/scripts/actions/action-types.js +++ b/app/assets/scripts/actions/action-types.js @@ -19,3 +19,12 @@ export const RECEIVE_SENSOR_DATA_PM10 = 'RECEIVE_SENSOR_DATA_PM10'; export const REQUEST_SENSOR_DATA_PM25 = 'REQUEST_SENSOR_DATA_PM25'; export const RECEIVE_SENSOR_DATA_PM25 = 'RECEIVE_SENSOR_DATA_PM25'; + +export const REQUEST_SENSOR_DATA_WINDDIR = 'REQUEST_SENSOR_DATA_WINDDIR'; +export const RECEIVE_SENSOR_DATA_WINDDIR = 'RECEIVE_SENSOR_DATA_WINDDIR'; + +export const REQUEST_SENSOR_DATA_WINDSPEED = 'REQUEST_SENSOR_DATA_WINDSPEED'; +export const RECEIVE_SENSOR_DATA_WINDSPEED = 'RECEIVE_SENSOR_DATA_WINDSPEED'; + +export const REQUEST_SENSOR_DATA_RAIN = 'REQUEST_SENSOR_DATA_RAIN'; +export const RECEIVE_SENSOR_DATA_RAIN = 'RECEIVE_SENSOR_DATA_RAIN'; diff --git a/app/assets/scripts/config/production.js b/app/assets/scripts/config/production.js index 1771568..ae0be28 100644 --- a/app/assets/scripts/config/production.js +++ b/app/assets/scripts/config/production.js @@ -8,6 +8,9 @@ module.exports = { title: 'Begga Weer', senseBox: { id: '5b26181b1fef04001b69093c', + 'sensorId--rain': '5cd6818eff898b001a7366d8', + 'sensorId--windSpeed': '5cd6818eff898b001a7366d7', + 'sensorId--windDir': '5cd6818eff898b001a7366d6', 'sensorId--pm25': '5b26181b1fef04001b69093d', 'sensorId--pm10': '5b26181b1fef04001b69093e', 'sensorId--uv': '5b26181b1fef04001b69093f', diff --git a/app/assets/scripts/reducers/reducer.js b/app/assets/scripts/reducers/reducer.js index db20b4e..23ddb24 100644 --- a/app/assets/scripts/reducers/reducer.js +++ b/app/assets/scripts/reducers/reducer.js @@ -31,6 +31,9 @@ const sensorHumidity = sensorReducerFactory('humidity'); const sensorTemperature = sensorReducerFactory('temperature'); const sensorPm10 = sensorReducerFactory('pm10'); const sensorPm25 = sensorReducerFactory('pm25'); +const sensorWindDir = sensorReducerFactory('windDir'); +const sensorWindSpeed = sensorReducerFactory('windSpeed'); +const sensorRain = sensorReducerFactory('rain'); export default combineReducers({ routing: routeReducer, @@ -41,4 +44,7 @@ export default combineReducers({ sensorTemperature, sensorPm10, sensorPm25, + sensorWindDir, + sensorWindSpeed, + sensorRain, }); diff --git a/app/assets/scripts/views/home.js b/app/assets/scripts/views/home.js index cffe46a..cd7ebac 100644 --- a/app/assets/scripts/views/home.js +++ b/app/assets/scripts/views/home.js @@ -29,6 +29,9 @@ var Home = React.createClass({ sensorTemperature: sensorProps, sensorPm10: sensorProps, sensorPm25: sensorProps, + sensorWindDir: sensorProps, + sensorWindSpeed: sensorProps, + sensorRain: sensorProps, }, // Having measurements every minute is too much. Group them. @@ -131,6 +134,9 @@ var Home = React.createClass({ this.props._requestSensorData('pressure', daysAgo3); this.props._requestSensorData('pm10', daysAgo3); this.props._requestSensorData('pm25', daysAgo3); + this.props._requestSensorData('windDir', daysAgo3); + this.props._requestSensorData('windSpeed', daysAgo3); + this.props._requestSensorData('rain', daysAgo3); }, componentDidMount: function () { @@ -150,10 +156,13 @@ var Home = React.createClass({ let sensorTemperatureData = this.prepareData(this.props.sensorTemperature.data); let sensorHumidityData = this.prepareData(this.props.sensorHumidity.data); let sensorUvData = this.prepareData(this.props.sensorUv.data); - // let sensorLuminosityData = this.prepareData(this.props.sensorLuminosity.data); - // let sensorPressureData = this.prepareData(this.props.sensorPressure.data); + let sensorLuminosityData = this.prepareData(this.props.sensorLuminosity.data); + let sensorPressureData = this.prepareData(this.props.sensorPressure.data); let sensorPm10Data = this.prepareData(this.props.sensorPm10.data); let sensorPm25Data = this.prepareData(this.props.sensorPm25.data); + let sensorWindDirData = this.prepareData(this.props.sensorWindDir.data); + let sensorWindSpeedData = this.prepareData(this.props.sensorWindSpeed.data); + let sensorRainData = this.prepareData(this.props.sensorRain.data); return (
@@ -177,14 +186,28 @@ var Home = React.createClass({ lastReading={sensorTemperatureData.last} avgs={sensorTemperatureData.avgs} plotData={sensorTemperatureData.data} - axisLineMax={35} + axisLineMax={40} axisLineVal={20} - axisLineMin={4} + axisLineMin={0} unit=' ºC' /> + + + + + + + + - {/* - */} -