Fork of the espurna firmware for `mhsw` switches
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

155 lines
4.5 KiB

7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
  1. //--------------------------------------------------------------------------------
  2. // Custom RF module
  3. // Check http://tinkerman.cat/adding-rf-to-a-non-rf-itead-sonoff/
  4. // Enable support by passing RF_SUPPORT=1 build flag
  5. //--------------------------------------------------------------------------------
  6. #ifndef RF_SUPPORT
  7. #define RF_SUPPORT 0
  8. #endif
  9. #ifndef RF_PIN
  10. #define RF_PIN 14
  11. #endif
  12. #define RF_CHANNEL 31
  13. #define RF_DEVICE 1
  14. //--------------------------------------------------------------------------------
  15. // General
  16. //--------------------------------------------------------------------------------
  17. #ifndef TEMPERATURE_MIN_CHANGE
  18. #define TEMPERATURE_MIN_CHANGE 0.0 // Minimum temperature change to report
  19. #endif
  20. #ifndef HUMIDITY_MIN_CHANGE
  21. #define HUMIDITY_MIN_CHANGE 0 // Minimum humidity change to report
  22. #endif
  23. #define TEMPERATURE_DECIMALS 1 // Decimals for temperature values
  24. //--------------------------------------------------------------------------------
  25. // DHTXX temperature/humidity sensor
  26. // Enable support by passing DHT_SUPPORT=1 build flag
  27. //--------------------------------------------------------------------------------
  28. #ifndef DHT_SUPPORT
  29. #define DHT_SUPPORT 1
  30. #endif
  31. #ifndef DHT_PIN
  32. #define DHT_PIN 13
  33. #endif
  34. #ifndef DHT_TYPE
  35. #define DHT_TYPE DHT22
  36. #endif
  37. #ifndef DHT_PULLUP
  38. #define DHT_PULLUP 0
  39. #endif
  40. #ifndef DHT_UPDATE_INTERVAL
  41. #define DHT_UPDATE_INTERVAL 60000
  42. #endif
  43. #define DHT_TEMPERATURE_TOPIC "temperature"
  44. #define DHT_HUMIDITY_TOPIC "humidity"
  45. #define HUMIDITY_NORMAL 0
  46. #define HUMIDITY_COMFORTABLE 1
  47. #define HUMIDITY_DRY 2
  48. #define HUMIDITY_WET 3
  49. //--------------------------------------------------------------------------------
  50. // Analog sensor
  51. // Enable support by passing ANALOG_SUPPORT=1 build flag
  52. //--------------------------------------------------------------------------------
  53. #ifndef ANALOG_SUPPORT
  54. #define ANALOG_SUPPORT 0
  55. #endif
  56. #ifndef ANALOG_PIN
  57. #define ANALOG_PIN 0
  58. #endif
  59. #ifndef ANALOG_UPDATE_INTERVAL
  60. #define ANALOG_UPDATE_INTERVAL 60000
  61. #endif
  62. #define ANALOG_TOPIC "analog"
  63. #if ANALOG_SUPPORT
  64. #undef ADC_VCC_ENABLED
  65. #define ADC_VCC_ENABLED 0
  66. #endif
  67. //--------------------------------------------------------------------------------
  68. // Counter sensor
  69. // Enable support by passing COUNTER_SUPPORT=1 build flag
  70. //--------------------------------------------------------------------------------
  71. #ifndef COUNTER_SUPPORT
  72. #define COUNTER_SUPPORT 0 // Do not build with counter support by default
  73. #endif
  74. #ifndef COUNTER_PIN
  75. #define COUNTER_PIN 2 // GPIO to monitor
  76. #endif
  77. #ifndef COUNTER_PIN_MODE
  78. #define COUNTER_PIN_MODE INPUT // INPUT, INPUT_PULLUP
  79. #endif
  80. #ifndef COUNTER_INTERRUPT_MODE
  81. #define COUNTER_INTERRUPT_MODE RISING // RISING, FALLING, BOTH
  82. #endif
  83. #ifndef COUNTER_UPDATE_INTERVAL
  84. #define COUNTER_UPDATE_INTERVAL 5000 // Update counter every this millis
  85. #endif
  86. #define COUNTER_REPORT_EVERY 12 // Report counter every this updates (1 minute)
  87. #define COUNTER_DEBOUNCE 10 // Do not register events within less than 10 millis
  88. #define COUNTER_TOPIC "counter" // Default topic for MQTT, API and InfluxDB
  89. //--------------------------------------------------------------------------------
  90. // DS18B20 temperature sensor
  91. // Enable support by passing DS18B20_SUPPORT=1 build flag
  92. //--------------------------------------------------------------------------------
  93. #ifndef DS18B20_SUPPORT
  94. #define DS18B20_SUPPORT 0
  95. #endif
  96. #ifndef DS18B20_PIN
  97. #define DS18B20_PIN 14
  98. #endif
  99. #ifndef DS18B20_PULLUP
  100. #define DS18B20_PULLUP 1
  101. #endif
  102. #ifndef DS18B20_UPDATE_INTERVAL
  103. #define DS18B20_UPDATE_INTERVAL 60000
  104. #endif
  105. #ifndef DS18B20_TEMPERATURE_TOPIC
  106. #define DS18B20_TEMPERATURE_TOPIC "temperature"
  107. #endif
  108. //--------------------------------------------------------------------------------
  109. // Internal power montior
  110. // Enable support by passing ADC_VCC_ENABLED=1 build flag
  111. // Do not enable this if using the analog GPIO for any other thing
  112. //--------------------------------------------------------------------------------
  113. #ifndef ADC_VCC_ENABLED
  114. #define ADC_VCC_ENABLED 1
  115. #endif
  116. #if ADC_VCC_ENABLED
  117. ADC_MODE(ADC_VCC);
  118. #endif