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.

156 lines
4.6 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_CORRECTION 0.0 // This is both for DHT and DS18B20
  24. #define TEMPERATURE_DECIMALS 1 // Decimals for temperature values
  25. //--------------------------------------------------------------------------------
  26. // DHTXX temperature/humidity sensor
  27. // Enable support by passing DHT_SUPPORT=1 build flag
  28. //--------------------------------------------------------------------------------
  29. #ifndef DHT_SUPPORT
  30. #define DHT_SUPPORT 0
  31. #endif
  32. #ifndef DHT_PIN
  33. #define DHT_PIN 14
  34. #endif
  35. #ifndef DHT_TYPE
  36. #define DHT_TYPE DHT22
  37. #endif
  38. #ifndef DHT_PULLUP
  39. #define DHT_PULLUP 0
  40. #endif
  41. #ifndef DHT_UPDATE_INTERVAL
  42. #define DHT_UPDATE_INTERVAL 60000
  43. #endif
  44. #define DHT_TEMPERATURE_TOPIC "temperature"
  45. #define DHT_HUMIDITY_TOPIC "humidity"
  46. #define HUMIDITY_NORMAL 0
  47. #define HUMIDITY_COMFORTABLE 1
  48. #define HUMIDITY_DRY 2
  49. #define HUMIDITY_WET 3
  50. //--------------------------------------------------------------------------------
  51. // Analog sensor
  52. // Enable support by passing ANALOG_SUPPORT=1 build flag
  53. //--------------------------------------------------------------------------------
  54. #ifndef ANALOG_SUPPORT
  55. #define ANALOG_SUPPORT 0
  56. #endif
  57. #ifndef ANALOG_PIN
  58. #define ANALOG_PIN 0
  59. #endif
  60. #ifndef ANALOG_UPDATE_INTERVAL
  61. #define ANALOG_UPDATE_INTERVAL 60000
  62. #endif
  63. #define ANALOG_TOPIC "analog"
  64. #if ANALOG_SUPPORT
  65. #undef ADC_VCC_ENABLED
  66. #define ADC_VCC_ENABLED 0
  67. #endif
  68. //--------------------------------------------------------------------------------
  69. // Counter sensor
  70. // Enable support by passing COUNTER_SUPPORT=1 build flag
  71. //--------------------------------------------------------------------------------
  72. #ifndef COUNTER_SUPPORT
  73. #define COUNTER_SUPPORT 0 // Do not build with counter support by default
  74. #endif
  75. #ifndef COUNTER_PIN
  76. #define COUNTER_PIN 2 // GPIO to monitor
  77. #endif
  78. #ifndef COUNTER_PIN_MODE
  79. #define COUNTER_PIN_MODE INPUT // INPUT, INPUT_PULLUP
  80. #endif
  81. #ifndef COUNTER_INTERRUPT_MODE
  82. #define COUNTER_INTERRUPT_MODE RISING // RISING, FALLING, BOTH
  83. #endif
  84. #ifndef COUNTER_UPDATE_INTERVAL
  85. #define COUNTER_UPDATE_INTERVAL 5000 // Update counter every this millis
  86. #endif
  87. #define COUNTER_REPORT_EVERY 12 // Report counter every this updates (1 minute)
  88. #define COUNTER_DEBOUNCE 10 // Do not register events within less than 10 millis
  89. #define COUNTER_TOPIC "counter" // Default topic for MQTT, API and InfluxDB
  90. //--------------------------------------------------------------------------------
  91. // DS18B20 temperature sensor
  92. // Enable support by passing DS18B20_SUPPORT=1 build flag
  93. //--------------------------------------------------------------------------------
  94. #ifndef DS18B20_SUPPORT
  95. #define DS18B20_SUPPORT 0
  96. #endif
  97. #ifndef DS18B20_PIN
  98. #define DS18B20_PIN 14
  99. #endif
  100. #ifndef DS18B20_PULLUP
  101. #define DS18B20_PULLUP 1
  102. #endif
  103. #ifndef DS18B20_UPDATE_INTERVAL
  104. #define DS18B20_UPDATE_INTERVAL 60000
  105. #endif
  106. #ifndef DS18B20_TEMPERATURE_TOPIC
  107. #define DS18B20_TEMPERATURE_TOPIC "temperature"
  108. #endif
  109. //--------------------------------------------------------------------------------
  110. // Internal power montior
  111. // Enable support by passing ADC_VCC_ENABLED=1 build flag
  112. // Do not enable this if using the analog GPIO for any other thing
  113. //--------------------------------------------------------------------------------
  114. #ifndef ADC_VCC_ENABLED
  115. #define ADC_VCC_ENABLED 1
  116. #endif
  117. #if ADC_VCC_ENABLED
  118. ADC_MODE(ADC_VCC);
  119. #endif