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.

258 lines
8.6 KiB

8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 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. // BUTTON
  17. //--------------------------------------------------------------------------------
  18. #define BUTTON_LNGCLICK_LENGTH 1000
  19. #define BUTTON_LNGLNGCLICK_LENGTH 10000
  20. #define BUTTON_EVENT_NONE 0
  21. #define BUTTON_EVENT_PRESSED 1
  22. #define BUTTON_EVENT_CLICK 2
  23. #define BUTTON_EVENT_DBLCLICK 3
  24. #define BUTTON_EVENT_LNGCLICK 4
  25. #define BUTTON_EVENT_LNGLNGCLICK 5
  26. #define BUTTON_MODE_NONE 0
  27. #define BUTTON_MODE_TOGGLE 1
  28. #define BUTTON_MODE_AP 2
  29. #define BUTTON_MODE_RESET 3
  30. #define BUTTON_MODE_PULSE 4
  31. #define BUTTON_MODE_FACTORY 5
  32. #define BUTTON_DEFAULT_MODE BUTTON_MODE_TOGGLE
  33. //--------------------------------------------------------------------------------
  34. // RELAY
  35. //--------------------------------------------------------------------------------
  36. #define RELAY_MODE_OFF 0
  37. #define RELAY_MODE_ON 1
  38. #define RELAY_MODE_SAME 2
  39. #define RELAY_MODE_TOOGLE 3
  40. #define RELAY_SYNC_ANY 0
  41. #define RELAY_SYNC_NONE_OR_ONE 1
  42. #define RELAY_SYNC_ONE 2
  43. #define RELAY_SYNC_SAME 3
  44. #define RELAY_PULSE_NONE 0
  45. #define RELAY_PULSE_OFF 1
  46. #define RELAY_PULSE_ON 2
  47. #define RELAY_PROVIDER_RELAY 0
  48. #define RELAY_PROVIDER_DUAL 1
  49. #define RELAY_PROVIDER_LIGHT 2
  50. // Pulse time in seconds
  51. #define RELAY_PULSE_TIME 1
  52. // 0 means OFF, 1 ON and 2 whatever was before
  53. #define RELAY_MODE RELAY_MODE_OFF
  54. // 0 means ANY, 1 zero or one and 2 one and only one
  55. #define RELAY_SYNC RELAY_SYNC_ANY
  56. // 0 means no pulses, 1 means normally off, 2 normally on
  57. #define RELAY_PULSE_MODE RELAY_PULSE_NONE
  58. //--------------------------------------------------------------------------------
  59. // I18N
  60. //--------------------------------------------------------------------------------
  61. #define TMP_CELSIUS 0
  62. #define TMP_FAHRENHEIT 1
  63. #define TMP_UNITS TMP_CELSIUS
  64. //--------------------------------------------------------------------------------
  65. // LED
  66. //--------------------------------------------------------------------------------
  67. // All defined LEDs in the board can be managed through MQTT
  68. // except the first one when LED_AUTO is set to 1.
  69. // If LED_AUTO is set to 1 the board will use first defined LED to show wifi status.
  70. #define LED_AUTO 1
  71. // -----------------------------------------------------------------------------
  72. // WIFI & WEB
  73. // -----------------------------------------------------------------------------
  74. #define WIFI_RECONNECT_INTERVAL 120000
  75. #define WIFI_MAX_NETWORKS 5
  76. #define ADMIN_PASS "fibonacci"
  77. #define FORCE_CHANGE_PASS 1
  78. #define HTTP_USERNAME "admin"
  79. #define WS_BUFFER_SIZE 5
  80. #define WS_TIMEOUT 1800000
  81. #define WEBSERVER_PORT 80
  82. #define DNS_PORT 53
  83. #define ENABLE_MDNS 1
  84. #define WEB_MODE_NORMAL 0
  85. #define WEB_MODE_PASSWORD 1
  86. #define AP_MODE AP_MODE_ALONE
  87. // This option builds the firmware with the web interface embedded.
  88. // You first have to build the data.h file that holds the contents
  89. // of the web interface by running "gulp buildfs_embed"
  90. #ifndef EMBEDDED_WEB
  91. #define EMBEDDED_WEB 1
  92. #endif
  93. // -----------------------------------------------------------------------------
  94. // OTA & NOFUSS
  95. // -----------------------------------------------------------------------------
  96. #define OTA_PORT 8266
  97. #define NOFUSS_SERVER ""
  98. #define NOFUSS_INTERVAL 3600000
  99. // -----------------------------------------------------------------------------
  100. // MQTT
  101. // -----------------------------------------------------------------------------
  102. #ifndef MQTT_USE_ASYNC
  103. #define MQTT_USE_ASYNC 1
  104. #endif
  105. #define MQTT_SERVER ""
  106. #define MQTT_PORT 1883
  107. #define MQTT_SSL 0
  108. #define MQTT_TOPIC "/test/switch/{identifier}"
  109. #define MQTT_RETAIN true
  110. #define MQTT_QOS 0
  111. #define MQTT_KEEPALIVE 30
  112. #define MQTT_RECONNECT_DELAY 10000
  113. #define MQTT_TRY_INTERVAL 30000
  114. #define MQTT_MAX_TRIES 12
  115. #define MQTT_SKIP_RETAINED 1
  116. #define MQTT_SKIP_TIME 1000
  117. #define MQTT_TOPIC_ACTION "/action"
  118. #define MQTT_TOPIC_RELAY "/relay"
  119. #define MQTT_TOPIC_LED "/led"
  120. #define MQTT_TOPIC_COLOR "/color"
  121. #define MQTT_TOPIC_BUTTON "/button"
  122. #define MQTT_TOPIC_IP "/ip"
  123. #define MQTT_TOPIC_VERSION "/version"
  124. #define MQTT_TOPIC_UPTIME "/uptime"
  125. #define MQTT_TOPIC_FREEHEAP "/freeheap"
  126. #define MQTT_TOPIC_VCC "/vcc"
  127. #define MQTT_TOPIC_STATUS "/status"
  128. #define MQTT_TOPIC_MAC "/mac"
  129. #define MQTT_TOPIC_APP "/app"
  130. #define MQTT_TOPIC_INTERVAL "/interval"
  131. #define MQTT_TOPIC_HOSTNAME "/hostname"
  132. // Periodic reports
  133. #define MQTT_REPORT_STATUS 1
  134. #define MQTT_REPORT_IP 1
  135. #define MQTT_REPORT_MAC 1
  136. #define MQTT_REPORT_UPTIME 1
  137. #define MQTT_REPORT_FREEHEAP 1
  138. #define MQTT_REPORT_VCC 1
  139. #define MQTT_REPORT_RELAY 1
  140. #define MQTT_REPORT_HOSTNAME 1
  141. #define MQTT_REPORT_APP 1
  142. #define MQTT_REPORT_VERSION 1
  143. #define MQTT_REPORT_INTERVAL 0
  144. #define MQTT_STATUS_ONLINE "1"
  145. #define MQTT_STATUS_OFFLINE "0"
  146. #define MQTT_ACTION_RESET "reset"
  147. #define MQTT_CONNECT_EVENT 0
  148. #define MQTT_DISCONNECT_EVENT 1
  149. #define MQTT_MESSAGE_EVENT 2
  150. // Custom get and set postfixes
  151. // Use something like "/status" or "/set", with leading slash
  152. #define MQTT_USE_GETTER ""
  153. #define MQTT_USE_SETTER ""
  154. // -----------------------------------------------------------------------------
  155. // I2C
  156. // -----------------------------------------------------------------------------
  157. #define ENABLE_I2C 0
  158. #define I2C_SDA_PIN 4
  159. #define I2C_SCL_PIN 14
  160. #define I2C_CLOCK_STRETCH_TIME 200
  161. #define I2C_SCL_FREQUENCY 1000
  162. // -----------------------------------------------------------------------------
  163. // LIGHT
  164. // -----------------------------------------------------------------------------
  165. #define LIGHT_PROVIDER_NONE 0
  166. #define LIGHT_PROVIDER_WS2812 1
  167. #define LIGHT_PROVIDER_RGB 2
  168. #define LIGHT_PROVIDER_RGBW 3
  169. #define LIGHT_PROVIDER_MY9192 4
  170. #define LIGHT_DEFAULT_COLOR "#000080"
  171. #define LIGHT_SAVE_DELAY 5
  172. #define MY9291_DI_PIN 13
  173. #define MY9291_DCKI_PIN 15
  174. #define MY9291_COMMAND MY9291_COMMAND_DEFAULT
  175. // Shared settings between RGB and RGBW lights
  176. #define RGBW_INVERSE_LOGIC 1
  177. #define RGBW_RED_PIN 14
  178. #define RGBW_GREEN_PIN 5
  179. #define RGBW_BLUE_PIN 12
  180. #define RGBW_WHITE_PIN 13
  181. // -----------------------------------------------------------------------------
  182. // DOMOTICZ
  183. // -----------------------------------------------------------------------------
  184. #ifndef ENABLE_DOMOTICZ
  185. #define ENABLE_DOMOTICZ 1
  186. #endif
  187. #define DOMOTICZ_IN_TOPIC "domoticz/in"
  188. #define DOMOTICZ_OUT_TOPIC "domoticz/out"
  189. // -----------------------------------------------------------------------------
  190. // NTP
  191. // -----------------------------------------------------------------------------
  192. #define NTP_SERVER "pool.ntp.org"
  193. #define NTP_TIME_OFFSET 1
  194. #define NTP_DAY_LIGHT true
  195. #define NTP_UPDATE_INTERVAL 1800
  196. // -----------------------------------------------------------------------------
  197. // FAUXMO
  198. // -----------------------------------------------------------------------------
  199. // This setting defines whether Alexa support should be built into the firmware
  200. #ifndef ENABLE_FAUXMO
  201. #define ENABLE_FAUXMO 1
  202. #endif
  203. // This is default value for the fauxmoEnabled setting that defines whether
  204. // this device should be discoberable and respond to Alexa commands.
  205. // Both ENABLE_FAUXMO and fauxmoEnabled should be 1 for Alexa support to work.
  206. #define FAUXMO_ENABLED 1