ESP32 / ESP8266 & BME280 / SHT2x sensor with InfluxDB support
Du kannst nicht mehr als 25 Themen auswählen Themen müssen mit entweder einem Buchstaben oder einer Ziffer beginnen. Sie können Bindestriche („-“) enthalten und bis zu 35 Zeichen lang sein.

config.h 3.1KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104
  1. /*
  2. * config.h
  3. *
  4. * ESP8266 / ESP32 Environmental Sensor
  5. *
  6. * ----------------------------------------------------------------------------
  7. * "THE BEER-WARE LICENSE" (Revision 42):
  8. * <xythobuz@xythobuz.de> wrote this file. As long as you retain this notice
  9. * you can do whatever you want with this stuff. If we meet some day, and you
  10. * think this stuff is worth it, you can buy me a beer in return. Thomas Buck
  11. * ----------------------------------------------------------------------------
  12. */
  13. #ifndef __ESP_ENV_CONFIG__
  14. #define __ESP_ENV_CONFIG__
  15. // Sketch version
  16. #define ESP_ENV_VERSION "0.7.0"
  17. // location of sensor, used in DB and hostname
  18. //#define SENSOR_LOCATION_LIVINGROOM
  19. //#define SENSOR_LOCATION_LIVINGROOM_WORKSPACE
  20. //#define SENSOR_LOCATION_LIVINGROOM_TV
  21. //#define SENSOR_LOCATION_BEDROOM
  22. //#define SENSOR_LOCATION_BATHROOM
  23. //#define SENSOR_LOCATION_GREENHOUSE
  24. #define SENSOR_LOCATION_TESTING
  25. // WiFi AP settings
  26. #define WIFI_SSID "WIFI_SSID_HERE"
  27. #define WIFI_PASS "WIFI_PASSWORD_HERE"
  28. // MQTT settings
  29. #define MQTT_HOST "MQTT_IP_HERE"
  30. #define MQTT_PORT 1883
  31. #define MQTT_USER "USERNAME" // undef to disable auth
  32. #define MQTT_PASS "PASSWORD" // undef to disable auth
  33. // InfluxDB settings
  34. #define INFLUXDB_HOST "INFLUX_IP_HERE"
  35. #define INFLUXDB_PORT 8086
  36. #define INFLUXDB_DATABASE "roomsensorsdiy"
  37. //#define INFLUX_MAX_ERRORS_RESET 10
  38. // all given in milliseconds
  39. #define SERVER_HANDLE_INTERVAL 10
  40. #define SENSOR_HANDLE_INTERVAL (5 * 1000)
  41. #define DB_WRITE_INTERVAL (30 * 1000)
  42. #define MQTT_WRITE_INTERVAL (30 * 1000)
  43. #define LED_BLINK_INTERVAL (2 * 1000)
  44. #define LED_INIT_BLINK_INTERVAL 500
  45. #define LED_CONNECT_BLINK_INTERVAL 250
  46. #define LED_ERROR_BLINK_INTERVAL 100
  47. #define MQTT_RECONNECT_INTERVAL (5 * 1000)
  48. #if defined(SENSOR_LOCATION_LIVINGROOM)
  49. #define SENSOR_LOCATION "livingroom"
  50. #define SENSOR_ID SENSOR_LOCATION
  51. #elif defined(SENSOR_LOCATION_LIVINGROOM_WORKSPACE)
  52. #define SENSOR_LOCATION "livingroom"
  53. #define SENSOR_ID "livingroom-ws"
  54. #elif defined(SENSOR_LOCATION_LIVINGROOM_TV)
  55. #define SENSOR_LOCATION "livingroom"
  56. #define SENSOR_ID "livingroom-tv"
  57. #elif defined(SENSOR_LOCATION_BEDROOM)
  58. #define SENSOR_LOCATION "bedroom"
  59. #define SENSOR_ID SENSOR_LOCATION
  60. #elif defined(SENSOR_LOCATION_BATHROOM)
  61. #define SENSOR_LOCATION "bathroom"
  62. #define SENSOR_ID SENSOR_LOCATION
  63. #elif defined(SENSOR_LOCATION_GREENHOUSE)
  64. #define SENSOR_LOCATION "greenhouse"
  65. #define SENSOR_ID SENSOR_LOCATION
  66. #elif defined(SENSOR_LOCATION_TESTING)
  67. #define SENSOR_LOCATION "testing"
  68. #define SENSOR_ID SENSOR_LOCATION
  69. #else
  70. #define SENSOR_LOCATION "unknown"
  71. #define SENSOR_ID SENSOR_LOCATION
  72. #endif
  73. #if defined(RELAIS_SERIAL) || defined(RELAIS_GPIO)
  74. #define FEATURE_RELAIS
  75. #endif
  76. #if defined(MOISTURE_ADC_ESP32) || defined(MOISTURE_ADC_ARDUINO)
  77. #define FEATURE_MOISTURE
  78. #endif
  79. #if defined(ARDUINO_ARCH_ESP8266) || defined(ARDUINO_ARCH_ESP32)
  80. #define BUILTIN_LED_PIN 1
  81. #elif defined(ARDUINO_ARCH_AVR)
  82. #define BUILTIN_LED_PIN 13
  83. #endif
  84. #if defined(ARDUINO_ARCH_ESP8266)
  85. #define ESP_PLATFORM_NAME "ESP8266"
  86. #elif defined(ARDUINO_ARCH_ESP32)
  87. #define ESP_PLATFORM_NAME "ESP32"
  88. #elif defined(ARDUINO_ARCH_AVR)
  89. #define ESP_PLATFORM_NAME "Uno WiFi"
  90. #endif
  91. #endif // __ESP_ENV_CONFIG__