feature/http_call_send_json #3
2 changed files with 10 additions and 5 deletions
|
@ -51,6 +51,7 @@ String DEVICE_NAME = "weatherstation";
|
|||
// for debugging windspeed measurement only, trigger and results are handled by webupdater
|
||||
//#define DEBUG_WINDSPEED_MEASUREMENT
|
||||
//#define HTTP_CALL_ON_WINDSPEED_EXCEED
|
||||
//#define HTTP_CALL_SEND_JSON_DATA
|
||||
|
||||
const float HUMIDITY_FACTOR = 1.0;
|
||||
const float LIGHT_FACTOR = 1.0;
|
||||
|
@ -76,6 +77,9 @@ const char *INFLUXDB_TOKEN = "your api token";
|
|||
#define HTTP_CALL_ON_WINDSPEED_INTERVAL_S 60 // it's required to be bigger than WIND_SENSOR_MEAS_TIME_S
|
||||
#define HTTP_CALL_ON_WINDSPEED_URL "http://192.168.178.100:3001/button-windspeedexceed?event=click"
|
||||
|
||||
#define HTTP_CALL_SEND_JSON_DATA_INTERVAL_S 300
|
||||
#define HTTP_CALL_SEND_JSON_DATA_URL "http://192.168.178.123:80/html/index.html?json_weather_data="
|
||||
|
||||
// anemometer settings
|
||||
// thingiverse anemometer settings: https://www.thingiverse.com/thing:2559929/files
|
||||
#define ROTOR_LENGTH_CM 8.25
|
||||
|
|
|
@ -556,8 +556,8 @@ void _fsm_loop()
|
|||
/* -------------------------------------------------------------------------------- */
|
||||
case FSM_STATE_10:
|
||||
#ifdef SENSOR_WIND
|
||||
currentSensorData[sensor_cnt] = measure_wind_result();
|
||||
debug("wind sensor " + String(currentSensorData[sensor_cnt]));
|
||||
currentSensorData[SENSOR_WINDSPEED] = measure_wind_result();
|
||||
debug("wind sensor " + String(currentSensorData[SENSOR_WINDSPEED]));
|
||||
#endif
|
||||
// step into read of next sensor read
|
||||
sensor_cnt++;
|
||||
|
@ -584,8 +584,8 @@ void _fsm_loop()
|
|||
/* -------------------------------------------------------------------------------- */
|
||||
case FSM_STATE_12:
|
||||
#ifdef HTTP_CALL_ON_WINDSPEED_EXCEED
|
||||
currentSensorData[sensor_cnt] = measure_wind_result();
|
||||
debug("wind sensor value " + String(currentSensorData[sensor_cnt]));
|
||||
currentSensorData[SENSOR_WINDSPEED] = measure_wind_result();
|
||||
debug("wind sensor value " + String(currentSensorData[SENSOR_WINDSPEED]));
|
||||
|
||||
if (currentSensorData[SENSOR_WINDSPEED] >= HTTP_CALL_ON_WINDSPEED_EXCEED_MPS) {
|
||||
// windspeed exceeded send http call
|
||||
|
@ -688,6 +688,7 @@ void logToSerial(float sensorValues[]) {
|
|||
|
||||
String getJsonData()
|
||||
{
|
||||
debug(String(SENSOR_TEMPERATURE) + "=" + String(currentSensorData[SENSOR_TEMPERATURE]));
|
||||
String msg = hb_ws_msg_start +
|
||||
hb_ws_msg_temp +
|
||||
String(currentSensorData[SENSOR_TEMPERATURE], 2) +
|
||||
|
@ -717,7 +718,7 @@ String getJsonData()
|
|||
void http_call_send_json_data()
|
||||
{
|
||||
//debug("http call to " + String(HTTP_CALL_SEND_JSON_DATA_URL));
|
||||
|
||||
//debug(String(SENSOR_TEMPERATURE) + "=" + String(currentSensorData[SENSOR_TEMPERATURE]));
|
||||
// windspeed exceeded send http call
|
||||
digitalWrite(STATUS_LED_PIN, LOW);
|
||||
|
||||
|
|
Loading…
Reference in a new issue