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.5KB

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