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.

246 lines
8.2 KiB

8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
7 years ago
7 years ago
8 years ago
8 years ago
8 years ago
7 years ago
8 years ago
8 years ago
  1. //------------------------------------------------------------------------------
  2. // GENERAL
  3. //------------------------------------------------------------------------------
  4. #define SERIAL_BAUDRATE 115200
  5. #define HOSTNAME DEVICE
  6. #define BUFFER_SIZE 1024
  7. #define HEARTBEAT_INTERVAL 300000
  8. #define UPTIME_OVERFLOW 4294967295
  9. //--------------------------------------------------------------------------------
  10. // EEPROM
  11. //--------------------------------------------------------------------------------
  12. #define EEPROM_RELAY_STATUS 0
  13. #define EEPROM_ENERGY_COUNT 1
  14. #define EEPROM_DATA_END 5
  15. //--------------------------------------------------------------------------------
  16. // POWER SUPPLY
  17. //--------------------------------------------------------------------------------
  18. #ifndef ENABLE_VCC_REPORT
  19. #define ENABLE_VCC_REPORT 1
  20. #endif
  21. //--------------------------------------------------------------------------------
  22. // BUTTON
  23. //--------------------------------------------------------------------------------
  24. #define BUTTON_LNGCLICK_LENGTH 1000
  25. #define BUTTON_LNGLNGCLICK_LENGTH 10000
  26. #define BUTTON_EVENT_NONE 0
  27. #define BUTTON_EVENT_PRESSED 1
  28. #define BUTTON_EVENT_CLICK 2
  29. #define BUTTON_EVENT_DBLCLICK 3
  30. #define BUTTON_EVENT_LNGCLICK 4
  31. #define BUTTON_EVENT_LNGLNGCLICK 5
  32. #define BUTTON_MODE_NONE 0
  33. #define BUTTON_MODE_TOGGLE 1
  34. #define BUTTON_MODE_AP 2
  35. #define BUTTON_MODE_RESET 3
  36. #define BUTTON_MODE_PULSE 4
  37. #define BUTTON_MODE_FACTORY 5
  38. #define BUTTON_DEFAULT_MODE BUTTON_MODE_TOGGLE
  39. //--------------------------------------------------------------------------------
  40. // RELAY
  41. //--------------------------------------------------------------------------------
  42. #define RELAY_MODE_OFF 0
  43. #define RELAY_MODE_ON 1
  44. #define RELAY_MODE_SAME 2
  45. #define RELAY_MODE_TOOGLE 3
  46. #define RELAY_SYNC_ANY 0
  47. #define RELAY_SYNC_NONE_OR_ONE 1
  48. #define RELAY_SYNC_ONE 2
  49. #define RELAY_SYNC_SAME 3
  50. #define RELAY_PULSE_NONE 0
  51. #define RELAY_PULSE_OFF 1
  52. #define RELAY_PULSE_ON 2
  53. #define RELAY_PROVIDER_RELAY 0
  54. #define RELAY_PROVIDER_DUAL 1
  55. #define RELAY_PROVIDER_MY9291 2
  56. #ifndef RELAY_PROVIDER
  57. #define RELAY_PROVIDER RELAY_PROVIDER_RELAY
  58. #endif
  59. // Pulse time in seconds
  60. #define RELAY_PULSE_TIME 1
  61. // 0 means OFF, 1 ON and 2 whatever was before
  62. #define RELAY_MODE RELAY_MODE_OFF
  63. // 0 means ANY, 1 zero or one and 2 one and only one
  64. #define RELAY_SYNC RELAY_SYNC_ANY
  65. // 0 means no pulses, 1 means normally off, 2 normally on
  66. #define RELAY_PULSE_MODE RELAY_PULSE_NONE
  67. //--------------------------------------------------------------------------------
  68. // I18N
  69. //--------------------------------------------------------------------------------
  70. #define TMP_CELSIUS 0
  71. #define TMP_FAHRENHEIT 1
  72. #define TMP_UNITS TMP_CELSIUS
  73. //--------------------------------------------------------------------------------
  74. // LED
  75. //--------------------------------------------------------------------------------
  76. // All defined LEDs in the board can be managed through MQTT
  77. // except the first one when LED_AUTO is set to 1.
  78. // If LED_AUTO is set to 1 the board will use first defined LED to show wifi status.
  79. #define LED_AUTO 1
  80. // -----------------------------------------------------------------------------
  81. // WIFI & WEB
  82. // -----------------------------------------------------------------------------
  83. #define WIFI_RECONNECT_INTERVAL 300000
  84. #define WIFI_MAX_NETWORKS 5
  85. #define ADMIN_PASS "fibonacci"
  86. #define FORCE_CHANGE_PASS 1
  87. #define HTTP_USERNAME "admin"
  88. #define WS_BUFFER_SIZE 5
  89. #define WS_TIMEOUT 1800000
  90. #define WEBSERVER_PORT 80
  91. #define DNS_PORT 53
  92. #define ENABLE_MDNS 1
  93. #define WEB_MODE_NORMAL 0
  94. #define WEB_MODE_PASSWORD 1
  95. #define AP_MODE AP_MODE_ALONE
  96. // This option builds the firmware with the web interface embedded.
  97. // You first have to build the data.h file that holds the contents
  98. // of the web interface by running "gulp buildfs_embed"
  99. #ifndef EMBEDDED_WEB
  100. #define EMBEDDED_WEB 0
  101. #endif
  102. // -----------------------------------------------------------------------------
  103. // OTA & NOFUSS
  104. // -----------------------------------------------------------------------------
  105. #define OTA_PORT 8266
  106. #define NOFUSS_SERVER ""
  107. #define NOFUSS_INTERVAL 3600000
  108. // -----------------------------------------------------------------------------
  109. // MQTT
  110. // -----------------------------------------------------------------------------
  111. #ifndef MQTT_USE_ASYNC
  112. #define MQTT_USE_ASYNC 0
  113. #endif
  114. #define MQTT_SERVER ""
  115. #define MQTT_PORT 1883
  116. #define MQTT_TOPIC "/test/switch/{identifier}"
  117. #define MQTT_RETAIN true
  118. #define MQTT_QOS 0
  119. #define MQTT_KEEPALIVE 30
  120. #define MQTT_RECONNECT_DELAY 10000
  121. #define MQTT_TRY_INTERVAL 30000
  122. #define MQTT_MAX_TRIES 12
  123. #define MQTT_SKIP_RETAINED 1
  124. #define MQTT_SKIP_TIME 1000
  125. #define MQTT_ACTION_TOPIC "/action"
  126. #define MQTT_RELAY_TOPIC "/relay"
  127. #define MQTT_LED_TOPIC "/led"
  128. #define MQTT_COLOR_TOPIC "/color"
  129. #define MQTT_BUTTON_TOPIC "/button"
  130. #define MQTT_IP_TOPIC "/ip"
  131. #define MQTT_VERSION_TOPIC "/version"
  132. #define MQTT_UPTIME_TOPIC "/uptime"
  133. #define MQTT_FREEHEAP_TOPIC "/freeheap"
  134. #define MQTT_VCC_TOPIC "/vcc"
  135. #define MQTT_STATUS_TOPIC "/status"
  136. #define MQTT_ACTION_RESET "reset"
  137. #define MQTT_CONNECT_EVENT 0
  138. #define MQTT_DISCONNECT_EVENT 1
  139. #define MQTT_MESSAGE_EVENT 2
  140. // Custom get and set postfixes
  141. // Use something like "/status" or "/set", with leading slash
  142. #define MQTT_USE_GETTER ""
  143. #define MQTT_USE_SETTER ""
  144. // Periodic reports
  145. #define MQTT_STATUS_REPORT 1
  146. #define MQTT_IP_REPORT 2
  147. #define MQTT_UPTIME_REPORT 4
  148. #define MQTT_FREEHEAP_REPORT 8
  149. #define MQTT_VCC_REPORT 16
  150. #define MQTT_REPORTS (MQTT_STATUS_REPORT | MQTT_UPTIME_REPORT | MQTT_FREEHEAP_REPORT)
  151. // -----------------------------------------------------------------------------
  152. // I2C
  153. // -----------------------------------------------------------------------------
  154. #define ENABLE_I2C 0
  155. #define I2C_SDA_PIN 4
  156. #define I2C_SCL_PIN 14
  157. #define I2C_CLOCK_STRETCH_TIME 200
  158. #define I2C_SCL_FREQUENCY 1000
  159. // -----------------------------------------------------------------------------
  160. // MY9291
  161. // -----------------------------------------------------------------------------
  162. #define MY9291_DI_PIN 13
  163. #define MY9291_DCKI_PIN 15
  164. #define MY9291_COMMAND MY9291_COMMAND_DEFAULT
  165. #define MY9291_COLOR_RED 0
  166. #define MY9291_COLOR_GREEN 0
  167. #define MY9291_COLOR_BLUE 0
  168. #define MY9291_COLOR_WHITE 192
  169. // -----------------------------------------------------------------------------
  170. // DOMOTICZ
  171. // -----------------------------------------------------------------------------
  172. #ifndef ENABLE_DOMOTICZ
  173. #define ENABLE_DOMOTICZ 1
  174. #endif
  175. #define DOMOTICZ_IN_TOPIC "domoticz/in"
  176. #define DOMOTICZ_OUT_TOPIC "domoticz/out"
  177. // -----------------------------------------------------------------------------
  178. // NTP
  179. // -----------------------------------------------------------------------------
  180. #define NTP_SERVER "pool.ntp.org"
  181. #define NTP_TIME_OFFSET 1
  182. #define NTP_DAY_LIGHT true
  183. #define NTP_UPDATE_INTERVAL 1800
  184. // -----------------------------------------------------------------------------
  185. // FAUXMO
  186. // -----------------------------------------------------------------------------
  187. // This setting defines whether Alexa support should be built into the firmware
  188. #ifndef ENABLE_FAUXMO
  189. #define ENABLE_FAUXMO 1
  190. #endif
  191. // This is default value for the fauxmoEnabled setting that defines whether
  192. // this device should be discoberable and respond to Alexa commands.
  193. // Both ENABLE_FAUXMO and fauxmoEnabled should be 1 for Alexa support to work.
  194. #define FAUXMO_ENABLED 1