ESP32 / ESP8266 & BME280 / SHT2x sensor with InfluxDB support
Vous ne pouvez pas sélectionner plus de 25 sujets Les noms de sujets doivent commencer par une lettre ou un nombre, peuvent contenir des tirets ('-') et peuvent comporter jusqu'à 35 caractères.

config.h 3.4KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114
  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. // LoRa SML Bridge "Crypto"
  39. // needs to be sizeof(struct lora_sml_msg) bytes long
  40. #define LORA_XOR_KEY "_SUPER_SECRET_KEY_HERE_"
  41. // all given in milliseconds
  42. #define SERVER_HANDLE_INTERVAL 10
  43. #define SENSOR_HANDLE_INTERVAL (5 * 1000)
  44. #define DB_WRITE_INTERVAL (30 * 1000)
  45. #define MQTT_WRITE_INTERVAL (30 * 1000)
  46. #define LED_BLINK_INTERVAL (2 * 1000)
  47. #define LED_INIT_BLINK_INTERVAL 500
  48. #define LED_CONNECT_BLINK_INTERVAL 250
  49. #define LED_ERROR_BLINK_INTERVAL 100
  50. #define MQTT_RECONNECT_INTERVAL (5 * 1000)
  51. #define NTP_SERVER "pool.ntp.org"
  52. // TODO auto-detect?!
  53. //#warning hard-coded timezone and daylight savings offset
  54. #define gmtOffset_sec (60 * 60)
  55. #define daylightOffset_sec (60 * 60)
  56. #if defined(SENSOR_LOCATION_LIVINGROOM)
  57. #define SENSOR_LOCATION "livingroom"
  58. #define SENSOR_ID SENSOR_LOCATION
  59. #elif defined(SENSOR_LOCATION_LIVINGROOM_WORKSPACE)
  60. #define SENSOR_LOCATION "livingroom"
  61. #define SENSOR_ID "livingroom-ws"
  62. #elif defined(SENSOR_LOCATION_LIVINGROOM_TV)
  63. #define SENSOR_LOCATION "livingroom"
  64. #define SENSOR_ID "livingroom-tv"
  65. #elif defined(SENSOR_LOCATION_BEDROOM)
  66. #define SENSOR_LOCATION "bedroom"
  67. #define SENSOR_ID SENSOR_LOCATION
  68. #elif defined(SENSOR_LOCATION_BATHROOM)
  69. #define SENSOR_LOCATION "bathroom"
  70. #define SENSOR_ID SENSOR_LOCATION
  71. #elif defined(SENSOR_LOCATION_GREENHOUSE)
  72. #define SENSOR_LOCATION "greenhouse"
  73. #define SENSOR_ID SENSOR_LOCATION
  74. #elif defined(SENSOR_LOCATION_TESTING)
  75. #define SENSOR_LOCATION "testing"
  76. #define SENSOR_ID SENSOR_LOCATION
  77. #else
  78. #define SENSOR_LOCATION "unknown"
  79. #define SENSOR_ID SENSOR_LOCATION
  80. #endif
  81. #if defined(RELAIS_SERIAL) || defined(RELAIS_GPIO)
  82. #define FEATURE_RELAIS
  83. #endif
  84. #if defined(MOISTURE_ADC_ESP32) || defined(MOISTURE_ADC_ARDUINO)
  85. #define FEATURE_MOISTURE
  86. #endif
  87. #if defined(ARDUINO_ARCH_ESP8266) || defined(ARDUINO_ARCH_ESP32)
  88. #define BUILTIN_LED_PIN 1
  89. #elif defined(ARDUINO_ARCH_AVR)
  90. #define BUILTIN_LED_PIN 13
  91. #endif
  92. #if defined(ARDUINO_ARCH_ESP8266)
  93. #define ESP_PLATFORM_NAME "ESP8266"
  94. #elif defined(ARDUINO_ARCH_ESP32)
  95. #define ESP_PLATFORM_NAME "ESP32"
  96. #elif defined(ARDUINO_ARCH_AVR)
  97. #define ESP_PLATFORM_NAME "Uno WiFi"
  98. #endif
  99. #endif // __ESP_ENV_CONFIG__