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

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108
  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. #if defined(SENSOR_LOCATION_LIVINGROOM)
  52. #define SENSOR_LOCATION "livingroom"
  53. #define SENSOR_ID SENSOR_LOCATION
  54. #elif defined(SENSOR_LOCATION_LIVINGROOM_WORKSPACE)
  55. #define SENSOR_LOCATION "livingroom"
  56. #define SENSOR_ID "livingroom-ws"
  57. #elif defined(SENSOR_LOCATION_LIVINGROOM_TV)
  58. #define SENSOR_LOCATION "livingroom"
  59. #define SENSOR_ID "livingroom-tv"
  60. #elif defined(SENSOR_LOCATION_BEDROOM)
  61. #define SENSOR_LOCATION "bedroom"
  62. #define SENSOR_ID SENSOR_LOCATION
  63. #elif defined(SENSOR_LOCATION_BATHROOM)
  64. #define SENSOR_LOCATION "bathroom"
  65. #define SENSOR_ID SENSOR_LOCATION
  66. #elif defined(SENSOR_LOCATION_GREENHOUSE)
  67. #define SENSOR_LOCATION "greenhouse"
  68. #define SENSOR_ID SENSOR_LOCATION
  69. #elif defined(SENSOR_LOCATION_TESTING)
  70. #define SENSOR_LOCATION "testing"
  71. #define SENSOR_ID SENSOR_LOCATION
  72. #else
  73. #define SENSOR_LOCATION "unknown"
  74. #define SENSOR_ID SENSOR_LOCATION
  75. #endif
  76. #if defined(RELAIS_SERIAL) || defined(RELAIS_GPIO)
  77. #define FEATURE_RELAIS
  78. #endif
  79. #if defined(MOISTURE_ADC_ESP32) || defined(MOISTURE_ADC_ARDUINO)
  80. #define FEATURE_MOISTURE
  81. #endif
  82. #if defined(ARDUINO_ARCH_ESP8266) || defined(ARDUINO_ARCH_ESP32)
  83. #define BUILTIN_LED_PIN 1
  84. #elif defined(ARDUINO_ARCH_AVR)
  85. #define BUILTIN_LED_PIN 13
  86. #endif
  87. #if defined(ARDUINO_ARCH_ESP8266)
  88. #define ESP_PLATFORM_NAME "ESP8266"
  89. #elif defined(ARDUINO_ARCH_ESP32)
  90. #define ESP_PLATFORM_NAME "ESP32"
  91. #elif defined(ARDUINO_ARCH_AVR)
  92. #define ESP_PLATFORM_NAME "Uno WiFi"
  93. #endif
  94. #endif // __ESP_ENV_CONFIG__